use of com.google.gwt.event.dom.client.FocusEvent in project gerrit by GerritCodeReview.
the class OnEditEnabler method listenTo.
// Register input widgets to be listened to
public void listenTo(final TextBoxBase tb) {
strings.put(tb, tb.getText().trim());
tb.addKeyPressHandler(this);
// Is there another way to capture middle button X11 pastes in browsers
// which do not yet support ONPASTE events (Firefox)?
tb.addMouseUpHandler(this);
// Resetting the "original text" on focus ensures that we are
// up to date with non-user updates of the text (calls to
// setText()...) and also up to date with user changes which
// occurred after enabling "widget".
tb.addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
strings.put(tb, tb.getText().trim());
}
});
// CTRL-V Pastes in Chrome seem only detectable via BrowserEvents or
// KeyDownEvents, the latter is better.
tb.addKeyDownHandler(this);
}
use of com.google.gwt.event.dom.client.FocusEvent in project che by eclipse.
the class TextEditorPartViewImpl method setEditorWidget.
@Override
public void setEditorWidget(final EditorWidget editorWidget) {
if (this.editorPanel.getWidget() != null) {
throw new RuntimeException("Editor already set");
}
this.editorPanel.setWidget(editorWidget);
editorWidget.addCursorActivityHandler(new CursorActivityHandler() {
@Override
public void onCursorActivity(final CursorActivityEvent event) {
delegate.editorCursorPositionChanged();
}
});
editorWidget.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(final BlurEvent event) {
delegate.editorLostFocus();
}
});
editorWidget.addFocusHandler(new FocusHandler() {
@Override
public void onFocus(final FocusEvent event) {
delegate.editorGotFocus();
}
});
}
use of com.google.gwt.event.dom.client.FocusEvent in project rstudio by rstudio.
the class Satellite method initialize.
public void initialize(String name, CommandWithArg<JavaScriptObject> onReactivated) {
onReactivated_ = onReactivated;
initializeNative(name);
// to notifyRStudioSatelliteClosing
if (!Desktop.isDesktop()) {
Window.addWindowClosingHandler(new ClosingHandler() {
@Override
public void onWindowClosing(ClosingEvent event) {
fireCloseEvent();
}
});
}
// let main window know when we get focus
WindowEx.addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent arg0) {
events_.fireEvent(new SatelliteFocusedEvent(getSatelliteName()));
}
});
}
use of com.google.gwt.event.dom.client.FocusEvent in project gerrit by GerritCodeReview.
the class ShowHelpCommand method onKeyPress.
@Override
public void onKeyPress(final KeyPressEvent event) {
if (current != null) {
// Already open? Close the dialog.
//
current.hide();
return;
}
final KeyHelpPopup help = new KeyHelpPopup();
help.addCloseHandler(new CloseHandler<PopupPanel>() {
@Override
public void onClose(final CloseEvent<PopupPanel> event) {
current = null;
BUS.fireEvent(new FocusEvent() {
});
}
});
current = help;
help.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(final int pWidth, final int pHeight) {
final int left = (Window.getClientWidth() - pWidth) >> 1;
final int wLeft = Window.getScrollLeft();
final int wTop = Window.getScrollTop();
help.setPopupPosition(wLeft + left, wTop + 50);
}
});
}
Aggregations