Java 类com.google.gwt.core.client.Scheduler.ScheduledCommand 实例源码

项目:unitime    文件:TimeSelector.java   
private TimeMenuItem(final int slot) {
    super(slot2time(slot, iStart == null || iStart.getValue() == null ? 0 : slot - iStart.getValue()),
        true,
        new ScheduledCommand() {
            @Override
            public void execute() {
                hideSuggestions();
                setValue(slot, true);
                iLastSelected = iText.getText();
                fireSuggestionEvent(slot);
            }
        }
    );
    setStyleName("item");
    getElement().setAttribute("whiteSpace", "nowrap");
    iSlot = slot;
}
项目:empiria.player    文件:EntriesController.java   
public void loadEntry(String password, final int index, final boolean playSound) {
    final String path = dictionaryFilenameProvider.getFilePathForIndex(index);

    scheduler.scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            try {
                FileRequestCallback fileRequestCallback = dictionaryModuleFactory.createFileRequestCallback(index, playSound);

                FileRequest fileRequest = fileRequestProvider.get();
                fileRequest.setUrl(path);
                fileRequest.send(null, fileRequestCallback);
            } catch (FileRequestException exception) {
                logger.error(exception);
            }
        }
    });
}
项目:OSWf-OSWorkflow-fork    文件:ActorView.java   
void focusInputField(final FormItem focusItem) {

        Scheduler.get().scheduleDeferred( new Scheduler.ScheduledCommand() {

            @Override
            public void execute() {
                // Reset the search field for next time
                focusItem.focusInItem();
            }

        });

        // DeferredCommand.addCommand(new Command() {
        //     public void execute() {
        //         // Reset the search field for next time
        //         focusItem.focusInItem();
        //     }
        // });

    }
项目:OSWf-OSWorkflow-fork    文件:InputsView.java   
void focusInputField(final FormItem focusItem) {
    Scheduler.get().scheduleDeferred( new Scheduler.ScheduledCommand() {

        @Override
        public void execute() {
            // Reset the search field for next time
            focusItem.focusInItem();
        }

    });

    // DeferredCommand.addCommand(new Command() {
    //     public void execute() {
    //         // Reset the search field for next time
    //         focusItem.focusInItem();
    //     }
    // });

}
项目:unitimes    文件:CurriculaCourses.java   
public void openNew() {
    setText(MESSAGES.dialogNewGroup());
    iGrOldName = null;
    iGrName.setText(String.valueOf((char)('A' + getGroups().size())));
    iGrType.setSelectedIndex(0);
    iGrAssign.setVisible(true);
    iGrDelete.setVisible(false);
    iGrUpdate.setVisible(false);
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            iGrName.setFocus(true);
            iGrName.selectAll();
        }
    });
    center();
}
项目:unitimes    文件:TimeSelector.java   
private TimeMenuItem(final int slot) {
    super(slot2time(slot, iStart == null || iStart.getValue() == null ? 0 : slot - iStart.getValue()),
        true,
        new ScheduledCommand() {
            @Override
            public void execute() {
                hideSuggestions();
                setValue(slot, true);
                iLastSelected = iText.getText();
                fireSuggestionEvent(slot);
            }
        }
    );
    setStyleName("item");
    getElement().setAttribute("whiteSpace", "nowrap");
    iSlot = slot;
}
项目:unitimes    文件:SessionDatesSelector.java   
public SessionDatesSelector(AcademicSessionProvider session) {
    iAcademicSession = session;

    iPanel = new UniTimeWidget<DatesPanel>(new DatesPanel());

    initWidget(iPanel);

    iAcademicSession.addAcademicSessionChangeHandler(new AcademicSessionChangeHandler() {
        @Override
        public void onAcademicSessionChange(AcademicSessionChangeEvent event) {
            if (event.isChanged()) init(event.getNewAcademicSessionId());
        }
    });

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            init(iAcademicSession.getAcademicSessionId());
        }
    });
}
项目:unitimes    文件:UserAuthentication.java   
public void authenticate() {
    if (!CONSTANTS.allowUserLogin()) {
        if (isAllowLookup())
            doLookup();
        else
            ToolBox.open(GWT.getHostPageBaseURL() + "login.do?target=" + URL.encodeQueryString(Window.Location.getHref()));
        return;
    }
    AriaStatus.getInstance().setText(ARIA.authenticationDialogOpened());
    iError.setVisible(false);
    iDialog.center();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            iUserName.selectAll();
            iUserName.setFocus(true);
        }
    });
}
项目:WebConsole    文件:WebConsole.java   
public void onModuleLoad() {

        // Create Exception alert
        GWT.setUncaughtExceptionHandler(new
          GWT.UncaughtExceptionHandler() {
          public void onUncaughtException(Throwable e) {
            Throwable unwrapped = unwrap(e);
            LOG.log(Level.SEVERE, "Ex caught!", e);
        }
        });

        Scheduler.get().scheduleDeferred(new ScheduledCommand() {  
      public void execute() {  
        onModuleLoad2();  
      }  
    });

    }
项目:gwt-oauth2    文件:Auth.java   
/**
 * Request an access token from an OAuth 2.0 provider.
 *
 * <p>
 * If it can be determined that the user has already granted access, and the
 * token has not yet expired, and that the token will not expire soon, the
 * existing token will be passed to the callback.
 * </p>
 *
 * <p>
 * Otherwise, a popup window will be displayed which may prompt the user to
 * grant access. If the user has already granted access the popup will
 * immediately close and the token will be passed to the callback. If access
 * hasn't been granted, the user will be prompted, and when they grant, the
 * token will be passed to the callback.
 * </p>
 *
 * @param req Request for authentication.
 * @param callback Callback to pass the token to when access has been granted.
 */
public void login(AuthRequest req, final Callback<String, Throwable> callback) {
  lastRequest = req;
  lastCallback = callback;

  String authUrl = req.toUrl(urlCodex) + "&redirect_uri=" + urlCodex.encode(oauthWindowUrl);

  // Try to look up the token we have stored.
  final TokenInfo info = getToken(req);
  if (info == null || info.expires == null || expiringSoon(info)) {
    // Token wasn't found, or doesn't have an expiration, or is expired or
    // expiring soon. Requesting access will refresh the token.
    doLogin(authUrl, callback);
  } else {
    // Token was found and is good, immediately execute the callback with the
    // access token.

    scheduler.scheduleDeferred(new ScheduledCommand() {
      @Override
      public void execute() {
        callback.onSuccess(info.accessToken);
      }
    });
  }
}
项目:gwt-oauth2    文件:AuthTest.java   
/**
 * When the token is found in cookies and will not expire soon, neither popup
 * nor iframe is used, and the token is immediately passed to the callback.
 */
public void testLogin_notExpiringSoon() {
  AuthRequest req = new AuthRequest("url", "clientId").withScopes("scope");

  // Storing a token that does not expire soon (in exactly 10 minutes)
  TokenInfo info = new TokenInfo();
  info.accessToken = "notExpiringSoon";
  info.expires = String.valueOf(MockClock.now + 10 * 60 * 1000);
  auth.setToken(req, info);

  MockCallback callback = new MockCallback();
  auth.login(req, callback);

  // A deferred command will have been scheduled. Execute it.
  List<ScheduledCommand> deferred = ((StubScheduler) auth.scheduler).getScheduledCommands();
  assertEquals(1, deferred.size());
  deferred.get(0).execute();

  // The iframe was used and the popup wasn't.
  assertFalse(auth.loggedInViaPopup);

  // onSuccess() was called and onFailure() wasn't.
  assertEquals("notExpiringSoon", callback.token);
  assertNull(callback.failure);
}
项目:x-cure-chat    文件:MessagesStackNavigator.java   
/**
 * Shows the last stack element in the scroll panel
 */
private void scrollToLastStackElement() {
    //Make it into the deferred command because the element might be shown later,
    //such as if this method is called before the forum section is selected
    if( messageStack.size() > 0 ) {
        final MessageStackElement element = messageStack.get( messageStack.size() - 1 );
        Scheduler.get().scheduleDeferred( new ScheduledCommand(){
            @Override
            public void execute() {
                //Ensure that the top stack element is visible in the stack
                if( element.isAttached() ) {
                    scrollPanel.ensureVisible( element );
                }
            }
        });
    }
}
项目:x-cure-chat    文件:ForumBodyWidget.java   
@Override
public void onAfterComponentIsAdded() {
    //Re-add the panel size, here we have to account for the
    //browsers because they do not render the first view correctly
    //if the person comes directly to the forum page
    BrowserDetect detect = BrowserDetect.getBrowserDetect();
    if( isFirstTime && ( detect.isChrome() || detect.isSafari() || detect.isFirefox() ) ) {
        //We do the update in the deferred command because only this way 
        //the browser does it after the rendering of the view is complete
        Scheduler.get().scheduleDeferred( new ScheduledCommand(){
            @Override
            public void execute() {
                updateUIElements();
            }
        });
        isFirstTime = false;
    }
}
项目:x-cure-chat    文件:RoomUserAccessDialogUI.java   
/**
 * Enable/Disable dialog buttons and other elements
 */
private void setEnabledElements(final boolean enableLeft, final boolean enableRight, final boolean other ){
    Scheduler.get().scheduleDeferred( new ScheduledCommand(){
        public void execute(){
            setLeftEnabled( enableLeft );
            setRightEnabled( enableRight );

            //The other room access dialog elements
            isReadCheckBox.setEnabled( other );
            isWriteCheckBox.setEnabled( other && ( ! isSystemCheckBox.getValue() ) );
            isSystemCheckBox.setEnabled( other && ( ! isWriteCheckBox.getValue() ) );                   
            //Enable the read all check box only if it is a system property
            isReadAllCheckBox.setEnabled( other && isSystemCheckBox.getValue() );
            //Enable the selection list only if the read all is checked  
            readAllDurationListBox.setEnabled( other && isReadAllCheckBox.getValue() );
        }
    });
}
项目:x-cure-chat    文件:CopyUrlInfoPanel.java   
/**
 * Allows to open a new popup with the url link
 * @param opener the widget from which we open this pop-up
 * @param url the url to be displayed
 */
public static void showPopup( final Widget opener, final String url ) {
    //Create the popup panel object
    final CopyUrlInfoPanel panel = new CopyUrlInfoPanel( true, true, url );
    //Do not do animation because otherwise Firefox will remove url text selection
    panel.setAnimationEnabled(false);
    //Show the pop-up panel at some proper position, in such a way that
    //it does not go outside the window area, also make the popup modal
    panel.setPopupPositionAndShow( panel.new InfoPopUpPositionCallback( opener ) );
    //Set the text in the text field to be selected, also add focus
    //Do it deferred in order to  make sure that the selectAll is
    //called after the pop-up is shown and visible
    Scheduler.get().scheduleDeferred( new ScheduledCommand(){
        @Override
        public void execute() {
            panel.urlTextBox.setFocus(true);
            panel.urlTextBox.selectAll();
        }
    });
}
项目:x-cure-chat    文件:SendChatMessagePanelUI.java   
@Override
public void updateUIElements() {
    Scheduler.get().scheduleDeferred( new ScheduledCommand(){
        @Override
        public void execute() {
            //Adjust the width of the recipients panel, do it in a deferred
            //command just in case the element is not visible yet
            commonWidgets.addjustRecipientsScrollPanel();
        }
    });

    //Opera can not set the proper width for the message body wrapper. Therefore,
    //we first try to put the focus to the button and then to the text box
    if( BrowserDetect.getBrowserDetect().isOpera() ) {
        sendButton.setFocus(true);
    }
    //Propagate the call
    commonWidgets.updateUIElements();
}
项目:teiid-webui    文件:ExtendedTextBox.java   
@Override
public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);

    switch (event.getTypeInt()) {
    case Event.ONKEYUP:
    case Event.ONPASTE:
    {
        // Scheduler needed so pasted data shows up in TextBox before we fire event
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            @Override
            public void execute() {
                fireEvent(new TextChangeEvent());
            }
        });
        break;
    }
    default:
        // Do nothing
    }
}
项目:teiid-webui    文件:ExtendedTextArea.java   
@Override
public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);

    switch (event.getTypeInt()) {
    case Event.ONKEYUP:
    case Event.ONPASTE:
    {
        // Scheduler needed so pasted data shows up in TextBox before we fire event
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            @Override
            public void execute() {
                fireEvent(new TextChangeEvent());
            }
        });
        break;
    }
    default:
        // Do nothing
    }
}
项目:hawkbit    文件:SuggestionsSelectList.java   
/**
 * Adds suggestions to the suggestion menu bar.
 * 
 * @param suggestions
 *            the suggestions to be added
 * @param textFieldWidget
 *            the text field which the suggestion is attached to to bring
 *            back the focus after selection
 * @param popupPanel
 *            pop-up panel where the menu bar is shown to hide it after
 *            selection
 * @param suggestionServerRpc
 *            server RPC to ask for new suggestion after a selection
 */
public void addItems(final List<SuggestTokenDto> suggestions, final VTextField textFieldWidget,
        final PopupPanel popupPanel, final TextFieldSuggestionBoxServerRpc suggestionServerRpc) {
    for (int index = 0; index < suggestions.size(); index++) {
        final SuggestTokenDto suggestToken = suggestions.get(index);
        final MenuItem mi = new MenuItem(suggestToken.getSuggestion(), true, new ScheduledCommand() {
            @Override
            public void execute() {
                final String tmpSuggestion = suggestToken.getSuggestion();
                final TokenStartEnd tokenStartEnd = tokenMap.get(tmpSuggestion);
                final String text = textFieldWidget.getValue();
                final StringBuilder builder = new StringBuilder(text);
                builder.replace(tokenStartEnd.getStart(), tokenStartEnd.getEnd() + 1, tmpSuggestion);
                textFieldWidget.setValue(builder.toString(), true);
                popupPanel.hide();
                textFieldWidget.setFocus(true);
                suggestionServerRpc.suggest(builder.toString(), textFieldWidget.getCursorPos());
            }
        });
        tokenMap.put(suggestToken.getSuggestion(),
                new TokenStartEnd(suggestToken.getStart(), suggestToken.getEnd()));
        Roles.getListitemRole().set(mi.getElement());
        WidgetUtil.sinkOnloadForImages(mi.getElement());
        addItem(mi);
    }
}
项目:gwt-oauth    文件:Auth.java   
/**
 * Request an access token from an OAuth 2.0 provider.
 *
 * <p>
 * If it can be determined that the user has already granted access, and the
 * token has not yet expired, and that the token will not expire soon, the
 * existing token will be passed to the callback.
 * </p>
 *
 * <p>
 * Otherwise, a popup window will be displayed which may prompt the user to
 * grant access. If the user has already granted access the popup will
 * immediately close and the token will be passed to the callback. If access
 * hasn't been granted, the user will be prompted, and when they grant, the
 * token will be passed to the callback.
 * </p>
 *
 * @param req Request for authentication.
 * @param callback Callback to pass the token to when access has been granted.
 */
public void login(AuthRequest req, final Callback<String, Throwable> callback) {
  lastRequest = req;
  lastCallback = callback;

  String authUrl = req.toUrl(urlCodex) + "&redirect_uri=" + urlCodex.encode(oauthWindowUrl);

  // Try to look up the token we have stored.
  final TokenInfo info = getToken(req);
  if (info == null || info.expires == null || expiringSoon(info)) {
    // Token wasn't found, or doesn't have an expiration, or is expired or
    // expiring soon. Requesting access will refresh the token.
    doLogin(authUrl, callback);
  } else {
    // Token was found and is good, immediately execute the callback with the
    // access token.

    scheduler.scheduleDeferred(new ScheduledCommand() {
      @Override
      public void execute() {
        callback.onSuccess(info.accessToken);
      }
    });
  }
}
项目:forplay    文件:HtmlGame.java   
@Override
public final void onModuleLoad() {
  GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
    @Override
    public void onUncaughtException(Throwable e) {
      ForPlay.log().error("Uncaught Exception: ", e);
    }
  });

  // Need to do everything else in a deferred command, so that
  // the uncaught exception handler has taken effect
  Scheduler.get().scheduleDeferred(new ScheduledCommand() {

    @Override
    public void execute() {
      start();
    }

  });
}
项目:che    文件:AnimationUtils.java   
/** Flashes an element to highlight that it has recently changed. */
public static void flash(final Element elem) {
  /*
   * If we interrupt a flash with another flash, we need to disable animations
   * so the initial background color takes effect immediately. Animations are
   * reenabled in animatePropertySet.
   */
  removeTransitions(elem.getStyle());

  elem.getStyle().setBackgroundColor("#f9edbe");

  // Give the start color a chance to take effect.
  Scheduler.get()
      .scheduleDeferred(
          new ScheduledCommand() {
            @Override
            public void execute() {
              animatePropertySet(elem, "background-color", "", ALERT_TRANSITION_DURATION);
            }
          });
}
项目:proarc    文件:DigitalObjectChildrenEditor.java   
private void initOnEdit() {
//        LOG.info("initOnEdit");
        originChildren = null;
        lastClicked = null;
        updateReorderUi(false);
        attachListResultSet();
        // select first
        if (!childrenListGrid.getOriginalResultSet().isEmpty()) {
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    // defer the select as it is ignored after refresh in onDataArrived
                    selectChildFromHistory();
                }
            });
        }
    }
项目:proarc    文件:ImportBatchItemEditor.java   
private void selectNextChildAndFocus(Record record) {
    int nextSelection = getNextSelection(record);
    if (nextSelection < 0) {
        return ;
    }
    final HandlerRegistration[] editorLoadHandler = new HandlerRegistration[1];
    editorLoadHandler[0] = childEditor.addEditorLoadHandler(new EditorLoadHandler() {

        @Override
        public void onEditorLoad(EditorLoadEvent evt) {
            editorLoadHandler[0].removeHandler();
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    childEditor.focus();
                }
            });
        }
    });
    batchItemGrid.selectSingleRecord(nextSelection);
    batchItemGrid.scrollToRow(nextSelection);
}
项目:OpenTripPlanner-client-gwt    文件:OpenLayersPlannerMapWidget.java   
@Override
public void setBounds(Wgs84BoundsBean aBounds) {
    bounds = aBounds;
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            map.updateSize();
            Bounds extent = convertBounds(bounds);
            map.setMaxExtent(extent);
            map.setRestrictedExtent(extent);
            map.zoomToExtent(extent);
            // Zoom a bit inside as fitting bounds will be too large
            map.setCenter(map.getCenter(), map.getZoom() + 1);
        }
    });
}
项目:vaadin-scrollable-panel    文件:ScrollablePanelWidget.java   
private void startTrigger() {
    if (this.executor == null) {
        this.executor = new VLazyExecutor(this.scrollEventDelayMillis, new ScheduledCommand() {
            @Override
            public void execute() {
                if (ScrollablePanelWidget.this.timedHandler != null
                        && ScrollablePanelWidget.this.currentScrollingPos != null
                        && (ScrollablePanelWidget.this.lastSentScrollPos == null || !ScrollablePanelWidget.this.currentScrollingPos
                                .equals(ScrollablePanelWidget.this.lastSentScrollPos))) {
                    ScrollablePanelWidget.this.timedHandler.onScroll(ScrollablePanelWidget.this.currentScrollingPos);
                    ScrollablePanelWidget.this.lastSentScrollPos = ScrollablePanelWidget.this.currentScrollingPos;
                }
            }
        });
    }
    this.executor.trigger();
}
项目:gerrit    文件:DiffScreen.java   
private GutterClickHandler onGutterClick(CodeMirror cm) {
  return new GutterClickHandler() {
    @Override
    public void handle(
        CodeMirror instance, int line, String gutterClass, NativeEvent clickEvent) {
      if (Element.as(clickEvent.getEventTarget()).hasClassName(getLineNumberClassName())
          && clickEvent.getButton() == NativeEvent.BUTTON_LEFT
          && !clickEvent.getMetaKey()
          && !clickEvent.getAltKey()
          && !clickEvent.getCtrlKey()
          && !clickEvent.getShiftKey()) {
        cm.setCursor(Pos.create(line));
        Scheduler.get()
            .scheduleDeferred(
                new ScheduledCommand() {
                  @Override
                  public void execute() {
                    getCommentManager().newDraftOnGutterClick(cm, gutterClass, line + 1);
                  }
                });
      }
    }
  };
}
项目:gerrit    文件:OnEditEnabler.java   
private void onTextBoxBase(TextBoxBase tb) {
  // The text appears to not get updated until the handlers complete.
  Scheduler.get()
      .scheduleDeferred(
          new ScheduledCommand() {
            @Override
            public void execute() {
              String orig = strings.get(tb);
              if (orig == null) {
                orig = "";
              }
              if (!orig.equals(tb.getText().trim())) {
                widget.setEnabled(true);
              }
            }
          });
}
项目:umlet    文件:MenuPopup.java   
public MenuPopup(List<MenuPopupItem> items) {
    super(false, Type.MENU);
    MenuBar popupMenuBar = new MenuBar(true);

    for (final MenuPopupItem item : items) {
        popupMenuBar.addItem(new MenuItem(item.getText(), true, new ScheduledCommand() {
            @Override
            public void execute() {
                item.execute();
                hide();
            }
        }));
    }
    popupMenuBar.setVisible(true);
    add(popupMenuBar);
}
项目:unitime    文件:CurriculaCourses.java   
public void openNew() {
    setText(MESSAGES.dialogNewGroup());
    iGrOldName = null;
    iGrName.setText(String.valueOf((char)('A' + getGroups().size())));
    iGrType.setSelectedIndex(0);
    iGrAssign.setVisible(true);
    iGrDelete.setVisible(false);
    iGrUpdate.setVisible(false);
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            iGrName.setFocus(true);
            iGrName.selectAll();
        }
    });
    center();
}
项目:unitime    文件:UniTimeConfirmationDialog.java   
@Override
public void center() {
    super.center();
    if (iMessage != null && !iMessage.isEmpty())
        AriaStatus.getInstance().setText(ARIA.dialogOpened(getText()) + " " + iMessage + (iNo == null ? "" : " " + ARIA.confirmationEnterToAcceptEscapeToReject()));
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            if (iTextBox != null) {
                iTextBox.setFocus(true);
                iTextBox.selectAll();
            } else {
                iYes.setFocus(true);
            }
        }
    });
}
项目:unitime    文件:SessionDatesSelector.java   
public SessionDatesSelector(AcademicSessionProvider session) {
    iAcademicSession = session;

    iPanel = new UniTimeWidget<DatesPanel>(new DatesPanel());

    initWidget(iPanel);

    iAcademicSession.addAcademicSessionChangeHandler(new AcademicSessionChangeHandler() {
        @Override
        public void onAcademicSessionChange(AcademicSessionChangeEvent event) {
            if (event.isChanged()) init(event.getNewAcademicSessionId());
        }
    });

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            init(iAcademicSession.getAcademicSessionId());
        }
    });
}
项目:unitime    文件:UserAuthentication.java   
public void authenticate() {
    if (!CONSTANTS.allowUserLogin()) {
        if (isAllowLookup())
            doLookup();
        else
            ToolBox.open(GWT.getHostPageBaseURL() + "login.do?target=" + URL.encodeQueryString(Window.Location.getHref()));
        return;
    }
    AriaStatus.getInstance().setText(ARIA.authenticationDialogOpened());
    iError.setVisible(false);
    iDialog.center();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            iUserName.selectAll();
            iUserName.setFocus(true);
        }
    });
}
项目:blogwt    文件:GalleryPlugin.java   
@Override
public void emit (StringBuilder out, final List<String> lines,
        final Map<String, String> params) {
    final String id = HTMLPanel.createUniqueId();
    out.append("<div id=\"");
    out.append(id);
    out.append("\"> Loading gallery...</div>");

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute () {
            if (manager != null) {
                manager.fireEvent(new PluginContentReadyEvent(
                        GalleryPlugin.this, lines, params, id, "None"));
            }
        }
    });
}
项目:blogwt    文件:CachedIncludePlugin.java   
@Override
protected void getContent (final String src, final String id,
        final List<String> lines, final Map<String, String> params)
        throws IOException {
    if (src != null && src.length() > 0) {
        if (ensureCache().containsKey(src)) {
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute () {
                    CachedIncludePlugin.super.gotContent(null,
                            ensureCache().get(src), src, id, lines, params);
                }
            });
        } else {
            super.getContent(src, id, lines, params);
        }
    }
}
项目:platypus-js    文件:ModelGrid.java   
protected void enqueueServiceColumnsRedraw() {
    serviceColumnsRedrawQueued = true;
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            if (serviceColumnsRedrawQueued) {
                serviceColumnsRedrawQueued = false;
                if (getDataColumnCount() > 0) {
                    for (int i = 0; i < getDataColumnCount(); i++) {
                        ModelColumn col = (ModelColumn) getDataColumn(i);
                        if (col instanceof UsualServiceColumn) {
                            if (i < frozenColumns) {
                                frozenLeft.redrawAllRowsInColumn(i, dataProvider);
                                scrollableLeft.redrawAllRowsInColumn(i, dataProvider);
                            } else {
                                frozenRight.redrawAllRowsInColumn(i - frozenColumns, dataProvider);
                                scrollableRight.redrawAllRowsInColumn(i - frozenColumns, dataProvider);
                            }
                        }
                    }
                }
            }
        }
    });
}
项目:platypus-js    文件:JsTree.java   
protected void enqueueChanges() {
    changesQueued = new ScheduledCommand() {

           @Override
           public void execute() {
               if (changesQueued == this) {
                   changesQueued = null;
                   if (data != null) {
                       List<JavaScriptObject> items = new JsArrayList(data);
                       for (int i = 0; i < items.size(); i++) {
                           JavaScriptObject item = items.get(i);
                           changed(item);
                       }
                   }
               }
           }
       };
    Scheduler.get().scheduleDeferred(changesQueued);
}
项目:platypus-js    文件:JsTree.java   
private void enqueueReadd() {
    readdQueued = new ScheduledCommand() {

           @Override
           public void execute() {
               if (readdQueued == this) {
                   readdQueued = null;
                   if (boundToDataElements != null) {
                       boundToDataElements.removeHandler();
                       boundToDataElements = null;
                   }
                   if (data != null) {
                       boundToDataElements = Utils.listenElements(data, new Utils.OnChangeHandler() {

                           @Override
                           public void onChange(JavaScriptObject anEvent) {
                               enqueueChanges();
                           }
                       });
                   }
                   everythingChanged();
               }
           }
       };
    Scheduler.get().scheduleDeferred(readdQueued);
}
项目:platypus-js    文件:ModelCombo.java   
private void enqueueListReadd() {
    readdQueued = true;
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            if (readdQueued) {
                readdQueued = false;
                if (boundToListElements != null) {
                    boundToListElements.removeHandler();
                    boundToListElements = null;
                }
                if (displayList != null) {
                    boundToListElements = Utils.listenElements(displayList, new Utils.OnChangeHandler() {

                        @Override
                        public void onChange(JavaScriptObject anEvent) {
                            enqueueListChanges();
                        }
                    });
                }
                rebindList();
            }
        }
    });
}
项目:ahome-touch    文件:Component.java   
public void hide() {

        hideRendered();
        if (!isRendered()) {
            initHidden = true;
            this.addEventHandler(TouchAttribute.RENDERED_CHANGE.getValue(), new Function() {

                public void execute() {
                    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                        public void execute() {
                            hideRendered();
                        }
                    });
                }
            });
        }

    }