Java 类com.google.gwt.user.client.ui.Focusable 实例源码

项目:unitimes    文件:UniTimeTable.java   
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;
}
项目:che    文件:SubPanelViewImpl.java   
@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", "");
}
项目:unitime    文件:UniTimeTable.java   
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;
}
项目:blogwt    文件:PropertiesPage.java   
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;
            }
        }
    }
}
项目:appformer    文件:BaseModal.java   
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;
}
项目:platypus-js    文件:WidgetEditorCell.java   
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());
    }
}
项目:gwt-traction    文件:AutoSizingBase.java   
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);    
   }
项目:hexa.tools    文件:Validator.java   
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 );
}
项目:unitimes    文件:SimpleEditPage.java   
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;
}
项目:unitimes    文件:UniTimeTable.java   
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;
}
项目:Wiab.pro    文件:DialogBox.java   
private static void requestFocus(final Focusable widget) {
  Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {

    @Override
    public void execute() {
      widget.setFocus(true);
    }
  });
}
项目:x-cure-chat    文件:ActionGridDialog.java   
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!");
    }
}
项目:che    文件:Window.java   
/**
 * 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);
              }
            });
  }
}
项目:unitime    文件:SimpleEditPage.java   
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;
}
项目:unitime    文件:UniTimeTable.java   
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;
}
项目:platypus-js    文件:DecoratorBox.java   
@Override
public int getTabIndex() {
    if (decorated instanceof Focusable) {
        return ((Focusable) decorated).getTabIndex();
    } else
        return -1;
}
项目:qafe-platform    文件:FocusHandler.java   
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);
        }
    }
}
项目:qafe-platform    文件:FocusExecute.java   
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);

    }
项目:gwt-bean-validators    文件:AbstractDecorator.java   
@Override
public final int getTabIndex() {
  if (this.contents.getWidget() instanceof Focusable) {
    return ((Focusable) this.contents.getWidget()).getTabIndex();
  }
  return 0;
}
项目:hexa.tools    文件:GenericEditor.java   
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 );
            }
        } );
    }
}
项目:putnami-web-toolkit    文件:InputList.java   
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);
                }
            }
        });
    }
}
项目:putnami-web-toolkit    文件:FormGroup.java   
@Override
public void setFocus(boolean focused) {
    if (editor instanceof Focusable) {
        Focusable focusable = (Focusable) editor;
        focusable.setFocus(focused);
    }
}
项目:putnami-web-toolkit    文件:FormGroup.java   
private void initFocusableEditor() {
    if (editor instanceof Focusable) {
        Focusable focusable = (Focusable) editor;
        if (accessKey != null) {
            focusable.setAccessKey(accessKey);
        }
        if (tabIndex != null) {
            focusable.setTabIndex(tabIndex);
        }
    }
}
项目:gwtutil    文件:ClientUtils.java   
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);
}
项目:gwt-upload    文件:SingleUploader.java   
@Override
protected void onChangeInput() {
  super.onChangeInput();
  if (button != null) {
    button.addStyleName("changed");
    if (button instanceof Focusable) {
      ((Focusable)button).setFocus(true);
    }
  }
}
项目:gwt-chronoscope    文件:CaptureFocusHandler.java   
public CaptureFocusHandler(Focusable f) {
  focusable = f;
}
项目:che    文件:Window.java   
/**
 * 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);
  }
}
项目:blogwt    文件:WizardDialog.java   
protected Focusable getAutofocusField () {
    return plan.get(currentPage).getAutoFocusField();
}
项目:blogwt    文件:SeparatorWizardPage.java   
@Override
public Focusable getAutoFocusField() {
    return null;
}
项目:blogwt    文件:DeferredWizardPage.java   
@Override
public Focusable getAutoFocusField () {
    return null;
}
项目:blogwt    文件:EditPageWizardPage.java   
@Override
public Focusable getAutoFocusField () {
    return txtTitle;
}
项目:blogwt    文件:BlogPropertiesWizardPage.java   
@Override
public Focusable getAutoFocusField () {
    return txtTitle;
}
项目:blogwt    文件:SelectPostWizardPage.java   
@Override
public Focusable getAutoFocusField () {
    return txtPost;
}
项目:blogwt    文件:AddUserWizardPage.java   
@Override
public Focusable getAutoFocusField () {
    return txtUsername;
}
项目:blogwt    文件:EditPostPage.java   
@UiHandler({ "txtTitle", "txtSummary", "txtContent", "txtTags" })
void onClick (ClickEvent e) {
    deferUpdate();
    this.current = (Focusable) e.getSource();
}
项目:platypus-js    文件:WidgetsUtils.java   
public static void focus(Widget aWidget) {
    if (aWidget instanceof Focusable) {
        ((Focusable) aWidget).setFocus(true);
    }
}
项目:platypus-js    文件:DecoratorBox.java   
@Override
public void setFocus(boolean focused) {
    if (decorated instanceof Focusable) {
        ((Focusable) decorated).setFocus(focused);
    }
}
项目:platypus-js    文件:DecoratorBox.java   
@Override
public void setAccessKey(char key) {
    if (decorated instanceof Focusable) {
        ((Focusable) decorated).setAccessKey(key);
    }
}
项目:platypus-js    文件:DecoratorBox.java   
@Override
public void setTabIndex(int index) {
    if (decorated instanceof Focusable) {
        ((Focusable) decorated).setTabIndex(index);
    }
}
项目:qafe-platform    文件:LabeledTextAreaFieldWidget.java   
public int getTabIndex() {
    if (content instanceof Focusable){
        return ((Focusable)content).getTabIndex();
    }
    return -1;
}