Search in sources :

Example 1 with FocusEvent

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);
}
Also used : FocusHandler(com.google.gwt.event.dom.client.FocusHandler) FocusEvent(com.google.gwt.event.dom.client.FocusEvent)

Example 2 with FocusEvent

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();
        }
    });
}
Also used : CursorActivityEvent(org.eclipse.che.ide.api.editor.events.CursorActivityEvent) BlurHandler(com.google.gwt.event.dom.client.BlurHandler) FocusHandler(com.google.gwt.event.dom.client.FocusHandler) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) CursorActivityHandler(org.eclipse.che.ide.api.editor.events.CursorActivityHandler) FocusEvent(com.google.gwt.event.dom.client.FocusEvent)

Example 3 with FocusEvent

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()));
        }
    });
}
Also used : SatelliteFocusedEvent(org.rstudio.studio.client.common.satellite.events.SatelliteFocusedEvent) FocusHandler(com.google.gwt.event.dom.client.FocusHandler) ClosingEvent(com.google.gwt.user.client.Window.ClosingEvent) ClosingHandler(com.google.gwt.user.client.Window.ClosingHandler) FocusEvent(com.google.gwt.event.dom.client.FocusEvent)

Example 4 with FocusEvent

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);
        }
    });
}
Also used : PositionCallback(com.google.gwt.user.client.ui.PopupPanel.PositionCallback) PopupPanel(com.google.gwt.user.client.ui.PopupPanel) FocusEvent(com.google.gwt.event.dom.client.FocusEvent)

Aggregations

FocusEvent (com.google.gwt.event.dom.client.FocusEvent)4 FocusHandler (com.google.gwt.event.dom.client.FocusHandler)3 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)1 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)1 ClosingEvent (com.google.gwt.user.client.Window.ClosingEvent)1 ClosingHandler (com.google.gwt.user.client.Window.ClosingHandler)1 PopupPanel (com.google.gwt.user.client.ui.PopupPanel)1 PositionCallback (com.google.gwt.user.client.ui.PopupPanel.PositionCallback)1 CursorActivityEvent (org.eclipse.che.ide.api.editor.events.CursorActivityEvent)1 CursorActivityHandler (org.eclipse.che.ide.api.editor.events.CursorActivityHandler)1 SatelliteFocusedEvent (org.rstudio.studio.client.common.satellite.events.SatelliteFocusedEvent)1