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

The following are Jave code examples for showing how to use isTransient() 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: Structure.java   Source Code and License Vote up 6 votes
/**
 * Store the structure of all the children.
 */
@SuppressWarnings("unchecked")
private List<Structure> _getChildren(UIComponent component)
{
  if (component.getChildCount() == 0)
    return null;

  List<UIComponent> children = component.getChildren();
  ArrayList<Structure> list = new ArrayList<Structure>(children.size());

  for(UIComponent child : children)
  {
    if ((child != null) && !child.isTransient())
    {
      list.add(new Structure(child));
    }
  }

  if (list.isEmpty())
    return null;

  return list;
}
 
Example 2
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 3
Project: myfaces-trinidad   File: Structure.java   Source Code and License Vote up 5 votes
/**
 * Store the structure of all the facets.
 */
@SuppressWarnings("unchecked")
private List<Object> _getFacets(UIComponent component)
{
  Iterator<String> facetNames;
  if (component instanceof UIXComponentBase)
  {
    facetNames = ((UIXComponentBase) component).getFacetNames();
  }
  else
  {
    facetNames = component.getFacets().keySet().iterator();
  }

  if (!facetNames.hasNext())
    return null;

  Map<String, UIComponent> facets = component.getFacets();
  ArrayList<Object> list = new ArrayList<Object>(facets.size() * 2);
  while (facetNames.hasNext())
  {
    String name = facetNames.next();
    UIComponent facet = facets.get(name);
    if ((facet != null) && !facet.isTransient())
    {
      list.add(name);
      list.add(new Structure(facet));
    }
  }

  if (list.isEmpty())
    return null;

  return list;
}
 
Example 4
Project: myfaces-trinidad   File: UIXComponent.java   Source Code and License Vote up 5 votes
/**
 * default implementation checking the <code>VisitHint.SKIP_TRANSIENT</code> and
 * <code>VisitHint.SKIP_UNRENDERED</code> hints.
 */
private static boolean _isVisitable(VisitContext visitContext, UIComponent component)
{
  Collection<VisitHint> hints = visitContext.getHints();

  if (hints.contains(VisitHint.SKIP_TRANSIENT) && component.isTransient())
    return false;

  if (hints.contains(VisitHint.SKIP_UNRENDERED) && !component.isRendered())
    return false;

  return true;
}