/** * This method is called straight after an entry is added by pressing the plus button. Note that * this new entry will necessarily be a "ghost" entry, as the plus button always adds entries that * are initially in ghost state. Override to specify implementation-specific behavior. * * @param value the value added. * @param widget the widget added. */ protected void onAdd(T value, V widget) { modelItems.add(value); if (widget instanceof Focusable) { ((Focusable) widget).setFocus(true); } }
/* (non-Javadoc) * @see gwtupload.client.Uploader#onChangeInput() */ @Override protected void onChangeInput() { super.onChangeInput(); if (button != null) { button.addStyleName("changed"); if (button instanceof Focusable) { ((Focusable) button).setFocus(true); } } }
@Override public void focusInput() { super.focusInput(); ListIterator<Pair<T, V>> last = items.listIterator(items.size()); if (last.hasPrevious()) { V widget = last.previous().getSecond(); if (widget instanceof Focusable) { ((Focusable) widget).setFocus(true); } } }
/** Try to sync all known active child widgets to server. */ public void syncChildren() { // Notify children with focus if ((popupComponentWidget instanceof Focusable)) { ((Focusable) popupComponentWidget).setFocus(false); } // Notify children that have used the keyboard for (Element e : activeChildren) { try { nativeBlur(e); } catch (Exception ignored) { } } activeChildren.clear(); }
// Set focus on first widget. Ideally we'd only scan the body of the Modal but this is // not accessible from sub-classes so we ignore some Focusable elements in the Header protected boolean setFocus(final HasWidgets container, Boolean found) { final Iterator<Widget> i = container.iterator(); while (i.hasNext()) { final Widget w = i.next(); if (w instanceof Close) { continue; } else if (w instanceof Focusable) { ((Focusable) w).setFocus(true); found = true; } else if (w instanceof HasWidgets) { found = setFocus(((HasWidgets) w), found); } if (Boolean.TRUE.equals(found)) { break; } } return found; }