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
JTrees:
- user input simulation
- state verification
- property value query
- Since:
- 1.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJTreeRowFixture(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.intindex()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 theStringrepresentation of this fixture's tree node.
-
Field Details
-
index
private final int index -
tree
-
-
Constructor Details
-
JTreeRowFixture
Creates a newJTreeRowFixture.- Parameters:
tree- handles theJTreecontaining 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:
expandin interfaceJTreeNodeFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis 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:
collapsein interfaceJTreeNodeFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis 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:
selectin interfaceItemFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if this fixture'sJTreeis disabled.IllegalStateException- if this fixture'sJTreeis not showing on the screen.
-
click
Simulates a user clicking this fixture's tree node.- Specified by:
clickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis not showing on the screen.
-
click
Simulates a user clicking this fixture's tree node.- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
button- the button to click.- Returns:
- this fixture.
- Throws:
NullPointerException- if the given button isnull.IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis not showing on the screen.
-
click
Simulates a user clicking this fixture's tree node.- Specified by:
clickin interfaceMouseInputSimulationFixture- Parameters:
mouseClickInfo- specifies the button to click and the times the button should be clicked.- Returns:
- this fixture.
- Throws:
NullPointerException- if the givenMouseClickInfoisnull.IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis not showing on the screen.
-
doubleClick
Simulates a user double-clicking this fixture's tree node.- Specified by:
doubleClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis not showing on the screen.
-
rightClick
Simulates a user right-clicking this fixture's tree node.- Specified by:
rightClickin interfaceMouseInputSimulationFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis not showing on the screen.
-
drag
Simulates a user dragging this fixture's tree node.- Specified by:
dragin interfaceItemFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis not showing on the screen.
-
drop
Simulates a user dropping relative to this fixture's tree node.- Specified by:
dropin interfaceItemFixture- Returns:
- this fixture.
- Throws:
IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis 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:
showPopupMenuin interfaceItemFixture- Returns:
- a fixture that handles functional testing of the displayed pop-up menu.
- Throws:
IllegalStateException- if theJTreeis disabled.IllegalStateException- if theJTreeis not showing on the screen.ComponentLookupException- if a pop-up menu cannot be found.
-
value
Returns theStringrepresentation of this fixture's tree node.- Specified by:
valuein interfaceItemFixture- Returns:
- the
Stringrepresentation of this fixture's tree node.
-
index
public int index()Returns the row index of the node.- Returns:
- the row index of the node.
-