Java Code Examples for javax.faces.component.UIComponent.getFacetsAndChildren()

The following are Jave code examples for showing how to use getFacetsAndChildren() of the javax.faces.component.UIComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: myfaces-trinidad   File: StateManagerImpl.java   Source Code and License Vote up 6 votes
@SuppressWarnings("unchecked")
static private void _gatherTransientComponents(
  UIComponent component, List<UIComponent> componentsToRemove)
{
  Iterator<UIComponent> kids = component.getFacetsAndChildren();
  while (kids.hasNext())
  {
    UIComponent kid = kids.next();
    // UIXComponentBase doesn't mind transient components
    // in its saved state, so don't bother with this.
    if (!(component instanceof UIXComponentBase) &&
        kid.isTransient())
    {
      componentsToRemove.add(kid);
    }
    else
    {
      _gatherTransientComponents(kid, componentsToRemove);
    }
  }
}
 
Example 2
Project: myfaces-trinidad   File: UIXComponentBase.java   Source Code and License Vote up 6 votes
static private UIComponent _findInsideOf(
  UIComponent from,
  String id)
{
  Iterator<UIComponent> kids = from.getFacetsAndChildren();
  while (kids.hasNext())
  {
    UIComponent kid = kids.next();
    if (id.equals(kid.getId()))
      return kid;

    if (!(kid instanceof NamingContainer))
    {
      UIComponent returned = _findInsideOf(kid, id);
      if (returned != null)
        return returned;
    }
  }

  return null;
}
 
Example 3
Project: myfaces-trinidad   File: ResetActionListener.java   Source Code and License Vote up 5 votes
@SuppressWarnings("unchecked")
private void _resetChildren(UIComponent comp)
{
  Iterator<UIComponent> kids = comp.getFacetsAndChildren();

  while (kids.hasNext())
  {
    UIComponent kid = kids.next();
    
    if (kid instanceof UIXEditableValue)
    {
      ((UIXEditableValue) kid).resetValue();
      RequestContext.getCurrentInstance().addPartialTarget(kid);
    }
    else if (kid instanceof EditableValueHolder)
    {
      _resetEditableValueHolder((EditableValueHolder) kid);
      RequestContext.getCurrentInstance().addPartialTarget(kid);
    }
    else if (kid instanceof UIXCollection)
    {
      ((UIXCollection) kid).resetStampState();
      RequestContext.getCurrentInstance().addPartialTarget(kid);
    }

    _resetChildren(kid);
  }
}
 
Example 4
Project: myfaces-trinidad   File: DialogServiceImpl.java   Source Code and License Vote up 5 votes
/**
 * Execute any "binding" attributes so that a popped view
 * is properly set up
 */
@SuppressWarnings("unchecked")
private void _executeBindings(FacesContext context, UIComponent component)
{
  ValueExpression expression = component.getValueExpression("binding");
  if (expression != null)
    expression.setValue(context.getELContext(), component);

  Iterator<UIComponent> kids = component.getFacetsAndChildren();
  while (kids.hasNext())
    _executeBindings(context, kids.next());
}
 
Example 5
Project: myfaces-trinidad   File: PartialViewContextImpl.java   Source Code and License Vote up 5 votes
private static void _renderChildren(FacesContext context, UIComponent root) throws IOException
{
  Iterator<UIComponent> iterator = root.getFacetsAndChildren();
  while (iterator.hasNext())
  {
    UIComponent child = iterator.next();
    if (child.isRendered())
      child.encodeAll(context);
  }
}
 
Example 6
Project: myfaces-trinidad   File: UIXComponent.java   Source Code and License Vote up 5 votes
/**
 * Default implementation of clearing the cached client ids
 */
private static void _clearCachedClientIds(UIComponent component)
{
  // clear this component
  String id = component.getId();
  component.setId(id);

  // clear the children
  Iterator<UIComponent> allChildren = component.getFacetsAndChildren();

  while (allChildren.hasNext())
  {
    clearCachedClientIds(allChildren.next());
  }
}
 
Example 7
Project: ctsms   File: WebUtil.java   Source Code and License Vote up 5 votes
public static UIComponent findComponentById(UIComponent parent, String id) {
	if (id.equals(parent.getId())) {
		return parent;
	}
	Iterator<UIComponent> kids = parent.getFacetsAndChildren();
	while (kids.hasNext()) {
		UIComponent kid = kids.next();
		UIComponent found = findComponentById(kid, id);
		if (found != null) {
			return found;
		}
	}
	return null;
}
 
Example 8
Project: myfaces-trinidad   File: CoreRenderer.java   Source Code and License Vote up 3 votes
/**
 * Allows the rendered to specify what components should be involved with rendered children
 * life-cycle operations and methods.
 *
 * @param facesContext the faces context
 * @param component the component from which to get the rendered facets and children
 * @see UIXComponentBase#getRenderedFacetsAndChildren(FacesContext)
 * @return A list of components to process as rendered components. Defaults to all facets and
 * children of a component
 */
public Iterator<UIComponent> getRenderedFacetsAndChildren(
  FacesContext facesContext,
  UIComponent  component)
{
  return component.getFacetsAndChildren();
}