Search in sources :

Example 21 with RepeatingCommand

use of com.google.gwt.core.client.Scheduler.RepeatingCommand in project gerrit by GerritCodeReview.

the class ReplyBox method onLoad.

@Override
protected void onLoad() {
    commentsPanel.setVisible(false);
    post.setEnabled(false);
    if (lc.hasReplyComment()) {
        message.setText(lc.getReplyComment());
        lc.removeReplyComment();
    }
    ChangeApi.drafts(psId.getParentKey().get()).get(new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {

        @Override
        public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
            displayComments(result);
            post.setEnabled(true);
        }

        @Override
        public void onFailure(Throwable caught) {
            post.setEnabled(true);
        }
    });
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            message.setFocus(true);
        }
    });
    Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

        @Override
        public boolean execute() {
            String t = message.getText();
            if (t != null) {
                message.setCursorPos(t.length());
            }
            return false;
        }
    }, 0);
}
Also used : JsArray(com.google.gwt.core.client.JsArray) ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) RepeatingCommand(com.google.gwt.core.client.Scheduler.RepeatingCommand) CommentInfo(com.google.gerrit.client.changes.CommentInfo) JsArrayString(com.google.gwt.core.client.JsArrayString) NativeMap(com.google.gerrit.client.rpc.NativeMap)

Aggregations

RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)21 JsArrayString (com.google.gwt.core.client.JsArrayString)3 Element (com.google.gwt.dom.client.Element)3 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Coordinates (org.opennms.features.vaadin.nodemaps.internal.gwt.client.Coordinates)2 JSNodeMarker (org.opennms.features.vaadin.nodemaps.internal.gwt.client.JSNodeMarker)2 Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)2 ServerError (org.rstudio.studio.client.server.ServerError)2 ServerRequestCallback (org.rstudio.studio.client.server.ServerRequestCallback)2 Position (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position)2 CommentInfo (com.google.gerrit.client.changes.CommentInfo)1 NativeMap (com.google.gerrit.client.rpc.NativeMap)1 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 JsArray (com.google.gwt.core.client.JsArray)1 DivElement (com.google.gwt.dom.client.DivElement)1 Document (com.google.gwt.dom.client.Document)1