org.jboss.jsfunit.jsfsession
Class ClientIDs

java.lang.Object
  extended by org.jboss.jsfunit.jsfsession.ClientIDs

public class ClientIDs
extends Object

This immutable helper class gathers all the client IDs from the current component tree. It then allows finding a full client ID given a suffix of that ID. This suffix is usually just the component ID, but for specificity it can also include one or more of a component's naming containers such as in "mysubview:myform:mycomponentID".

Since:
1.0
Author:
Stan Silvert

Method Summary
 void dumpAllIDs()
          Debugging method that dumps all Client IDs to standard out.
 String findClientID(String suffix)
          Given a client ID or client ID suffix, find the fully-qualified client ID.
 javax.faces.component.UIComponent findComponent(String suffix)
          Given a client ID suffix, find the matching UIComponent.
 Object getComponentValue(String componentID)
          Find a component in the JSF component tree and return its value.
 boolean isAncestor(String clientID, String ancestorClientID)
          Determines if a component with a given clientID has an ancestor with a given ancestorClientID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findClientID

public String findClientID(String suffix)
Given a client ID or client ID suffix, find the fully-qualified client ID.

Parameters:
suffix - The full client ID or a suffix of the client ID.
Returns:
The fully-qualified client ID.
Throws:
ComponentIDNotFoundException - if no client ID matches the suffix
DuplicateClientIDException - if more than one client ID matches the suffix

findComponent

public javax.faces.component.UIComponent findComponent(String suffix)
Given a client ID suffix, find the matching UIComponent.

Parameters:
suffix - The full client ID or a suffix of the client ID.
Returns:
The UIComponent.
Throws:
ComponentIDNotFoundException - if no client ID matches the suffix
DuplicateClientIDException - if more than one client ID matches the suffix

getComponentValue

public Object getComponentValue(String componentID)
Find a component in the JSF component tree and return its value. Note that the found component must implement ValueHolder.

Parameters:
componentID - The JSF component ID or client ID suffix.
Returns:
The value contained in the component.
Throws:
ComponentIDNotFoundException - if the component can not be found
DuplicateClientIDException - if more than one client ID matches the componentID suffix
ClassCastException - if the found component does not implement ValueHolder

isAncestor

public boolean isAncestor(String clientID,
                          String ancestorClientID)
Determines if a component with a given clientID has an ancestor with a given ancestorClientID.


dumpAllIDs

public void dumpAllIDs()
Debugging method that dumps all Client IDs to standard out.



Copyright © 2007-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.