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

项目:gwtbootstrap3    文件:AbstractForm.java   
/**
 * Get this forms child input elements with validators.
 *
 * @param widget the widget
 * @return the children with validators
 */
protected List<HasValidators<?>> getChildrenWithValidators(Widget widget) {
    List<HasValidators<?>> result = new ArrayList<HasValidators<?>>();
    if (widget != null) {
        if (widget instanceof HasValidators<?>) {
            result.add((HasValidators<?>) widget);
        }
        if (widget instanceof HasOneWidget) {
            result.addAll(getChildrenWithValidators(((HasOneWidget) widget).getWidget()));
        }
        if (widget instanceof HasWidgets) {
            for (Widget child : (HasWidgets) widget) {
                result.addAll(getChildrenWithValidators(child));
            }
        }
    }
    return result;
}
项目:gwtbootstrap3    文件:RadioGroupBase.java   
/**
 * Gets the radio children.
 *
 * @param widget the widget
 * @param c the current children
 * @return the radio children
 */
protected Set<Radio> getRadioChildren(final Widget widget, final Set<Radio> c) {
    Set<Radio> children = c;
    if (children == null) {
        children = new HashSet<Radio>();
    }
    if (widget instanceof Radio) {
        children.add((Radio) widget);
    } else if (widget instanceof HasOneWidget) {
        children = getRadioChildren(((HasOneWidget) widget).getWidget(), children);
    } else if (widget instanceof HasWidgets) {
        for (Widget w : (HasWidgets) widget) {
            if (w instanceof Radio) {
                children.add((Radio) w);
            } else {
                children = getRadioChildren(w, children);
            }
        }
    }
    return children;
}