org.fest.swing.fixture
Class JTreeRowFixture

java.lang.Object
  extended by org.fest.swing.fixture.JTreeRowFixture
All Implemented Interfaces:
ItemFixture, JTreeNodeFixture, MouseInputSimulationFixture

public class JTreeRowFixture
extends Object
implements JTreeNodeFixture

Understands functional testing of single nodes, referenced by their row indices, in JTrees:

Since:
1.2
Author:
Alex Ruiz

Constructor Summary
protected JTreeRowFixture(JTreeFixture tree, int index)
          Creates a new JTreeRowFixture.
 
Method Summary
 JTreeRowFixture click()
          Simulates a user clicking this fixture's tree node.
 JTreeRowFixture click(MouseButton button)
          Simulates a user clicking this fixture's tree node.
 JTreeRowFixture click(MouseClickInfo mouseClickInfo)
          Simulates a user clicking this fixture's tree node.
 JTreeRowFixture collapse()
          Simulates a user collapsing this fixture's tree node.
 JTreeRowFixture doubleClick()
          Simulates a user double-clicking this fixture's tree node.
 JTreeRowFixture drag()
          Simulates a user dragging this fixture's tree node.
 JTreeRowFixture drop()
          Simulates a user dropping relative to this fixture's tree node.
 JTreeRowFixture expand()
          Simulates a user expanding this fixture's tree node.
 int index()
          Returns the row index of the node.
 JTreeRowFixture rightClick()
          Simulates a user right-clicking this fixture's tree node.
 JTreeRowFixture select()
          Selects the this fixture's tree node, expanding parent nodes if necessary.
 JPopupMenuFixture showPopupMenu()
          Shows a pop-up menu using this fixture's tree node as the invoker of the pop-up menu.
 String value()
          Returns the String representation of this fixture's tree node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTreeRowFixture

protected JTreeRowFixture(JTreeFixture tree,
                          int index)
Creates a new JTreeRowFixture.

Parameters:
tree - handles the JTree containing the node with the given row index.
index - the given row index.
Method Detail

expand

public JTreeRowFixture expand()
Simulates a user expanding this fixture's tree node.

Specified by:
expand in interface JTreeNodeFixture
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.
ActionFailedException - if this method fails to expand the row.

collapse

public JTreeRowFixture collapse()
Simulates a user collapsing this fixture's tree node.

Specified by:
collapse in interface JTreeNodeFixture
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.
ActionFailedException - if this method fails to collapse the row.

select

public JTreeRowFixture 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 interface ItemFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JTree is disabled.
IllegalStateException - if this fixture's JTree is not showing on the screen.

click

public JTreeRowFixture click()
Simulates a user clicking this fixture's tree node.

Specified by:
click in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.

click

public JTreeRowFixture click(MouseButton button)
Simulates a user clicking this fixture's tree node.

Specified by:
click in interface MouseInputSimulationFixture
Parameters:
button - the button to click.
Returns:
this fixture.
Throws:
NullPointerException - if the given button is null.
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.

click

public JTreeRowFixture click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's tree node.

Specified by:
click in interface MouseInputSimulationFixture
Parameters:
mouseClickInfo - specifies the button to click and the times the button should be clicked.
Returns:
this fixture.
Throws:
NullPointerException - if the given MouseClickInfo is null.
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.

doubleClick

public JTreeRowFixture doubleClick()
Simulates a user double-clicking this fixture's tree node.

Specified by:
doubleClick in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.

rightClick

public JTreeRowFixture rightClick()
Simulates a user right-clicking this fixture's tree node.

Specified by:
rightClick in interface MouseInputSimulationFixture
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.

drag

public JTreeRowFixture drag()
Simulates a user dragging this fixture's tree node.

Specified by:
drag in interface ItemFixture
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.

drop

public JTreeRowFixture drop()
Simulates a user dropping relative to this fixture's tree node.

Specified by:
drop in interface ItemFixture
Returns:
this fixture.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.
ActionFailedException - if there is no drag action in effect.

showPopupMenu

public JPopupMenuFixture showPopupMenu()
Shows a pop-up menu using this fixture's tree node as the invoker of the pop-up menu.

Specified by:
showPopupMenu in interface ItemFixture
Returns:
a fixture that handles functional testing of the displayed pop-up menu.
Throws:
IllegalStateException - if the JTree is disabled.
IllegalStateException - if the JTree is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.

value

public String value()
Returns the String representation of this fixture's tree node.

Specified by:
value in interface ItemFixture
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.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.