com.sun.rave.web.ui.util
Class ComponentUtilities

java.lang.Object
  extended by com.sun.rave.web.ui.util.ComponentUtilities

public class ComponentUtilities
extends java.lang.Object

Methods for general component manipulation.


Constructor Summary
ComponentUtilities()
          Creates a new instance of ComponentUtilities.
 
Method Summary
static java.lang.String createPrivateFacetId(javax.faces.component.UIComponent parent, java.lang.String facetName)
          Return an id using the convention
parent.getId() + "_" + facetName If parent.getId() is null, "_" + facetName is returned.
static java.lang.String createPrivateFacetName(java.lang.String facetName)
          Prefix the facetName parameter with an "_".
static javax.faces.component.UIComponent getPrivateFacet(javax.faces.component.UIComponent parent, java.lang.String facetName, boolean matchId)
          Return a private facet from the the parent component's facet map.
static void putPrivateFacet(javax.faces.component.UIComponent parent, java.lang.String facetName, javax.faces.component.UIComponent facet)
          Store an internally created component utilizing the internal facet naming convention by mapping the facet to the name returned by createPrivateFacetName().
static void removePrivateFacet(javax.faces.component.UIComponent parent, java.lang.String facetName)
          Remove an internally created component utilizing the internal facet naming convention by mapping the facet to the name returned by createPrivateFacetName().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentUtilities

public ComponentUtilities()
Creates a new instance of ComponentUtilities.

Method Detail

putPrivateFacet

public static void putPrivateFacet(javax.faces.component.UIComponent parent,
                                   java.lang.String facetName,
                                   javax.faces.component.UIComponent facet)
Store an internally created component utilizing the internal facet naming convention by mapping the facet to the name returned by createPrivateFacetName(). Add the component to the parent's facets map.

Parameters:
parent - the component that created the facet
facetName - the public facet name
facet - the private facet component instance

removePrivateFacet

public static void removePrivateFacet(javax.faces.component.UIComponent parent,
                                      java.lang.String facetName)
Remove an internally created component utilizing the internal facet naming convention by mapping the facet to the name returned by createPrivateFacetName(). Remove the component from the parent's facets map.

Parameters:
parent - the component that created the facet
facetName - the public facet name

getPrivateFacet

public static javax.faces.component.UIComponent getPrivateFacet(javax.faces.component.UIComponent parent,
                                                                java.lang.String facetName,
                                                                boolean matchId)
Return a private facet from the the parent component's facet map. Look for a private facet name by calling createPrivateFacetName() on the facetName parameter.

If the matchId parameter is true, verify that the facet that is found has an id that matches the value of getPrivateFacetId(parent.getId(), facetName). If the id's do not match return null and remove the existing facet.
If matchId is false, return the facet if found or null.

Parameters:
parent - the component that contains the facet
facetName - the public facet name
Returns:
a UIComponent if the facet is found else null.

createPrivateFacetName

public static java.lang.String createPrivateFacetName(java.lang.String facetName)
Prefix the facetName parameter with an "_".

Parameters:
facetName - the public facet name
Returns:
a private facet name

createPrivateFacetId

public static java.lang.String createPrivateFacetId(javax.faces.component.UIComponent parent,
                                                    java.lang.String facetName)
Return an id using the convention
parent.getId() + "_" + facetName If parent.getId() is null, "_" + facetName is returned.

Parameters:
parent - the component that contains the facet
facetName - the public facet name
Returns:
an id for a private facet.