Package org.fest.swing.fixture
Class JTreeRowFixture
java.lang.Object
org.fest.swing.fixture.JTreeRowFixture
- All Implemented Interfaces:
ItemFixture
,JTreeNodeFixture
,MouseInputSimulationFixture
Understands functional testing of single nodes, referenced by their row indices, in
JTree
s:
- user input simulation
- state verification
- property value query
- Since:
- 1.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JTreeRowFixture
(JTreeFixture tree, int index) Creates a newJTreeRowFixture
. -
Method Summary
Modifier and TypeMethodDescriptionclick()
Simulates a user clicking this fixture's tree node.click
(MouseButton button) Simulates a user clicking this fixture's tree node.click
(MouseClickInfo mouseClickInfo) Simulates a user clicking this fixture's tree node.collapse()
Simulates a user collapsing this fixture's tree node.Simulates a user double-clicking this fixture's tree node.drag()
Simulates a user dragging this fixture's tree node.drop()
Simulates a user dropping relative to this fixture's tree node.expand()
Simulates a user expanding this fixture's tree node.int
index()
Returns the row index of the node.Simulates a user right-clicking this fixture's tree node.select()
Selects the this fixture's tree node, expanding parent nodes if necessary.Shows a pop-up menu using this fixture's tree node as the invoker of the pop-up menu.value()
Returns theString
representation of this fixture's tree node.
-
Field Details
-
index
private final int index -
tree
-
-
Constructor Details
-
JTreeRowFixture
Creates a newJTreeRowFixture
.- Parameters:
tree
- handles theJTree
containing the node with the given row index.index
- the given row index.
-
-
Method Details
-
expand
Simulates a user expanding this fixture's tree node.- Specified by:
expand
in interfaceJTreeNodeFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.ActionFailedException
- if this method fails to expand the row.
-
collapse
Simulates a user collapsing this fixture's tree node.- Specified by:
collapse
in interfaceJTreeNodeFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.ActionFailedException
- if this method fails to collapse the row.
-
select
Selects the this fixture's tree node, expanding parent nodes if necessary. This method will not click the node if it is already selected.- Specified by:
select
in interfaceItemFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if this fixture'sJTree
is disabled.IllegalStateException
- if this fixture'sJTree
is not showing on the screen.
-
click
Simulates a user clicking this fixture's tree node.- Specified by:
click
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.
-
click
Simulates a user clicking this fixture's tree node.- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
button
- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given button isnull
.IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.
-
click
Simulates a user clicking this fixture's tree node.- Specified by:
click
in interfaceMouseInputSimulationFixture
- Parameters:
mouseClickInfo
- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the givenMouseClickInfo
isnull
.IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's tree node.- Specified by:
doubleClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's tree node.- Specified by:
rightClick
in interfaceMouseInputSimulationFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.
-
drag
Simulates a user dragging this fixture's tree node.- Specified by:
drag
in interfaceItemFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.
-
drop
Simulates a user dropping relative to this fixture's tree node.- Specified by:
drop
in interfaceItemFixture
- Returns:
- this fixture.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.ActionFailedException
- if there is no drag action in effect.
-
showPopupMenu
Shows a pop-up menu using this fixture's tree node as the invoker of the pop-up menu.- Specified by:
showPopupMenu
in interfaceItemFixture
- Returns:
- a fixture that handles functional testing of the displayed pop-up menu.
- Throws:
IllegalStateException
- if theJTree
is disabled.IllegalStateException
- if theJTree
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.
-
value
Returns theString
representation of this fixture's tree node.- Specified by:
value
in interfaceItemFixture
- Returns:
- the
String
representation of this fixture's tree node.
-
index
public int index()Returns the row index of the node.- Returns:
- the row index of the node.
-