Example usage for com.google.gwt.user.client.ui FocusWidget addBlurHandler

List of usage examples for com.google.gwt.user.client.ui FocusWidget addBlurHandler

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui FocusWidget addBlurHandler.

Prototype

public HandlerRegistration addBlurHandler(BlurHandler handler) 

Source Link

Usage

From source file:org.eclipse.che.ide.api.parts.base.BaseView.java

License:Open Source License

/**
 * Sets content widget.//from   www .j  a  va  2s  .  c o  m
 *
 * @param widget
 *         content widget
 */
public final void setContentWidget(Widget widget) {
    container.add(widget);
    for (FocusWidget focusWidget : UIUtil.getFocusableChildren(widget)) {
        focusWidget.addBlurHandler(blurHandler);
    }

    focusView();
}

From source file:org.eclipse.che.ide.ui.WidgetFocusTracker.java

License:Open Source License

/**
 * Add widget to track the focus//www  .  ja v  a2s.c  o  m
 *
 * @param widget
 *         the widget to track
 */
public void subscribe(final FocusWidget widget) {
    if (focusStates == null) {
        focusStates = new HashMap<>();
    }

    focusStates.put(widget, false);
    widget.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            focusStates.put(widget, true);
        }
    });

    widget.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            focusStates.put(widget, false);
        }
    });
}

From source file:org.eclipse.che.ide.ui.window.View.java

License:Open Source License

/**
 * Updates the View to reflect the showing state of the popup.
 *
 * @param showing/* ww w.j  a  v  a 2  s .co m*/
 *         true if showing, false if not.
 */
protected void setShowing(boolean showing) {
    //set for each focusable widget blur handler to have ability to store last focused element
    for (FocusWidget focusWidget : UIUtil.getFocusableChildren(content)) {
        focusWidget.addBlurHandler(blurHandler);
    }

    if (showing) {
        contentContainer.addStyleName(css.contentVisible());
    } else {
        contentContainer.removeStyleName(css.contentVisible());
    }
}