|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
org.eclipse.jubula.rc.swing.swing.implclasses.TreeOperationContext
public class TreeOperationContext
This context holds the tree, the tree model and supports access to the Robot. It also implements some general operations on trees.
Constructor Summary | |
---|---|
TreeOperationContext(org.eclipse.jubula.rc.common.driver.IEventThreadQueuer queuer,
org.eclipse.jubula.rc.common.driver.IRobot robot,
javax.swing.JTree tree)
Creates a new instance. |
Method Summary | |
---|---|
void |
clickNode(java.lang.Object node,
org.eclipse.jubula.rc.common.driver.ClickOptions clickOps)
Move the mouse pointer directly over the given node's onscreen location and perform a mouse click. |
void |
collapseNode(java.lang.Object node)
Collapses the given node. |
protected java.lang.String[] |
convertTreePathToText(java.lang.Object treePath)
Calls JTree.convertValueToText(java.lang.Object, boolean, boolean, boolean, int, boolean)
on any tree node of the treePath and returns the texts as an array. |
protected java.lang.String |
convertValueToText(java.lang.Object node,
int row)
Calls JTree.convertValueToText(java.lang.Object, boolean, boolean, boolean, int, boolean)
on the passed JTree. |
void |
expandNode(java.lang.Object node)
Expands the given node. |
java.lang.Object |
getChild(java.lang.Object parent,
int index)
|
java.lang.Object[] |
getChildren(java.lang.Object parent)
|
java.lang.ClassLoader |
getClassLoaderForTree()
|
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
|
protected javax.swing.tree.TreeModel |
getModel()
Getter for the model |
java.awt.Rectangle |
getNodeBounds(java.lang.Object node)
|
java.util.Collection |
getNodeTextList(java.lang.Object node)
Returns the result of toString on the node value and, if
it can be obtained, the rendered value. |
int |
getNumberOfChildren(java.lang.Object parent)
|
java.lang.Object |
getParent(java.lang.Object child)
|
java.lang.String |
getRenderedText(java.lang.Object node)
Returns the rendered text for the given node. |
java.lang.Object[] |
getRootNodes()
|
protected int |
getRowForTreeNode(java.lang.Object node)
Returns the row for the given node. |
java.lang.Object |
getSelectedNode()
|
protected java.lang.Object[] |
getSelectionPaths()
Returns the path of all selected values. |
java.awt.Rectangle |
getVisibleRowBounds(java.awt.Rectangle rowBounds)
Computes the visible rowBounds inside the visible bounds of the tree. The result is the intersection of the visible bounds of the tree and the rowBounds of the node. |
boolean |
isExpanded(java.lang.Object node)
|
boolean |
isVisible(java.lang.Object node)
Returns true if the node is visible |
void |
scrollNodeToVisible(java.lang.Object node)
Scrolls the Tree's container, if necessary, in order to ensure that the given node is viewable. |
Methods inherited from class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext |
---|
getQueuer, getRobot, getTree |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TreeOperationContext(org.eclipse.jubula.rc.common.driver.IEventThreadQueuer queuer, org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JTree tree)
queuer
- The queuerrobot
- The Robottree
- The treeMethod Detail |
---|
public java.lang.Object[] getChildren(java.lang.Object parent)
getChildren
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
parent
- The parent node. Can be null
.
Array
containing all child nodes of
parent
, or all root nodes if parent
is
null
.public java.util.Collection getNodeTextList(java.lang.Object node)
toString
on the node value and, if
it can be obtained, the rendered value. Consider using
AbstractTreeOperationContext.getRenderedText(Object)
instead if only the rendered text is
needed.
getNodeTextList
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- the node
public int getNumberOfChildren(java.lang.Object parent)
getNumberOfChildren
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
parent
- The parent node. Can be null
.
parent
, or the number
of graphical root nodes if parent == null
.protected java.lang.String convertValueToText(java.lang.Object node, int row) throws org.eclipse.jubula.rc.common.exception.StepExecutionException
JTree.convertValueToText(java.lang.Object, boolean, boolean, boolean, int, boolean)
on the passed JTree.
convertValueToText
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- The node.row
- The node row.
org.eclipse.jubula.rc.common.exception.StepExecutionException
- If the method call fails.public java.lang.String getRenderedText(java.lang.Object node) throws org.eclipse.jubula.rc.common.exception.StepExecutionException
getRenderedText
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- The tree node for which to get the rendered text.
null
if
the given node does not have rendered text or if the rendered
text cannot be determined.
org.eclipse.jubula.rc.common.exception.StepExecutionException
- If the method call fails (for example,
if the given node could not be found).protected java.lang.String[] convertTreePathToText(java.lang.Object treePath)
JTree.convertValueToText(java.lang.Object, boolean, boolean, boolean, int, boolean)
on any tree node of the treePath
and returns the texts as an array.
treePath
- The tree path
protected int getRowForTreeNode(java.lang.Object node) throws org.eclipse.jubula.rc.common.exception.StepExecutionException
node
- The node for which to find the row.
org.eclipse.jubula.rc.common.exception.StepExecutionException
- if the node cannot be found.public java.awt.Rectangle getNodeBounds(java.lang.Object node) throws org.eclipse.jubula.rc.common.exception.StepExecutionException
getNodeBounds
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- The node for which to find the bounds.
java.awt.Rectangle
.
org.eclipse.jubula.rc.common.exception.StepExecutionException
protected java.lang.Object[] getSelectionPaths()
public boolean isVisible(java.lang.Object node)
true
if the node is visible
isVisible
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- a node
protected javax.swing.tree.TreeModel getModel()
public java.awt.Rectangle getVisibleRowBounds(java.awt.Rectangle rowBounds)
getVisibleRowBounds
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
rowBounds
- the rowBounds of the node to click in. These bounds must
be relative to the tree's location.
public java.lang.ClassLoader getClassLoaderForTree()
getClassLoaderForTree
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
public void collapseNode(java.lang.Object node)
collapseNode
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- The nodepublic void expandNode(java.lang.Object node)
expandNode
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- The nodepublic java.lang.Object[] getRootNodes()
getRootNodes
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
public void scrollNodeToVisible(java.lang.Object node)
scrollNodeToVisible
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- The nodepublic java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
parent
- The parent node. Can be null
.index
- The index for the child node.
parent
with index index
in the parent
's child node list.
If parent
is null
, then the nth
graphical root node will be returned, where n is equal
to index
(i.e. when index == 0
, the
topmost root node will be returned).public java.lang.Object getParent(java.lang.Object child)
getParent
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
child
- The child node.
null
if the
node is a graphical root node.public boolean isExpanded(java.lang.Object node)
isExpanded
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- The node
true
if the given node is currently expanded.
Otherwise, false
.public void clickNode(java.lang.Object node, org.eclipse.jubula.rc.common.driver.ClickOptions clickOps)
clickNode
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
node
- The nodeclickOps
- The click optionspublic java.lang.Object getSelectedNode()
getSelectedNode
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in class org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContext
parent
- The parent node, can be null
child
- The child node
child
in the given
parent
's child node list, or -1 if child
is not a child of parent
. If parent
is
null
, then child
is assumed to be a root node,
and the returned index will be determined by the order in which the root
nodes are displayed (i.e. the topmost root node will have an index of 0).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |