org.apache.myfaces.trinidad.util
Class ComponentReference<T extends UIComponent>

java.lang.Object
  extended by org.apache.myfaces.trinidad.util.ComponentReference<T>
All Implemented Interfaces:
Serializable

public final class ComponentReference<T extends UIComponent>
extends Object
implements Serializable

A utility to store a reference to an UIComponent. Application developers should use this tool if they need to have a reference to an instance of the UIComponent class in managed beans that are session scoped. Use newUIComponentReference() to create a ComponentReference and use the getComponent() to look up the referenced UIComponent.

Please note:

See Also:
newUIComponentReference(UIComponent), getComponent(), Serialized Form

Method Summary
 T getComponent()
          This method will use a calculated "component path" to walk down to the UIComponent that is referenced by this class.
static
<T extends UIComponent>
ComponentReference<T>
newUIComponentReference(T uicomponent)
          Factory method to create an instance of the ComponentReference class, which wraps the given UIComponent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newUIComponentReference

public static <T extends UIComponent> ComponentReference<T> newUIComponentReference(T uicomponent)
Factory method to create an instance of the ComponentReference class, which wraps the given UIComponent. The component must be in the component tree when this method is called and that we will throw an IllegalArgumentException if it is not.

Parameters:
uicomponent - the UIComponent to wrap.
Returns:
ComponentReference that wrap the given component
Throws:
IllegalArgumentException - if component is not in the component tree
IllegalArgumentException - if component does not have an Id

getComponent

public T getComponent()
This method will use a calculated "component path" to walk down to the UIComponent that is referenced by this class. If the component can not be found, the getComponent() will return null.

Returns:
the referenced UIComponent or null if it can not be found.
See Also:
newUIComponentReference(UIComponent)


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.