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

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

Introduction

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

Prototype

public void setFocus(boolean focused) 

Source Link

Usage

From source file:edu.caltech.ipac.firefly.ui.Form.java

public void setFocus(final String id) {
    DeferredCommand.addCommand(new Command() {
        public void execute() {
            InputField f = getField(id);
            if (f != null) {
                FocusWidget fw = f.getFocusWidget();
                if (fw != null) {
                    fw.setFocus(true);
                }/*w  ww.j  a  v  a2  s.c  o  m*/
            }
        }
    });
}

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

License:Open Source License

/**
 * Sets focus on the first focusable child if such exists.
 *
 * @return <code>true</code> if the focus was set
 *///from   w  ww . ja va 2 s.c  o  m
private boolean setFocusOnChildOf(Widget widget) {
    List<FocusWidget> focusableChildren = UIUtil.getFocusableChildren(widget);
    for (FocusWidget focusableWidget : focusableChildren) {
        if (focusableWidget.isVisible()) {
            focusableWidget.setFocus(true);
            return true;
        }
    }
    return false;
}