Search in sources :

Example 1 with Focusable

use of com.google.gwt.user.client.ui.Focusable in project rstudio by rstudio.

the class FocusTransitionManager method register.

private void register(final Widget widget) {
    if (registration_.contains(widget))
        return;
    registration_.add(widget);
    widget.addDomHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
                boolean forward = !event.isShiftKeyDown();
                Widget target = get(widget, forward);
                if (target == null)
                    return;
                if (target instanceof CanFocus) {
                    event.stopPropagation();
                    event.preventDefault();
                    focus((CanFocus) target);
                } else if (target instanceof Focusable) {
                    event.stopPropagation();
                    event.preventDefault();
                    focus((Focusable) target);
                }
            }
        }
    }, KeyDownEvent.getType());
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) CanFocus(org.rstudio.core.client.widget.CanFocus) Widget(com.google.gwt.user.client.ui.Widget) Focusable(com.google.gwt.user.client.ui.Focusable)

Example 2 with Focusable

use of com.google.gwt.user.client.ui.Focusable in project blogwt by billy1380.

the class PropertiesPage method ready.

private void ready() {
    btnUpdate.getElement().setInnerSafeHtml(WizardDialog.WizardDialogTemplates.INSTANCE.nextButton("Update"));
    // enable properties
    btnUpdate.setEnabled(true);
    if (propertyWidgets != null) {
        for (Widget widget : propertyWidgets) {
            if (widget instanceof Focusable) {
                ((Focusable) widget).setFocus(true);
                break;
            }
        }
    }
}
Also used : Widget(com.google.gwt.user.client.ui.Widget) Focusable(com.google.gwt.user.client.ui.Focusable)

Example 3 with Focusable

use of com.google.gwt.user.client.ui.Focusable in project che by eclipse.

the class ProcessesPanelViewImpl method focusGained.

@Override
public void focusGained(SubPanel subPanel, IsWidget widget) {
    focusedSubPanel = subPanel;
    final ProcessTreeNode processTreeNode = widget2TreeNodes.get(widget);
    if (processTreeNode != null) {
        selectNode(processTreeNode);
    }
    if (lastFosuced != null && !lastFosuced.equals(widget)) {
        lastFosuced.setFocus(false);
    }
    if (widget instanceof Focusable) {
        ((Focusable) widget).setFocus(true);
        lastFosuced = (Focusable) widget;
    }
}
Also used : Focusable(com.google.gwt.user.client.ui.Focusable) ProcessTreeNode(org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode)

Aggregations

Focusable (com.google.gwt.user.client.ui.Focusable)3 Widget (com.google.gwt.user.client.ui.Widget)2 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)1 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)1 ProcessTreeNode (org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode)1 CanFocus (org.rstudio.core.client.widget.CanFocus)1