Java Code Examples for javax.faces.component.UIComponent#getFacetCount()

The following examples show how to use javax.faces.component.UIComponent#getFacetCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractDataView.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")//$NON-NLS-1$
@Override
protected void restoreValueHolderState(FacesContext context,
        UIComponent component) {
    super.restoreValueHolderState(context, component);

    // start workaround for MKEE89RPXF
    if (ExtLibUtil.isXPages852()) {
        if (component.getFacetCount() > 0) {
            Map<String, UIComponent> facets;
            if (disableGetFacets && component == this) {
                facets = super.getFacets();
            }
            else {
                facets = TypedUtil.getFacets(component);
            }
            for (UIComponent c : facets.values()) {
                if (c != null) {
                    restoreValueHolderState(context, c);
                }
            }
        }
    }
    // end workaround for MKEE89RPXF
}
 
Example 2
Source File: AbstractDataView.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")//$NON-NLS-1$
@Override
protected void saveValueHolderState(FacesContext context,
        UIComponent component) {
    super.saveValueHolderState(context, component);

    // start workaround for MKEE89RPXF
    if (ExtLibUtil.isXPages852()) {
        if (component.getFacetCount() > 0) {
            Map<String, UIComponent> facets;
            if (disableGetFacets && component == this) {
                facets = super.getFacets();
            }
            else {
                facets = TypedUtil.getFacets(component);
            }
            for (UIComponent c : facets.values()) {
                if (c != null) {
                    saveValueHolderState(context, c);
                }
            }
        }
    }
    // end workaround for MKEE89RPXF
}
 
Example 3
Source File: UIDojoExtListTextBox.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
static private AbstractPicker _findPickerFor(UIComponent parent, String id) {
    if(parent.getChildCount()>0 || parent.getFacetCount() > 0) {
        for (Iterator<UIComponent> i = TypedUtil.getFacetsAndChildren(parent); i.hasNext();) {
            UIComponent next = i.next();
            // Look if this child is the label
            if(next instanceof AbstractPicker) {
                AbstractPicker lbl = (AbstractPicker)next;
                String _for = lbl.getFor();
                if(StringUtil.equals(_for, id)) {
                    return lbl;
                }
            }
            if (!(next instanceof NamingContainer)) {
                AbstractPicker n = _findPickerFor(next, id);
                if (n != null) {
                    return n;
                }
            }
        }
    }
    return null;
}
 
Example 4
Source File: DynamicUIUtil.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
/**
 * Remove all the children from a component.
 * @param component the parent component
 * @param facets indicates if the facets should be removed as well
 */
public static void removeChildren(UIComponent component, boolean facets) {
    if(component.getChildCount()>0) {
        TypedUtil.getChildren(component).clear();
    }
    if(component.getFacetCount()>0) {
        TypedUtil.getFacets(component).clear();
    }
}
 
Example 5
Source File: Node.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
public Node(UIComponent c) {
	validate(c);
	
	_id = c.getId();
	_className = c.getClass().getName();
	
	List<UIComponent> children = TypedUtil.getChildren(c);
	for(int i=0; i<children.size(); i++) {
		UIComponent child = children.get(i);
		if(child.isTransient()) {
			continue;
		}
		Node kid = new Node(child);
		_kids.add(kid);
	}
	if( c.getFacetCount() > 0 ){
	Map<String, UIComponent> map = TypedUtil.getFacets(c);
	for (Map.Entry<String, UIComponent> pair : map.entrySet()) {
		String name = pair.getKey();
		UIComponent facet = pair.getValue();
		if(facet.isTransient()) {
			continue;
		}
		Node node = new Node(facet);
		_facets.put(name, node);
	}
	}
}