Search in sources :

Example 6 with NativeMap

use of com.google.gerrit.client.rpc.NativeMap 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

NativeMap (com.google.gerrit.client.rpc.NativeMap)6 CommentInfo (com.google.gerrit.client.changes.CommentInfo)2 CallbackGroup (com.google.gerrit.client.rpc.CallbackGroup)2 NotFoundScreen (com.google.gerrit.client.NotFoundScreen)1 CapabilityInfo (com.google.gerrit.client.config.CapabilityInfo)1 ActionInfo (com.google.gerrit.client.info.ActionInfo)1 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)1 GpgKeyInfo (com.google.gerrit.client.info.GpgKeyInfo)1 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)1 RestApi (com.google.gerrit.client.rpc.RestApi)1 ScreenLoadCallback (com.google.gerrit.client.rpc.ScreenLoadCallback)1 HighlightSuggestion (com.google.gerrit.client.ui.HighlightSuggestion)1 ProjectAccess (com.google.gerrit.common.data.ProjectAccess)1 RestApi (com.google.gerrit.plugin.client.rpc.RestApi)1 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 JsArray (com.google.gwt.core.client.JsArray)1 JsArrayString (com.google.gwt.core.client.JsArrayString)1 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)1 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1