Java Code Examples for com.google.gwt.core.client.Scheduler#ScheduledCommand

The following examples show how to use com.google.gwt.core.client.Scheduler#ScheduledCommand . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YoungAndroidPalettePanel.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
private void requestRebuildList() {
  if (rebuild != null) {
    return;
  }

  rebuild = new Scheduler.ScheduledCommand() {
    @Override
    public void execute() {
      arrayString.setLength(0);
      for (String s : translationMap.keySet()) {
        arrayString.push(s);
      }
      sort();
      // Refresh the list by repeating the search
      doSearch(true);
      rebuild = null;
    }
  };
  Scheduler.get().scheduleDeferred(rebuild);
}
 
Example 2
Source File: Bootstrapper.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void prepareSecurityContext(Scheduler.ScheduledCommand andThen) {
    // creates an empty (always true) security context for the bootstrap steps
    /*securityFramework.createSecurityContext(null, Collections.<String>emptySet(), false,
            new AsyncCallback<SecurityContext>() {
                @Override
                public void onFailure(Throwable caught) {
                    andThen.execute();
                }

                @Override
                public void onSuccess(SecurityContext result) {
                    andThen.execute();
                }
            });*/
    andThen.execute();
}
 
Example 3
Source File: CubaGridWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Scheduler.ScheduledCommand getSelectAllCommand() {
    return () -> {
        for (Column column : getColumns()) {
            if (column.isHidden()) {
                column.setHidden(false);
            }
        }
    };
}
 
Example 4
Source File: CollapsibleSplitLayoutPanel.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setAssociatedWidgetSize(double size) {
    double maxSize = getMaxSize();
    if (size > maxSize) {
        size = maxSize;
    }

    if (snapClosedSize > 0 && size < snapClosedSize) {
        size = 0;
    } else if (size < minSize) {
        size = minSize;
    }

    LayoutData layout = (LayoutData) target.getLayoutData();
    if (size == layout.size) {
        return;
    }

    // Adjust our view until the deferred layout gets scheduled.
    centerSize += layout.size - size;
    layout.size = size;

    // Defer actually updating the layout, so that if we receive many
    // mouse events before layout/paint occurs, we'll only update once.
    if (layoutCommand == null) {
        layoutCommand = new Scheduler.ScheduledCommand() {
            @Override
            public void execute() {
                layoutCommand = null;
                forceLayout();
            }
        };
        Scheduler.get().scheduleDeferred(layoutCommand);
    }
}
 
Example 5
Source File: FinderPanel.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setAssociatedWidgetSize(double size) {
    double maxSize = getMaxSize();
    if (size > maxSize) {
        size = maxSize;
    }

    if (snapClosedSize > 0 && size < snapClosedSize) {
        size = 0;
    } else if (size < minSize) {
        size = minSize;
    }

    LayoutData layout = (LayoutData) target.getLayoutData();
    if (size == layout.size) {
        return;
    }

    // Adjust our view until the deferred layout gets scheduled.
    centerSize += layout.size - size;
    layout.size = size;

    // Defer actually updating the layout, so that if we receive many
    // mouse events before layout/paint occurs, we'll only update once.
    if (layoutCommand == null) {
        layoutCommand = new Scheduler.ScheduledCommand() {
            @Override
            public void execute() {
                layoutCommand = null;
                forceLayout();
            }
        };
        Scheduler.get().scheduleDeferred(layoutCommand);
    }
}
 
Example 6
Source File: DataSourceFinder.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void verifyConnection(final DataSource dataSource, boolean xa, boolean existing,
        Scheduler.ScheduledCommand onCreated) {
    VerifyConnectionOp vop = new VerifyConnectionOp(dataSourceStore, dispatcher, beanFactory,
            currentProfileSelection.getName());
    vop.execute(dataSource, xa, existing, new SimpleCallback<VerifyConnectionOp.VerifyResult>() {
        @Override
        public void onSuccess(final VerifyConnectionOp.VerifyResult result) {
            getView().showVerifyConncectionResult(dataSource.getName(), result);
            if (result.wasCreated() && onCreated != null) {
                Scheduler.get().scheduleDeferred(onCreated);
            }
        }
    });
}
 
Example 7
Source File: CubaTreeGridWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Scheduler.ScheduledCommand getDeselectAllCommand() {
    return () -> {
        for (Column column : getColumns()) {
            if (column.isHidable() && !column.isHidden()) {
                column.setHidden(true);
            }
        }
    };
}
 
Example 8
Source File: CubaTreeGridWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Scheduler.ScheduledCommand getSelectAllCommand() {
    return () -> {
        for (Column column : getColumns()) {
            if (column.isHidden()) {
                column.setHidden(false);
            }
        }
    };
}
 
Example 9
Source File: SuggestionsContainer.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void performItemCommand(final SuggestionItem item) {
    selectedItem = item;

    Scheduler.ScheduledCommand cmd = item.getScheduledCommand();
    if (cmd != null) {
        FocusImpl.getFocusImplForPanel().blur(getElement());

        Scheduler.get().scheduleFinally(cmd);
    }
}
 
Example 10
Source File: CubaGridWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Scheduler.ScheduledCommand getDeselectAllCommand() {
    return () -> {
        for (Column column : getColumns()) {
            if (column.isHidable() && !column.isHidden()) {
                column.setHidden(true);
            }
        }
    };
}
 
Example 11
Source File: GwtMenuImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public GwtMenuImpl() {
  myMenu = new MenuItem("", (Scheduler.ScheduledCommand)null);
}
 
Example 12
Source File: BrowseByItem.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public BrowseByItem(final String title, final ExternalTextResource preview,
        final Scheduler.ScheduledCommand onSelect) {
    this.title = title;
    this.preview = preview;
    this.onSelect = onSelect;
}
 
Example 13
Source File: BrowseByItem.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Scheduler.ScheduledCommand onSelect() {
    return onSelect;
}
 
Example 14
Source File: NewDatasourceWizard.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
void verifyConnection(Scheduler.ScheduledCommand onCreated) {
    presenter.verifyConnection(context.dataSource(), context.xa, context.dataSourceCreatedByTest, onCreated);
}
 
Example 15
Source File: BrowseByItem.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public BrowseByItem(final String title, final ExternalTextResource preview,
        final Scheduler.ScheduledCommand onSelect) {
    this.title = title;
    this.preview = preview;
    this.onSelect = onSelect;
}
 
Example 16
Source File: BrowseByItem.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Scheduler.ScheduledCommand onSelect() {
    return onSelect;
}
 
Example 17
Source File: SuggestionItem.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void setScheduledCommand(Scheduler.ScheduledCommand cmd) {
    this.cmd = cmd;
}
 
Example 18
Source File: SuggestionItem.java    From cuba with Apache License 2.0 4 votes vote down vote up
public Scheduler.ScheduledCommand getScheduledCommand() {
    return cmd;
}