org.eclipse.jubula.rc.swing.swing.implclasses
Class JTreeImplClass

java.lang.Object
  extended by org.eclipse.jubula.rc.swing.swing.implclasses.AbstractSwingImplClass
      extended by org.eclipse.jubula.rc.swing.swing.implclasses.JTreeImplClass
All Implemented Interfaces:
org.eclipse.jubula.rc.common.implclasses.IBaseImplementationClass, IImplementationClass

public class JTreeImplClass
extends AbstractSwingImplClass

This class implements actions on the Swing JTree.

Created:
15.03.2005

Field Summary
static int NO_PRE_ASCEND
          Constant for no pre-ascend
 
Fields inherited from class org.eclipse.jubula.rc.swing.swing.implclasses.AbstractSwingImplClass
INDEX_LIST_SEP_CHAR, POS_UNI_PERCENT, POS_UNIT_PIXEL, RENDERER_FALLBACK_TEXT_GETTER_METHOD_1, RENDERER_FALLBACK_TEXT_GETTER_METHOD_2, VALUE_SEPARATOR
 
Constructor Summary
JTreeImplClass()
           
 
Method Summary
 void gdClick(int count, int button)
          Clicks the tree.
 void gdCollapse(java.lang.String pathType, int preAscend, java.lang.String treePath, java.lang.String operator)
          Collapses the JTree.
 void gdCollapseByIndices(java.lang.String pathType, int preAscend, java.lang.String indexPath)
          Collapses the tree.
 void gdDragByIndexPath(int mouseButton, java.lang.String modifier, java.lang.String pathType, int preAscend, java.lang.String indexPath)
          Drags the node of the given indexPath.
 void gdDragByTextPath(int mouseButton, java.lang.String modifier, java.lang.String pathType, int preAscend, java.lang.String treePath, java.lang.String operator)
          Drags the node of the given treePath.
 void gdDropByIndexPath(java.lang.String pathType, int preAscend, java.lang.String indexPath, int delayBeforeDrop)
          Drops the before dragged object on the given indexPath.
 void gdDropByTextPath(java.lang.String pathType, int preAscend, java.lang.String treePath, java.lang.String operator, int delayBeforeDrop)
          Drops the before dragged object on the given treePath.
 void gdExpand(java.lang.String pathType, int preAscend, java.lang.String treePath, java.lang.String operator)
           Expands the JTree.
 void gdExpandByIndices(java.lang.String pathType, int preAscend, java.lang.String indexPath)
          Expands the tree.
 void gdMove(java.lang.String direction, int distance, int clickCount)
          Selects a node relative to the currently selected node.
 void gdPopupByIndexPathAtIndexNode(java.lang.String treeIndexPath, java.lang.String popupIndexPath)
          Deprecated. will be removed!
 void gdPopupByIndexPathAtSelectedNode(java.lang.String indexPath)
          Deprecated. will be removed!
 void gdPopupByIndexPathAtTextNode(java.lang.String treeTextPath, java.lang.String operator, java.lang.String popupIndexPath)
          Deprecated. will be removed!
 void gdPopupByTextPathAtIndexNode(java.lang.String treeIndexPath, java.lang.String popupTextPath)
          Deprecated. will be removed!
 void gdPopupByTextPathAtSelectedNode(java.lang.String textPath)
          Deprecated. will be removed!
 void gdPopupByTextPathAtTextNode(java.lang.String treeTextPath, java.lang.String operator, java.lang.String popupIndexPath)
          Deprecated. will be removed!
 void gdSelect(java.lang.String pathType, int preAscend, java.lang.String treePath, java.lang.String operator, int clickCount, int button, java.lang.String extendSelection)
          Selects the node at the end of the treepath.
 void gdSelectByIndices(java.lang.String pathType, int preAscend, java.lang.String indexPath, int clickCount, int button, java.lang.String extendSelection)
          Selects the last node of the path given by indexPath
 java.lang.String gdStoreSelectedNodeValue(java.lang.String variable)
          
 java.lang.String gdStoreValueAtMousePosition(java.lang.String variable)
          
 void gdVerifyPath(java.lang.String pathType, int preAscend, java.lang.String treePath, java.lang.String operator, boolean exists)
          Tests whether the given treePath exists or not
 void gdVerifyPathByIndices(java.lang.String pathType, int preAscend, java.lang.String treePath, boolean exists)
          Tests whether the given treePath exists or not
 void gdVerifySelectedValue(java.lang.String selection)
          Verifies whether the first selection in the tree has a rendered text that is equal to selection.
 void gdVerifySelectedValue(java.lang.String pattern, java.lang.String operator)
          Verifies whether the first selection in the tree has a rendered text that is equal to pattern.
 void gdVerifyTextAtMousePosition(java.lang.String pattern, java.lang.String operator)
          
 javax.swing.JComponent getComponent()
          
protected  java.lang.String getText()
          Get a String representation of the "text" of the component.
 java.lang.String[] getTextArrayFromComponent()
          Returns a descriptive text array that represents the given gui component.
 void setComponent(java.lang.Object graphicsComponent)
          Set the component the methods this implementation class implements have to work with.
 
Methods inherited from class org.eclipse.jubula.rc.swing.swing.implclasses.AbstractSwingImplClass
gdClickDirect, gdDrag, gdDrop, gdPopupSelectByIndexPath, gdPopupSelectByIndexPath, gdPopupSelectByIndexPath, gdPopupSelectByIndexPath, gdPopupSelectByTextPath, gdPopupSelectByTextPath, gdPopupSelectByTextPath, gdPopupSelectByTextPath, gdPopupVerifyEnabledByIndexPath, gdPopupVerifyEnabledByIndexPath, gdPopupVerifyEnabledByTextPath, gdPopupVerifyEnabledByTextPath, gdPopupVerifyExistsByIndexPath, gdPopupVerifyExistsByIndexPath, gdPopupVerifyExistsByTextPath, gdPopupVerifyExistsByTextPath, gdPopupVerifySelectedByIndexPath, gdPopupVerifySelectedByIndexPath, gdPopupVerifySelectedByTextPath, gdPopupVerifySelectedByTextPath, gdShowText, gdStorePropertyValue, gdVerifyEnabled, gdVerifyExists, gdVerifyFocus, gdVerifyProperty, gdWaitForComponent, getClickModifier, getEventThreadQueuer, getRenderedText, getRenderedText, getRobot, getRobotFactory, hasFocus, highLight, lowLight, pressOrReleaseModifiers, resolveRenderedText, showPopup, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PRE_ASCEND

public static final int NO_PRE_ASCEND
Constant for no pre-ascend

See Also:
Constant Field Values
Constructor Detail

JTreeImplClass

public JTreeImplClass()
Method Detail

setComponent

public void setComponent(java.lang.Object graphicsComponent)
Set the component the methods this implementation class implements have to work with.
The methods are declared by the configuration file for supported components.

Parameters:
graphicsComponent - the component from the AUT
Notice: Every changes made to control affects the AUT.

getComponent

public javax.swing.JComponent getComponent()

Specified by:
getComponent in class AbstractSwingImplClass
Returns:
The component passed to the implementation class by calling IBaseImplementationClass.setComponent(Object)

gdExpand

public void gdExpand(java.lang.String pathType,
                     int preAscend,
                     java.lang.String treePath,
                     java.lang.String operator)
              throws org.eclipse.jubula.rc.common.exception.StepExecutionException

Expands the JTree. Any node defined by the passed tree path is expanded, if it is collapsed. The node is expanded by performing a double click onto the node. If the node is already expanded, the JTree is left unchanged. The tree path is a slash-seperated list of nodes that specifies a valid top-down path in the JTree.

An example: Say the passed tree path is animals/birds/kakadu. To get a valid expansion, the JTree has to look as follows:
 animals
 |
 - -- birds
      |
      - -- kakadu
 
animals is the JTree's root node, if the root node has been set to visible by calling JTree#setRootVisible(true), or it is one of the root node's children, if the root node has been set to invisible by calling JTree#setRootVisible(false).

It is important to know that the tree path entries have to match the rendered node texts, but not the underlying user object data etc.

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
treePath - The tree path.
operator - If regular expressions are used to determine the tree path
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If the tree path is invalid or the double click fails.

gdExpandByIndices

public void gdExpandByIndices(java.lang.String pathType,
                              int preAscend,
                              java.lang.String indexPath)
                       throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Expands the tree. This method works like gdExpand(String, int, String, String), but expects an enumeration of indices representing the top-down tree path. Any index is the node's position at the current tree level.

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
indexPath - The index path
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If the tree path is invalid or the double-click fails.

gdCollapse

public void gdCollapse(java.lang.String pathType,
                       int preAscend,
                       java.lang.String treePath,
                       java.lang.String operator)
                throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Collapses the JTree. The passed tree path is a slash-seperated list of nodes that specifies a valid top-down path in the JTree. The last node of the tree path is collapsed if it is currently expanded. Otherwise, the JTree is left unchanged.

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
treePath - The tree path.
operator - Whether regular expressions are used to determine the tree path. "matches" for regex, "equals" for simple matching.
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If the tree path is invalid or the double click to collapse the node fails.

gdCollapseByIndices

public void gdCollapseByIndices(java.lang.String pathType,
                                int preAscend,
                                java.lang.String indexPath)
                         throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Collapses the tree. This method works like gdCollapse(String, int, String, String), but expects an enumeration of indices representing the top-down tree path. Any index is the node's position at the current tree level.

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
indexPath - The index path
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If the tree path is invalid or the double-click to collapse the node fails.

gdMove

public void gdMove(java.lang.String direction,
                   int distance,
                   int clickCount)
            throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Selects a node relative to the currently selected node.

Parameters:
direction - the direction to move. directions: UP - Navigates through parents DOWN - Navigates through children NEXT - Navigates to next sibling PREVIOUS - Navigates to previous sibling
distance - the distance to move
clickCount - the click count to select the new cell.
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - if any error occurs

gdSelect

public void gdSelect(java.lang.String pathType,
                     int preAscend,
                     java.lang.String treePath,
                     java.lang.String operator,
                     int clickCount,
                     int button,
                     java.lang.String extendSelection)
              throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Selects the node at the end of the treepath.

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
treePath - The tree path.
operator - If regular expressions are used to match the tree path
clickCount - the click count
button - what mouse button should be used
extendSelection - Whether this selection extends a previous selection.
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If the tree path is invalid, if the double-click to expand the node fails, or if the selection is invalid.

gdSelectByIndices

public void gdSelectByIndices(java.lang.String pathType,
                              int preAscend,
                              java.lang.String indexPath,
                              int clickCount,
                              int button,
                              java.lang.String extendSelection)
                       throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Selects the last node of the path given by indexPath

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
indexPath - the index path
clickCount - the number of times to click
button - what mouse button should be used
extendSelection - Whether this selection extends a previous selection.
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - if indexPath is not a valid path

gdVerifySelectedValue

public void gdVerifySelectedValue(java.lang.String selection)
                           throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Verifies whether the first selection in the tree has a rendered text that is equal to selection.

Parameters:
selection - The selection to verify
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If no node is selected or the verification fails.

gdVerifySelectedValue

public void gdVerifySelectedValue(java.lang.String pattern,
                                  java.lang.String operator)
                           throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Verifies whether the first selection in the tree has a rendered text that is equal to pattern.

Parameters:
pattern - The expected text
operator - The operator to use when comparing the expected and actual values.
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If no node is selected or the verification fails.

gdVerifyPath

public void gdVerifyPath(java.lang.String pathType,
                         int preAscend,
                         java.lang.String treePath,
                         java.lang.String operator,
                         boolean exists)
Tests whether the given treePath exists or not

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
treePath - the path to check
operator - the RegEx operator
exists - if true, the verify succeeds if the path DOES exist. If false, the verify succeeds if the path DOES NOT exist.

gdVerifyPathByIndices

public void gdVerifyPathByIndices(java.lang.String pathType,
                                  int preAscend,
                                  java.lang.String treePath,
                                  boolean exists)
Tests whether the given treePath exists or not

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
treePath - the path to check
exists - if true, the verify succeeds if the path DOES exist. If false, the verify succeeds if the path DOES NOT exist.

gdClick

public void gdClick(int count,
                    int button)
Clicks the tree. If the mouse pointer is in the tree no mouse move will be perfomed. Otherwise, the mouse is first moved to the center of the tree.

Overrides:
gdClick in class AbstractSwingImplClass
Parameters:
count - Number of mouse clicks
button - Pressed button

gdPopupByIndexPathAtSelectedNode

public void gdPopupByIndexPathAtSelectedNode(java.lang.String indexPath)
Deprecated. will be removed!

Shows a popup at the selected node and selects the item given by indexPath

Parameters:
indexPath - the index path

gdPopupByTextPathAtSelectedNode

public void gdPopupByTextPathAtSelectedNode(java.lang.String textPath)
Deprecated. will be removed!

Shows a popup at the selected node and selects the item given by indexPath

Parameters:
textPath - the path

gdPopupByIndexPathAtIndexNode

public void gdPopupByIndexPathAtIndexNode(java.lang.String treeIndexPath,
                                          java.lang.String popupIndexPath)
Deprecated. will be removed!

Shows a popup menu at the specified node and selects an item. The node and menuitem are given by an indexpath

Parameters:
treeIndexPath - path to the node
popupIndexPath - path to the menu item

gdPopupByTextPathAtIndexNode

public void gdPopupByTextPathAtIndexNode(java.lang.String treeIndexPath,
                                         java.lang.String popupTextPath)
Deprecated. will be removed!

Shows a popup menu at the specified node and selects an item. The node is given by an indexpath and the menuitem by a textpath

Parameters:
treeIndexPath - path to the node
popupTextPath - path to the menu item

gdPopupByIndexPathAtTextNode

public void gdPopupByIndexPathAtTextNode(java.lang.String treeTextPath,
                                         java.lang.String operator,
                                         java.lang.String popupIndexPath)
Deprecated. will be removed!

Shows a popup menu at the specified node and selects an item. The node is given by a treepath and the menuitem by an indexpath

Parameters:
treeTextPath - path to the node
operator - if the path uses regular expressions
popupIndexPath - path to the menu item

gdPopupByTextPathAtTextNode

public void gdPopupByTextPathAtTextNode(java.lang.String treeTextPath,
                                        java.lang.String operator,
                                        java.lang.String popupIndexPath)
Deprecated. will be removed!

Shows a popup menu at the specified node and selects an item. The node is given by a treepath and the menuitem by a treepath

Parameters:
treeTextPath - path to the node
operator - if the path uses regular expressions
popupIndexPath - path to the menu item

gdDragByTextPath

public void gdDragByTextPath(int mouseButton,
                             java.lang.String modifier,
                             java.lang.String pathType,
                             int preAscend,
                             java.lang.String treePath,
                             java.lang.String operator)
Drags the node of the given treePath.

Parameters:
mouseButton - the mouse button to press.
modifier - the modifier to press.
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
treePath - The tree path.
operator - If regular expressions are used to match the tree path

gdDropByTextPath

public void gdDropByTextPath(java.lang.String pathType,
                             int preAscend,
                             java.lang.String treePath,
                             java.lang.String operator,
                             int delayBeforeDrop)
Drops the before dragged object on the given treePath.

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
treePath - The tree path.
operator - If regular expressions are used to match the tree path
delayBeforeDrop - the amount of time (in milliseconds) to wait between moving the mouse to the drop point and releasing the mouse button

gdDragByIndexPath

public void gdDragByIndexPath(int mouseButton,
                              java.lang.String modifier,
                              java.lang.String pathType,
                              int preAscend,
                              java.lang.String indexPath)
Drags the node of the given indexPath.

Parameters:
mouseButton - the mouse button to press.
modifier - the modifier to press.
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
indexPath - The index path.

gdDropByIndexPath

public void gdDropByIndexPath(java.lang.String pathType,
                              int preAscend,
                              java.lang.String indexPath,
                              int delayBeforeDrop)
Drops the before dragged object on the given indexPath.

Parameters:
pathType - whether the path is relative or absolute
preAscend - Relative traversals will start this many parent nodes above the current node. Absolute traversals ignore this parameter.
indexPath - The index path.
delayBeforeDrop - the amount of time (in milliseconds) to wait between moving the mouse to the drop point and releasing the mouse button

getTextArrayFromComponent

public java.lang.String[] getTextArrayFromComponent()
Returns a descriptive text array that represents the given gui component.
Descriptive texts can be received for example from buttons, labels and table headers. If text is obviously data (for example in text input components) then it is not considered a descriptive text.
If the component has no descriptive text then null, an empty array or an array with length one and null or an empty string as content has to be returned.

Returns:
array containing none, one or many texts representing the
gui component or null

getText

protected java.lang.String getText()
Description copied from class: AbstractSwingImplClass
Get a String representation of the "text" of the component. This String is used in all compare actions and all other places where a simple "as text" view is needed. This has to be replaced either with simple getText() calls on the components or by calls to the cell (or other) renderers of the component using getRenderedText()

Specified by:
getText in class AbstractSwingImplClass
Returns:
always null
See Also:
AbstractSwingImplClass.getText()

gdVerifyTextAtMousePosition

public void gdVerifyTextAtMousePosition(java.lang.String pattern,
                                        java.lang.String operator)


gdStoreSelectedNodeValue

public java.lang.String gdStoreSelectedNodeValue(java.lang.String variable)


gdStoreValueAtMousePosition

public java.lang.String gdStoreValueAtMousePosition(java.lang.String variable)