public static void processValidatorsOfFacetsAndChilds(UIComponent component, FacesContext context) { if (component.getFacetCount() > 0) { for (UIComponent facet : component.getFacets().values()) { facet.processValidators(context); } } if (component.getChildCount() > 0) { for (int i = 0, childCount = component.getChildCount(); i < childCount; i++) { UIComponent child = component.getChildren().get(i); child.processValidators(context); } } }
protected void processColumnFacets(FacesContext context, PhaseId phaseId) { for (UIComponent child : getChildren()) { if (child.isRendered() && (child.getFacetCount() > 0)) { for (UIComponent facet : child.getFacets().values()) { process(context, facet, phaseId); } } } }
public DataTableFixedChildrenIterator(UIComponent dataTable) { super(); this.facetsIterator = dataTable.getFacets().values().iterator(); this.dataTableChildren = dataTable.getChildren().iterator(); }
public static void includeCompositeComponent(UIComponent parent, String libraryName, String resourceName, String id) { // Prepare. FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY); // This basically creates <ui:component> based on <composite:interface>. Resource resource = application.getResourceHandler().createResource(resourceName, libraryName); UIComponent composite = application.createComponent(context, resource); composite.setId(id); // Mandatory for the case composite is part of UIForm! Otherwise JSF can't find inputs. // This basically creates <composite:implementation>. UIComponent implementation = application.createComponent(UIPanel.COMPONENT_TYPE); implementation.setRendererType("javax.faces.Group"); composite.getFacets().put(UIComponent.COMPOSITE_FACET_NAME, implementation); // Now include the composite component file in the given parent. parent.getChildren().add(composite); parent.pushComponentToEL(context, composite); // This makes #{cc} available. try { faceletContext.includeFacelet(implementation, resource.getURL()); } catch (IOException e) { throw new FacesException(e); } finally { parent.popComponentFromEL(context); } }
private static String _getFacetName(UIComponent component) { UIComponent parent = component.getParent(); if (parent != null) { if (parent.getFacetCount() > 0) { for (Map.Entry<String, UIComponent> entry : parent.getFacets().entrySet()) { if (entry.getValue() == component) { return entry.getKey(); } } } } return null; }
public static void processDecodesOfFacetsAndChilds(UIComponent component, FacesContext context) { if (component.getFacetCount() > 0) { for (UIComponent facet : component.getFacets().values()) { facet.processDecodes(context); } } if (component.getChildCount() > 0) { for (int i = 0, childCount = component.getChildCount(); i < childCount; i++) { UIComponent child = component.getChildren().get(i); child.processDecodes(context); } } }
public DataTableFixedChildrenIterator(UIComponent dataTable) { super(); this.facetsIterator = dataTable.getFacets().values().iterator(); this.dataTableChildren = dataTable.getChildren().iterator(); }
protected void processColumnFacets(FacesContext context, PhaseId phaseId) { for (UIComponent child : this.getChildren()) { if (child.isRendered() && (child.getFacetCount() > 0)) { for (UIComponent facet : child.getFacets().values()) { process(context, facet, phaseId); } } } }
public void addComponent(FaceletContext ctx, UIComponent parent, UIComponent c) { // possible facet scoped String facetName = this.getFacetName(ctx, parent); if (facetName == null) { parent.getChildren().add(c); } else { parent.getFacets().put(facetName, c); } }
private static String _getFacetName(UIComponent component) { UIComponent parent = component.getParent(); if (parent != null) { if (parent.getFacetCount() > 0) { for (Map.Entry<String, UIComponent> entry : parent.getFacets().entrySet()) { if (entry.getValue() == component) { return entry.getKey(); } } } } return null; }
public static void processUpdatesOfFacetsAndChilds(UIComponent component, FacesContext context) { if (component.getFacetCount() > 0) { for (UIComponent facet : component.getFacets().values()) { facet.processUpdates(context); } } if (component.getChildCount() > 0) { for (int i = 0, childCount = component.getChildCount(); i < childCount; i++) { UIComponent child = component.getChildren().get(i); child.processUpdates(context); } } }
public DataTableFixedChildrenIterator(UIComponent dataTable) { super(); this.facetsIterator = dataTable.getFacets().values().iterator(); this.dataTableChildren = dataTable.getChildren().iterator(); }
private boolean visitTreeNodeFacets(VisitContext context, VisitCallback callback) { if (getChildCount() > 0) { for (UIComponent treeNode : getChildren()) { if (treeNode.getFacetCount() > 0) { for (UIComponent columnFacet : treeNode.getFacets().values()) { if (columnFacet.visitTree(context, callback)) return true; } } } } return false; }
@SuppressWarnings("unchecked") protected Iterator<UIComponent> fixedChildren() { IteratorChain chain = new IteratorChain(getFacets().values().iterator()); //RF-1248 Adding facets to both dataChildren and fixed children //To make both supports and header/footer work for (Iterator<UIComponent> i = getChildren().iterator(); i.hasNext(); ) { UIComponent kid = (UIComponent)i.next(); if (kid instanceof Column || kid instanceof UIColumn) { chain.addIterator(kid.getFacets().values().iterator()); } } return chain; }
@Override public void removeParentFormFromComponentTree(final UIComponent uiComponent) { UIComponent form = getParentForm(uiComponent); if (form != null) { form.getChildren().clear(); form.getFacets().clear(); } }
public static void withId(String id, UIComponent base, List<UIComponent> components) { if (id.equals(base.getId())) { components.add(base); } if (base.getFacetCount() > 0) { for (UIComponent facet : base.getFacets().values()) { withId(id, facet, components); } } if (base.getChildCount() > 0) { for (int i = 0, childCount = base.getChildCount(); i < childCount; i++) { UIComponent child = base.getChildren().get(i); withId(id, child, components); } } }
private boolean checkAllFixedChildren(UIComponent fixedChild, String id) { if (fixedChild.getId().equals(id)) { return true; } if (fixedChild instanceof NamingContainer) { return false; } for (UIComponent uiComponent : fixedChild.getChildren()) { if (checkAllFixedChildren(uiComponent, id)) { return true; } } for (UIComponent uiComponent : fixedChild.getFacets().values()) { if (checkAllFixedChildren(uiComponent, id)) { return true; } } return false; }
public void removeChildrenFromComponentTree(String clientId) { UIComponent comp = FacesContext.getCurrentInstance().getViewRoot().findComponent(clientId); if (comp != null) { comp.getChildren().clear(); comp.getFacets().clear(); } }