org.jboss.jsfunit.richclient
Class RichFacesClient

java.lang.Object
  extended by org.jboss.jsfunit.richclient.RichFacesClient

public class RichFacesClient
extends Object

This class provides helper methods for RichFaces controls.

Since:
1.0
Author:
Stan Silvert

Constructor Summary
RichFacesClient(JSFClientSession jsfClient)
           
 
Method Summary
 void clickInputNumberSpinnerDown(String componentID)
          Click the down arrow on an InputNumberSpinner.
 void clickInputNumberSpinnerUp(String componentID)
          Click the up arrow on an InputNumberSpinner.
 void clickTab(String tabComponentID)
          Click a tab on a TabPanel.
 void clickTreeNodeHandle(String treeNodeKey, String treeNodeId)
          Click this handle icon for a node in a RichTree in order to toggle the open/closed state.
 void dragAndDrop(String dragComponentID, String dropTargetComponentID)
          Drag a component with rich:dragSupport to a component with rich:dropSupport.
 com.gargoylesoftware.htmlunit.html.HtmlElement getTreeHandle(String treeID, String treeNodeID, String nodeText)
          Get the HtmlElement of the tree handle for a node in a RichTree.
 com.gargoylesoftware.htmlunit.html.HtmlElement getTreeNodeByText(String treeID, String componentID, String nodeText)
          Get the HtmlElement of the tree node that contains the given text.
 boolean isTreeHandleExpanded(String treeID, String treeNodeID, String nodeText)
          Find out if a tree handle is expanded.
 void setCalendarValue(String componentID, String value)
          Set a parameter value on a RichCalendar component.
 void setComboBox(String componentID, String value)
          Set a parameter value on a RichComboBox component.
 void setDataFilterSlider(String componentID, String value)
          Set a parameter value on a DataFilterSlider.
 void setInplaceInput(String componentID, String value)
          Set the value of a RichInplaceInput component.
 void setInplaceInput(String componentID, String value, String customSaveID)
          Set the value of a RichInplaceInput component.
 void setInputNumberSlider(String componentID, String value)
          Set the value of an InputNumberSlider.
 void setInputNumberSpinner(String componentID, String value)
          Set the value of an InputNumberSpinner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RichFacesClient

public RichFacesClient(JSFClientSession jsfClient)
Method Detail

setDataFilterSlider

public void setDataFilterSlider(String componentID,
                                String value)
Set a parameter value on a DataFilterSlider.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
value - The value to set before the form is submitted.
Throws:
ComponentIDNotFoundException - if the component can not be found
DuplicateClientIDException - if more than one client ID matches the componentID suffix

setCalendarValue

public void setCalendarValue(String componentID,
                             String value)
                      throws IOException
Set a parameter value on a RichCalendar component.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
value - The value to set before the form is submitted.
Throws:
ComponentIDNotFoundException - if the component can not be found
DuplicateClientIDException - if more than one client ID matches the componentID suffix
IOException

setInplaceInput

public void setInplaceInput(String componentID,
                            String value,
                            String customSaveID)
                     throws IOException
Set the value of a RichInplaceInput component.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
value - The value to set
customSaveID - The JSF component ID or a suffix of a custom save button (null if not used)
Throws:
IOException

setInplaceInput

public void setInplaceInput(String componentID,
                            String value)
                     throws IOException
Set the value of a RichInplaceInput component. This method is used when a custom save button is not needed.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
value - The value to set
Throws:
IOException

clickTreeNodeHandle

public void clickTreeNodeHandle(String treeNodeKey,
                                String treeNodeId)
                         throws IOException
Click this handle icon for a node in a RichTree in order to toggle the open/closed state. In order to use this you will need the key value of the node (from the tree data) and the id="" attribute value from the rich:treeNode template declaration.

Parameters:
treeNodeKey - key value for the node to reference
treeNodeId - id of the treeNode template
Throws:
IOException
ComponentIDNotFoundException - if the component can not be found

dragAndDrop

public void dragAndDrop(String dragComponentID,
                        String dropTargetComponentID)
                 throws IOException
Drag a component with rich:dragSupport to a component with rich:dropSupport.

Parameters:
dragComponentID - The JSF component ID or a suffix of the client ID for the rich:dragSupport component.
dropTargetComponentID - The JSF component ID or a suffix of the client ID for the target rich:dropSupport component.
Throws:
IOException - if there is a problem submitting the form
ComponentIDNotFoundException - if the component can not be found
DuplicateClientIDException - if more than one client ID matches the componentID suffix

clickTab

public void clickTab(String tabComponentID)
              throws IOException
Click a tab on a TabPanel. Note that this method is a no-op if the tab is in a disabled state or if the TabPanel is in client mode. In client mode, the tab click does not generate an ajax submit but only changes the visible tab already present on the client. JSFUnit does not currently deal with these kinds of "client only" operations.

Parameters:
tabPanelComponentID - The JSF component ID or a suffix of the client ID for the rich:tabPanel component.
tabPanelComponentID - The JSF component ID or a suffix of the client ID for the rich:tab component.
Throws:
IOException - if there is a problem submitting the form
ComponentIDNotFoundException - if the component can not be found
DuplicateClientIDException - if more than one client ID matches the componentID suffix

setComboBox

public void setComboBox(String componentID,
                        String value)
                 throws IOException
Set a parameter value on a RichComboBox component.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
value - The value to set before the form is submitted.
Throws:
IOException - if there is a problem submitting the form
ComponentIDNotFoundException - if the component can not be found
DuplicateClientIDException - if more than one client ID matches the componentID suffix

setInputNumberSpinner

public void setInputNumberSpinner(String componentID,
                                  String value)
                           throws IOException
Set the value of an InputNumberSpinner.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
value - The value to set before the form is submitted.
Throws:
IOException - if an internal refresh is needed and there is an error sending a request to the server.
DuplicateClientIDException - if more than one client ID matches the suffix
ClassCastException - if the current page is not an HtmlPage.

clickInputNumberSpinnerUp

public void clickInputNumberSpinnerUp(String componentID)
                               throws IOException
Click the up arrow on an InputNumberSpinner.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
Throws:
IOException - if an internal refresh is needed and there is an error sending a request to the server.
DuplicateClientIDException - if more than one client ID matches the suffix
ClassCastException - if the current page is not an HtmlPage.

clickInputNumberSpinnerDown

public void clickInputNumberSpinnerDown(String componentID)
                                 throws IOException
Click the down arrow on an InputNumberSpinner.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
Throws:
IOException - if an internal refresh is needed and there is an error sending a request to the server.
DuplicateClientIDException - if more than one client ID matches the suffix
ClassCastException - if the current page is not an HtmlPage.

setInputNumberSlider

public void setInputNumberSlider(String componentID,
                                 String value)
                          throws IOException
Set the value of an InputNumberSlider.

Parameters:
componentID - The JSF component ID or a suffix of the client ID.
value - The value to set before the form is submitted.
Throws:
IOException - if an internal refresh is needed and there is an error sending a request to the server.
DuplicateClientIDException - if more than one client ID matches the suffix
ClassCastException - if the current page is not an HtmlPage.

getTreeHandle

public com.gargoylesoftware.htmlunit.html.HtmlElement getTreeHandle(String treeID,
                                                                    String treeNodeID,
                                                                    String nodeText)
                                                             throws IOException
Get the HtmlElement of the tree handle for a node in a RichTree. Typically, you would then call HtmlElement.click() to toggle expanded/collapsed

Parameters:
treeID - id of the rich:tree
treeNodeID - id of the rich:treeNode
nodeText - text of the node
Returns:
The HtmlElement used to toggle expanded/collapsed, or null if not found.
Throws:
IOException
ComponentIDNotFoundException - if the component can not be found
Since:
1.2

isTreeHandleExpanded

public boolean isTreeHandleExpanded(String treeID,
                                    String treeNodeID,
                                    String nodeText)
                             throws IOException
Find out if a tree handle is expanded.

Parameters:
treeID - id of the rich:tree
treeNodeID - id of the rich:treeNode
nodeText - text of the node
Returns:
true if the tree handle is exapanded, false otherwise.
Throws:
IOException
ComponentIDNotFoundException - if the component can not be found
Since:
1.2

getTreeNodeByText

public com.gargoylesoftware.htmlunit.html.HtmlElement getTreeNodeByText(String treeID,
                                                                        String componentID,
                                                                        String nodeText)
                                                                 throws IOException
Get the HtmlElement of the tree node that contains the given text. Specifically, it finds a text node with the given text and then returns a parent node whose Id contains the treeID and treeNodeID. Typically, you would then call HtmlElement.click() to select the node.

Parameters:
treeID - id of the rich:tree
componentID - id of the component inside the rich:treeNode that contains the text, or the id of the rich:treeNode itself if the node does not contain other JSF components
nodeText - text of the node
Returns:
The HtmlElement used to toggle expanded/collapsed
Throws:
IOException
ComponentIDNotFoundException - if the component can not be found
Since:
1.2


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