java类com.google.gwt.event.dom.client.HasFocusHandlers的实例源码

EventsExecutor.java 文件源码 项目:platypus-js 阅读 24 收藏 0 点赞 0 评论 0
public void setFocusGained(JavaScriptObject aValue) {
    if (focusGained != aValue) {
        if (focusReg != null) {
            focusReg.removeHandler();
            focusReg = null;
        }
        focusGained = aValue;
        if (focusGained != null && component instanceof HasFocusHandlers) {
            focusReg = ((HasFocusHandlers) component).addFocusHandler(new FocusHandler() {
                @Override
                public void onFocus(FocusEvent event) {
                    if (focusGained != null) {
                        executeEvent(focusGained, EventsPublisher.publish(event));
                    }
                }
            });
        }
    }
}
AbstractDecoratorWithLabel.java 文件源码 项目:gwt-bean-validators 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Set the widget that the EditorPanel will display. This method will automatically call
 * {@link #setEditor}.
 *
 * @param pwidget a {@link IsEditor} widget
 */
@Override
@UiChild(limit = 1, tagname = "widget")
public void setChildWidget(final TakesValue<T> pwidget) {
  this.widget = (Widget) pwidget;
  this.contents.add(this.widget);
  this.setEditor(new ExtendedValueBoxEditor<>(pwidget, this));
  if (pwidget instanceof HasFocusHandlers) {
    ((HasFocusHandlers) pwidget)
        .addFocusHandler(pevent -> AbstractDecoratorWithLabel.this.addStyleToLabel());
  }
  if (pwidget instanceof HasBlurHandlers) {
    ((HasBlurHandlers) pwidget).addBlurHandler(pevent -> {
      boolean hide = true;
      if (AbstractDecoratorWithLabel.this.widget instanceof TakesValue<?>) {
        hide = StringUtils.isEmpty(Objects
            .toString(((TakesValue<?>) AbstractDecoratorWithLabel.this.widget).getValue(), null));
      }
      if (hide) {
        AbstractDecoratorWithLabel.this.removeStyleFromLabel();
      }
    });
  }
}
FilterBox.java 文件源码 项目:unitimes 阅读 20 收藏 0 点赞 0 评论 0
private void fixHandlers(final FilterBox box, Widget w) {
    if (w instanceof HasBlurHandlers)
        ((HasBlurHandlers)w).addBlurHandler(box.iBlurHandler);
    if (w instanceof HasFocusHandlers)
        ((HasFocusHandlers)w).addFocusHandler(box.iFocusHandler);
    if (w instanceof HasKeyDownHandlers)
        ((HasKeyDownHandlers)w).addKeyDownHandler(new KeyDownHandler() {
            @Override
            public void onKeyDown(KeyDownEvent event) {
                if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE)
                    if (box.isFilterPopupShowing()) box.hideFilterPopup();
            }
        });
}
GWTWidgets.java 文件源码 项目:r01fb 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Sets the focus() event handler in many widgets
 * @param handler the handler
 * @param widgets the widgets
 */
public static void addFocusHandler(final FocusHandler handler,final HasFocusHandlers... widgets) {
    if (handler != null && widgets != null && widgets.length > 0) {
        for (HasFocusHandlers w : widgets) {
            if (w != null) w.addFocusHandler(handler);
        }
    }
}
FilterBox.java 文件源码 项目:unitime 阅读 23 收藏 0 点赞 0 评论 0
private void fixHandlers(final FilterBox box, Widget w) {
    if (w instanceof HasBlurHandlers)
        ((HasBlurHandlers)w).addBlurHandler(box.iBlurHandler);
    if (w instanceof HasFocusHandlers)
        ((HasFocusHandlers)w).addFocusHandler(box.iFocusHandler);
    if (w instanceof HasKeyDownHandlers)
        ((HasKeyDownHandlers)w).addKeyDownHandler(new KeyDownHandler() {
            @Override
            public void onKeyDown(KeyDownEvent event) {
                if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE)
                    if (box.isFilterPopupShowing()) box.hideFilterPopup();
            }
        });
}
InputList.java 文件源码 项目:putnami-web-toolkit 阅读 26 收藏 0 点赞 0 评论 0
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);
                }
            }
        });
    }
}
CompositeFocusHelper.java 文件源码 项目:putnami-web-toolkit 阅读 18 收藏 0 点赞 0 评论 0
private CompositeFocusHelper(Widget containerWidget, HasFocusHandlers... hasFocusContents) {
    this.containerWidget = containerWidget;
    containerWidget.addDomHandler(this.keyDownHandler, KeyDownEvent.getType());
    if (hasFocusContents != null) {
        for (HasFocusHandlers hasFocus : hasFocusContents) {
            this.addHasFocusContent(hasFocus);
        }
    }

    this.handlerManager = new HandlerManager(containerWidget);
}
CompositeFocusHelper.java 文件源码 项目:putnami-web-toolkit 阅读 21 收藏 0 点赞 0 评论 0
public void addHasFocusContent(HasFocusHandlers hasFocusContent) {
    if (this.hasFocusContents.add(hasFocusContent)) {
        hasFocusContent.addFocusHandler(this.focusHandler);
    }
}
CompositeFocusHelper.java 文件源码 项目:putnami-web-toolkit 阅读 24 收藏 0 点赞 0 评论 0
public static CompositeFocusHelper createFocusHelper(IsWidget containerWidget, HasFocusHandlers... focusContents) {
    assert containerWidget != null : "containerWidget cannot be null";
    assert containerWidget.asWidget() != null : "containerWidget.asWidget() cannot be null";
    return new CompositeFocusHelper(containerWidget.asWidget(), focusContents);
}


问题


面经


文章

微信
公众号

扫码关注公众号