use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project gerrit by GerritCodeReview.
the class DraftBox method setEdit.
void setEdit(boolean edit) {
UIObject.setVisible(summary, false);
UIObject.setVisible(p_view, !edit);
UIObject.setVisible(p_edit, edit);
setRangeHighlight(edit);
if (edit) {
String msg = comment.message() != null ? comment.message() : "";
editArea.setValue(msg);
cancel.setVisible(!isNew());
expandText();
editAreaHeight = editArea.getOffsetHeight();
final int len = msg.length();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
editArea.setFocus(true);
if (len > 0) {
editArea.setCursorPos(len);
}
}
});
} else {
expandTimer.cancel();
resizeTimer.cancel();
}
getCommentManager().setUnsaved(this, edit);
getCommentGroup().resize();
}
use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project gerrit by GerritCodeReview.
the class DiffScreen method onGutterClick.
private GutterClickHandler onGutterClick(final CodeMirror cm) {
return new GutterClickHandler() {
@Override
public void handle(CodeMirror instance, final int line, final 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);
}
});
}
}
};
}
use of com.google.gwt.core.client.Scheduler.ScheduledCommand 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);
}
use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project opennms by OpenNMS.
the class SearchStateManager method handleAutocompleteEvent.
public boolean handleAutocompleteEvent(final NativeEvent event) {
final String eventType = event.getType();
final int eventKeyCode = event.getKeyCode();
LOG.info("handleAutocompleteEvent(" + m_state + "): received " + eventType + " (keyCode = " + eventKeyCode + ")");
if ("keydown".equals(eventType)) {
switch(eventKeyCode) {
case KeyCodes.KEY_ESCAPE:
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
m_state = m_state.cancelSearching(SearchStateManager.this);
}
});
event.stopPropagation();
break;
case KeyCodes.KEY_ENTER:
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
m_state = m_state.currentEntrySelected(SearchStateManager.this);
}
});
event.stopPropagation();
break;
}
} else if ("click".equals(eventType) || "touchstart".equals(eventType)) {
// someone clicked on an entry
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
m_state = m_state.currentEntrySelected(SearchStateManager.this);
}
});
event.stopPropagation();
return true;
} else {
LOG.info("handleAutocompleteEvent(" + m_state + "): unhandled event: " + eventType);
return true;
}
return false;
}
use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project opennms by OpenNMS.
the class SearchStateManager method handleSearchIconEvent.
public void handleSearchIconEvent(final NativeEvent event) {
final String eventType = event.getType();
LOG.info("handleSearchIconEvent(" + m_state + "): received " + eventType + " (keyCode = " + event.getKeyCode() + ")");
if ("click".equals(eventType) || "touchstart".equals(eventType)) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
m_state = m_state.finishedSearching(SearchStateManager.this);
}
});
} else {
LOG.info("handleSearchIconEvent(" + m_state + "): unhandled event: " + eventType);
}
}
Aggregations