org.fest.swing.fixture
Class JTreePathFixture

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

public class JTreePathFixture
extends Object
implements JTreeNodeFixture

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

Since:
1.2
Author:
Alex Ruiz

Constructor Summary
protected JTreePathFixture(JTreeFixture tree, String path)
          Creates a new JTreePathFixture.
 
Method Summary
 JTreePathFixture click()
          Simulates a user clicking this fixture's tree node.
 JTreePathFixture click(MouseButton button)
          Simulates a user clicking this fixture's tree node.
 JTreePathFixture click(MouseClickInfo mouseClickInfo)
          Simulates a user clicking this fixture's tree node.
 JTreePathFixture collapse()
          Simulates a user collapsing this fixture's tree node.
 JTreePathFixture doubleClick()
          Simulates a user double-clicking this fixture's tree node.
 JTreePathFixture drag()
          Simulates a user dragging this fixture's tree node.
 JTreePathFixture drop()
          Simulates a user dropping relative to this fixture's tree node.
 JTreePathFixture expand()
          Simulates a user expanding this fixture's tree node.
 String path()
          Returns the path of this fixture's node.
 JTreePathFixture rightClick()
          Simulates a user right-clicking this fixture's tree node.
 JTreePathFixture 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

JTreePathFixture

protected JTreePathFixture(JTreeFixture tree,
                           String path)
Creates a new JTreePathFixture.

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

expand

public JTreePathFixture 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 path.
Since:
1.2

collapse

public JTreePathFixture 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 path.
Since:
1.2

select

public JTreePathFixture 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 JTreePathFixture 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 JTreePathFixture 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 JTreePathFixture 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 JTreePathFixture 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 JTreePathFixture 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 JTreePathFixture 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 JTreePathFixture 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.

path

public String path()
Returns the path of this fixture's node.

Returns:
the path of this fixture's node.


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