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); } } }
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); } } } }
protected boolean visitColumnGroup(VisitContext context, VisitCallback callback, ColumnGroup group) { if (group.getChildCount() > 0) { for (UIComponent row : group.getChildren()) { if (row.getChildCount() > 0) { for (UIComponent col : row.getChildren()) { if (col instanceof Column && col.getFacetCount() > 0) { boolean value = visitColumnFacets(context, callback, col); if (value) { return true; } } } } } } return false; }
private void restoreDescendantState(UIComponent component, FacesContext context) { //force id reset String id = component.getId(); component.setId(id); Map<String, SavedState> saved = (Map<String, SavedState>) getStateHelper().get(PropertyKeys.saved); if (component instanceof EditableValueHolder) { EditableValueHolder input = (EditableValueHolder) component; String clientId = component.getClientId(context); SavedState state = saved.get(clientId); if (state == null) { state = new SavedState(); } input.setValue(state.getValue()); input.setValid(state.isValid()); input.setSubmittedValue(state.getSubmittedValue()); input.setLocalValueSet(state.isLocalValueSet()); } for (UIComponent kid : component.getChildren()) { restoreDescendantState(kid, context); } if (component.getFacetCount() > 0) { for (UIComponent facet : component.getFacets().values()) { restoreDescendantState(facet, context); } } }
private void setupValidators(SetupValidatorsParameter parameterObject, UIComponent component) { if (component.getChildCount() == 0 && component.getFacetCount() == 0) { return; } Iterator<UIComponent> facetsAndChildren = component.getFacetsAndChildren(); while (facetsAndChildren.hasNext()) { UIComponent child = facetsAndChildren.next(); if (child instanceof EditableValueHolder) { EditableValueHolder input = (EditableValueHolder) child; setupValidator(parameterObject, input); } if (!(child instanceof AbstractGraphValidator)) { // don't setup validators for nested GVs setupValidators(parameterObject, child); } } }
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); } } }
for (UIComponent uiComponent : component.getChildren()) { saveDescendantState(uiComponent, context); if (component.getFacetCount() > 0) { for (UIComponent facet : component.getFacets().values()) { saveDescendantState(facet, context);
private void setupValidators(SetupValidatorsParameter parameterObject, UIComponent component) { if (component.getChildCount() == 0 && component.getFacetCount() == 0) { return; } Iterator<UIComponent> facetsAndChildren = component.getFacetsAndChildren(); while (facetsAndChildren.hasNext()) { UIComponent child = facetsAndChildren.next(); if (child instanceof EditableValueHolder) { EditableValueHolder input = (EditableValueHolder) child; setupValidator(parameterObject, input); } if (!(child instanceof AbstractGraphValidator)) { // don't setup validators for nested GVs setupValidators(parameterObject, child); } } }
protected boolean visitColumnGroup(VisitContext context, VisitCallback callback, ColumnGroup group) { if (group.getChildCount() > 0) { for (UIComponent row : group.getChildren()) { if (row.getChildCount() > 0) { for (UIComponent col : row.getChildren()) { if (col instanceof Column && col.getFacetCount() > 0) { boolean value = visitColumnFacets(context, callback, (Column) col); if (value) { return true; } } } } } } return false; }
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 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); } } }
private void removeChildrenFromParent(UIComponent child) { UIComponent oldParent = child.getParent(); if (oldParent != null) { if (!oldParent.getChildren().remove(child)) { // Check if the component is inside a facet and remove from there if (oldParent.getFacetCount() > 0) { for (Iterator< Map.Entry<String, UIComponent > > it = oldParent.getFacets().entrySet().iterator() ; it.hasNext() ; ) { Map.Entry<String, UIComponent > entry = it.next(); if (entry.getValue().equals(child)) { it.remove(); break; } } } } } }
private void setupValidators(SetupValidatorsParameter parameterObject, UIComponent component) { if (component.getChildCount() == 0 && component.getFacetCount() == 0) { return; } Iterator<UIComponent> facetsAndChildren = component.getFacetsAndChildren(); while (facetsAndChildren.hasNext()) { UIComponent child = facetsAndChildren.next(); if (child instanceof EditableValueHolder) { EditableValueHolder input = (EditableValueHolder) child; setupValidator(parameterObject, input); } if (!(child instanceof AbstractGraphValidator)) { // don't setup validators for nested GVs setupValidators(parameterObject, child); } } }
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 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 void setNewParent(String facetName, UIComponent facet) { UIComponent oldParent = facet.getParent(); if (oldParent != null) { if (!oldParent.getChildren().remove(facet)) { // Check if the component is inside a facet and remove from there if (oldParent.getFacetCount() > 0) { for (Iterator< Map.Entry<String, UIComponent > > it = oldParent.getFacets().entrySet().iterator() ; it.hasNext() ; ) { Map.Entry<String, UIComponent > entry = it.next(); if (entry.getValue().equals(facet)) { it.remove(); break; } } } } } facet.setParent(_component); }
/** * Save state of any {@link EditableValueHolder} children. * @param context The faces context to work with. * @param stateHelper The state helper of the parent component. * @param children An iterator with all child facets and components of the parent component as obtained by * {@link UIComponentBase#getFacetsAndChildren()}. */ public static void save(FacesContext context, StateHelper stateHelper, Iterator<UIComponent> children) { while (children.hasNext()) { UIComponent child = children.next(); if (child instanceof EditableValueHolder && !child.isTransient()) { get(stateHelper, child.getClientId(context)).save((EditableValueHolder) child); } if (child.getFacetCount() > 0 || child.getChildCount() > 0) { save(context, stateHelper, child.getFacetsAndChildren()); } } }
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); } } } }
if (iterateFacets && parent.getFacetCount() > 0) { Iterator<UIComponent> childIterator = parent.getFacets().values().iterator(); if (childStates == null) { childStates = new ArrayList<>( parent.getFacetCount() + parent.getChildCount() - totalChildCount + childEmptyIndex); else if (child.getChildCount() > 0 || (saveChildFacets && child.getFacetCount() > 0)) { Object descendantSavedState = saveDescendantComponentStates(child, saveChildFacets, true); if (childStates == null) { childStates = new ArrayList<>( parent.getFacetCount() if (childStates == null) { childStates = new ArrayList<>( parent.getFacetCount() else if (child.getChildCount() > 0 || (saveChildFacets && child.getFacetCount() > 0)) { Object descendantSavedState = saveDescendantComponentStates(child, saveChildFacets, true); if (childStates == null) { childStates = new ArrayList<>( parent.getFacetCount()
private void restoreDescendantState(UIComponent component, FacesContext context) { //force id reset String id = component.getId(); component.setId(id); Map<String, SavedState> saved = (Map<String, SavedState>) getStateHelper().get(PropertyKeys.saved); if (component instanceof EditableValueHolder) { EditableValueHolder input = (EditableValueHolder) component; String clientId = component.getClientId(context); SavedState state = saved.get(clientId); if (state == null) { state = new SavedState(); } input.setValue(state.getValue()); input.setValid(state.isValid()); input.setSubmittedValue(state.getSubmittedValue()); input.setLocalValueSet(state.isLocalValueSet()); } for (UIComponent kid : component.getChildren()) { restoreDescendantState(kid, context); } if (component.getFacetCount() > 0) { for (UIComponent facet : component.getFacets().values()) { restoreDescendantState(facet, context); } } }