private boolean focus(int row, int col) { if (!getRowFormatter().isVisible(row) || col >= getCellCount(row)) return false; Widget w = super.getWidget(row, col); if (w == null || !w.isVisible()) return false; if (w instanceof SmartTableCell) { return ((SmartTableCell)w).focus(); } else if (w instanceof HasFocus) { return ((HasFocus)w).focus(); } else if (w instanceof Focusable) { ((Focusable)w).setFocus(true); if (w instanceof TextBoxBase) ((TextBoxBase)w).selectAll(); return true; } return false; }
@Override public void activateWidget(WidgetToShow widgetToActivate) { final Tab tab = widgets2Tabs.get(widgetToActivate); if (tab != null) { selectTab(tab); } IsWidget widget = widgetToActivate.getWidget(); widgetsPanel.showWidget(widget.asWidget()); if (widget instanceof Focusable) { ((Focusable) widget).setFocus(true); } // add 'active' attribute for active widget for testing purpose for (WidgetToShow widgetToShow : widgets2Tabs.keySet()) { widgetToShow.getWidget().asWidget().getElement().removeAttribute("active"); } widget.asWidget().getElement().setAttribute("active", ""); }
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; } } } }
protected boolean setFocus(final HasWidgets container, Boolean found) { for (final Widget w : container) { if (w instanceof CloseButton) { 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; }
public void setEditor(Widget aEditor) { editor = aEditor; if (editor == null || ((editor instanceof HasValue<?>) && (editor instanceof HasText))) { valueHost = (HasValue<C>) editor; } else { throw new IllegalArgumentException("Editor must implement interfaces HasValue<?> and HasText"); } if (editor instanceof Focusable) { focusHost = (Focusable) editor; focusHost.setTabIndex(1); } if (editor != null){ CommonResources.INSTANCE.commons().ensureInjected(); editor.getElement().addClassName(CommonResources.INSTANCE.commons().borderSized()); } }
public AutoSizingBase(T box, S shadow) { this.box = box; this.shadow = shadow; box.addKeyDownHandler(this); box.addKeyUpHandler(this); box.addValueChangeHandler(this); div.setStyleName("gwt-traction-input-autosize"); shadow.setStyleName("gwt-traction-input-shadow"); // make sure the shadow isn't in the tab order if (shadow instanceof Focusable) { // we can't use -1 because FocusWidget.onAttach looks for // that and sets it to 0. any negative value will remove // it from the tab order. ((Focusable) shadow).setTabIndex(-2); } // note this has to be in a FlowPanel to work div.add(box); div.add(shadow); initWidget(div); }
public void setEditor( T editor, boolean fShowCancel ) { m_table.clear(); m_editor = editor; if( m_editor != null ) { m_table.setWidget( 0, 0, m_editor ); if( m_editor instanceof HasKeyUpHandlers ) ((HasKeyUpHandlers) m_editor).addKeyUpHandler( this ); if( m_editor instanceof Focusable ) ((Focusable) m_editor).setFocus( true ); } m_table.setWidget( 0, 1, m_okBut ); if( fShowCancel ) m_table.setWidget( 0, 2, m_cancelBut ); }
public boolean focus() { Widget w = getWidget(); if (w instanceof UniTimeWidget<?>) w = ((UniTimeWidget<?>)w).getWidget(); if (w instanceof Focusable) { ((Focusable)w).setFocus(true); if (w instanceof TextBox) ((TextBox)w).selectAll(); return true; } return false; }
public boolean focus() { if (getWidget() instanceof HasFocus) { return ((HasFocus)getWidget()).focus(); } else if (getWidget() instanceof Focusable) { ((Focusable)getWidget()).setFocus(true); if (getWidget() instanceof TextBoxBase) ((TextBoxBase)getWidget()).selectAll(); return true; } return false; }
private static void requestFocus(final Focusable widget) { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { widget.setFocus(true); } }); }
private void setFocus( final Widget w ){ if( w instanceof Focusable ) { Scheduler.get().scheduleDeferred( new ScheduledCommand(){ public void execute(){ ((Focusable) w).setFocus(true); } }); } else { Window.alert("Trying to set focus to an unfocusable Widget!"); } }
/** * Displays the {@link Window} popup. The popup will animate into view. * * @param selectAndFocusElement an {@link Focusable} to select and focus on when the panel is * shown. If null, no element will be given focus */ public void show(@Nullable final Focusable selectAndFocusElement) { setBlocked(false); if (isShowing) { setFocusOn( selectAndFocusElement); // the window is displayed but focus for the element may be lost return; } isShowing = true; // Attach the popup to the body. final JsElement popup = view.popup.getElement().cast(); if (popup.getParentElement() == null) { // Hide the popup so it can enter its initial state without flickering. popup.getStyle().setVisibility("hidden"); RootLayoutPanel.get().add(view); } // The popup may have been hidden before this timer executes. if (isShowing) { popup.getStyle().removeProperty("visibility"); // Start the animation after the element is attached. Scheduler.get() .scheduleDeferred( new ScheduledCommand() { @Override public void execute() { // The popup may have been hidden before this timer executes. view.setShowing(true); setFocusOn(selectAndFocusElement); } }); } }
@Override public int getTabIndex() { if (decorated instanceof Focusable) { return ((Focusable) decorated).getTabIndex(); } else return -1; }
private void focus(FocusGVO focusGVO, UIObject sender, String appId, String windowId, String eventSessionId) { String componentId = focusGVO.getComponentId(); List<UIObject> uiObjects = getUIObjects(componentId, appId, windowId, eventSessionId); if (uiObjects == null) { return; } for (UIObject uiObject : uiObjects) { if (uiObject instanceof Widget) { makeParentVisible((Widget) uiObject); } if (uiObject instanceof Focusable) { ((Focusable) uiObject).setFocus(true); } } }
public void execute(BuiltInFunctionGVO builtInFunction) { if (builtInFunction instanceof FocusGVO) { FocusGVO focus = (FocusGVO) builtInFunction; BuiltInComponentGVO builtInComponentGVO = focus.getBuiltInComponentGVO(); String component = builtInComponentGVO.getComponentIdUUID(); List<UIObject> uiObjects = null; if (component != null) { uiObjects = getUIObjects(component, focus); } else { uiObjects = RendererHelper.getNamedComponent(builtInComponentGVO.getComponentName()); } if (uiObjects != null) { for (UIObject uiObject : uiObjects) { if (uiObject instanceof Widget) { Widget w = (Widget) uiObject; makeParentsVisible(w); // TO BE REMOVED // if (w.getParent() != null) { // Widget parent = w.getParent(); // makeParentsVisible(parent); // } } if (uiObject instanceof Focusable) { ((Focusable) uiObject).setFocus(true); } } } } FunctionsExecutor.setProcessedBuiltIn(true); }
@Override public final int getTabIndex() { if (this.contents.getWidget() instanceof Focusable) { return ((Focusable) this.contents.getWidget()).getTabIndex(); } return 0; }
public GenericEditor( final T widget, boolean fShowCancel, boolean fShowValidator ) { this.widget = widget; if( fShowValidator ) { validator = new Validator<>(); validator.setEditor( widget, fShowCancel ); validator.setCallback( validatorCallback ); } else { validator = null; } if( widget instanceof Focusable ) { widget.addAttachHandler( new AttachEvent.Handler() { @Override public void onAttachOrDetach( AttachEvent event ) { ((Focusable)widget).setFocus( true ); } } ); } }
private void resetFocusHandler() { this.registrationCollection.removeHandler(); boolean hasError = this.hasErrors(); if (!hasError && !this.focused) { this.setTabIndex(0); this.registrationCollection.add(this.addFocusHandler(this)); } else if (hasError && !this.focused) { this.setTabIndex(-1); if (this.input instanceof HasFocusHandlers) { this.registrationCollection.add(((HasFocusHandlers) this.input).addFocusHandler(this)); } } else { this.setTabIndex(-1); if (this.input instanceof HasBlurHandlers) { this.registrationCollection.add(((HasBlurHandlers) this.input).addBlurHandler(this)); } Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { if (InternalListItem.this.input instanceof Focusable) { ((Focusable) InternalListItem.this.input).setFocus(true); } } }); } }
@Override public void setFocus(boolean focused) { if (editor instanceof Focusable) { Focusable focusable = (Focusable) editor; focusable.setFocus(focused); } }
private void initFocusableEditor() { if (editor instanceof Focusable) { Focusable focusable = (Focusable) editor; if (accessKey != null) { focusable.setAccessKey(accessKey); } if (tabIndex != null) { focusable.setTabIndex(tabIndex); } } }
public static void openPopupPanel(PopupPanel panel, Focusable focusable, boolean animate, boolean modal) { panel.setGlassEnabled(true); panel.setAnimationEnabled(animate); panel.center(); if (focusable != null) { focusable.setFocus(true); } panel.setModal(modal); }
@Override protected void onChangeInput() { super.onChangeInput(); if (button != null) { button.addStyleName("changed"); if (button instanceof Focusable) { ((Focusable)button).setFocus(true); } } }
public CaptureFocusHandler(Focusable f) { focusable = f; }
/** * Sets focus on the given element. If {@code elementToFocus} is {@code null}, no element will be * given focus */ private void setFocusOn(@Nullable Focusable elementToFocus) { if (elementToFocus != null) { elementToFocus.setFocus(true); } }
protected Focusable getAutofocusField () { return plan.get(currentPage).getAutoFocusField(); }
@Override public Focusable getAutoFocusField() { return null; }
@Override public Focusable getAutoFocusField () { return null; }
@Override public Focusable getAutoFocusField () { return txtTitle; }
@Override public Focusable getAutoFocusField () { return txtPost; }
@Override public Focusable getAutoFocusField () { return txtUsername; }
@UiHandler({ "txtTitle", "txtSummary", "txtContent", "txtTags" }) void onClick (ClickEvent e) { deferUpdate(); this.current = (Focusable) e.getSource(); }
public static void focus(Widget aWidget) { if (aWidget instanceof Focusable) { ((Focusable) aWidget).setFocus(true); } }
@Override public void setFocus(boolean focused) { if (decorated instanceof Focusable) { ((Focusable) decorated).setFocus(focused); } }
@Override public void setAccessKey(char key) { if (decorated instanceof Focusable) { ((Focusable) decorated).setAccessKey(key); } }
@Override public void setTabIndex(int index) { if (decorated instanceof Focusable) { ((Focusable) decorated).setTabIndex(index); } }
public int getTabIndex() { if (content instanceof Focusable){ return ((Focusable)content).getTabIndex(); } return -1; }