javax.faces.component
Class NamingContainerSupport

java.lang.Object
  extended byjavax.faces.component.NamingContainerSupport
All Implemented Interfaces:
NamingContainer, java.io.Serializable

public class NamingContainerSupport
extends java.lang.Object
implements NamingContainer, java.io.Serializable

NamingContainerSupport is a utility class that may be utilized by UIComponents that implement NamingContainer to delegate naming container management methods.

Typical usage in a UIComponent implementation class would be:

   public class MyComponent extends UIComponentBase
     implements NamingContainer {

       private NamingContainerSupport ncs = new NamingContainerSupport();

       ...

       public void addComponentToNamespace(UIComponent component) {
           ncs.addComponentToNamespace(component);
       }

       public void removeComponentFromNamespace(UIComponent component) {
           ncs.removeComponentFromNamespace(component);
       }

       public UIComponent findComponentInNamespace(String name) {
           return ncs.findComponentInNamespace(name);
       }

       public String generateClientId() {
           return ncs.generateClientId();
       }

   }
 

See Also:
Serialized Form

Constructor Summary
NamingContainerSupport()
           
 
Method Summary
 void addComponentToNamespace(UIComponent component)
          Add the specified UIComponent to the namespace of this naming container.
 UIComponent findComponentInNamespace(java.lang.String name)
          Find and return a UIComponent in this namespace, if it is present; otherwise return null.
 java.lang.String generateClientId()
          Generate an identifier for a component, suitable for communication to a client.
 void removeComponentFromNamespace(UIComponent component)
          Remove the specified UIComponent from the namespace of this naming container, if it is present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamingContainerSupport

public NamingContainerSupport()
Method Detail

addComponentToNamespace

public void addComponentToNamespace(UIComponent component)
Description copied from interface: NamingContainer

Add the specified UIComponent to the namespace of this naming container.

Specified by:
addComponentToNamespace in interface NamingContainer
Parameters:
component - The UIComponent to be added

removeComponentFromNamespace

public void removeComponentFromNamespace(UIComponent component)
Description copied from interface: NamingContainer

Remove the specified UIComponent from the namespace of this naming container, if it is present.

Specified by:
removeComponentFromNamespace in interface NamingContainer
Parameters:
component - The UIComponent to be removed

findComponentInNamespace

public UIComponent findComponentInNamespace(java.lang.String name)
Description copied from interface: NamingContainer

Find and return a UIComponent in this namespace, if it is present; otherwise return null.

If the argument name does not contain any UIComponent.SEPARATOR_CHAR characters, it is interpreted to be a name in the namespace of this naming container.

If the argument name does contain UIComponent.SEPARATOR_CHAR characters, each segment between UIComponent.SEPARATOR_CHAR is treated as a component identifier in its own namespace, which are searched for in child naming containers of this naming container, from left to right.

Specified by:
findComponentInNamespace in interface NamingContainer
Parameters:
name - Identifier of the desired component

generateClientId

public java.lang.String generateClientId()
Description copied from interface: NamingContainer

Generate an identifier for a component, suitable for communication to a client. The identifier returned from this method must be unique within this namespace.

Specified by:
generateClientId in interface NamingContainer