org.fest.swing.fixture
Class JScrollPaneFixture

java.lang.Object
  extended by org.fest.swing.fixture.ComponentFixture<JScrollPane>
      extended by org.fest.swing.fixture.JScrollPaneFixture
All Implemented Interfaces:
ClientPropertyStorageFixture, CommonComponentFixture, FocusableComponentFixture, JComponentFixture, JPopupMenuInvokerFixture, KeyboardInputSimulationFixture, MouseInputSimulationFixture, StateVerificationFixture, ToolTipDisplayFixture

public class JScrollPaneFixture
extends ComponentFixture<JScrollPane>
implements CommonComponentFixture, JPopupMenuInvokerFixture, JComponentFixture

Understands functional testing of JScrollPanes:

Author:
Yvonne Wang, Alex Ruiz

Field Summary
 
Fields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
 
Constructor Summary
JScrollPaneFixture(Robot robot, JScrollPane target)
          Creates a new JScrollPaneFixture.
JScrollPaneFixture(Robot robot, String panelName)
          Creates a new JScrollPaneFixture.
 
Method Summary
 JScrollPaneFixture click()
          Simulates a user clicking this fixture's JScrollPane.
 JScrollPaneFixture click(MouseButton button)
          Simulates a user clicking this fixture's JScrollPane.
 JScrollPaneFixture click(MouseClickInfo mouseClickInfo)
          Simulates a user clicking this fixture's JScrollPane.
 Object clientProperty(Object key)
          Returns the client property stored in this fixture's JScrollPane, under the given key.
 JScrollPaneFixture doubleClick()
          Simulates a user double-clicking this fixture's JScrollPane.
protected  void driver(JScrollPaneDriver newDriver)
          Sets the JScrollPaneDriver to be used by this fixture.
 JScrollPaneFixture focus()
          Gives input focus to this fixture's JScrollPane.
 JScrollBarFixture horizontalScrollBar()
          Returns a JScrollBarFixture managing the horizontal JScrollBar of this target's JScrollPane.
 JScrollPaneFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
          Simulates a user pressing given key with the given modifiers on this fixture's JScrollPane.
 JScrollPaneFixture pressAndReleaseKeys(int... keyCodes)
          Simulates a user pressing and releasing the given keys on the JScrollPane managed by this fixture.
 JScrollPaneFixture pressKey(int keyCode)
          Simulates a user pressing the given key on this fixture's JScrollPane.
 JScrollPaneFixture releaseKey(int keyCode)
          Simulates a user releasing the given key on this fixture's JScrollPane.
 JScrollPaneFixture requireDisabled()
          Asserts that this fixture's JScrollPane is disabled.
 JScrollPaneFixture requireEnabled()
          Asserts that this fixture's JScrollPane is enabled.
 JScrollPaneFixture requireEnabled(Timeout timeout)
          Asserts that this fixture's JScrollPane is enabled.
 JScrollPaneFixture requireFocused()
          Asserts that this fixture's JScrollPane has input focus.
 JScrollPaneFixture requireNotVisible()
          Asserts that this fixture's JScrollPane is not visible.
 JScrollPaneFixture requireToolTip(Pattern pattern)
          Asserts that the toolTip in this fixture's JScrollPane matches the given regular expression pattern.
 JScrollPaneFixture requireToolTip(String expected)
          Asserts that the toolTip in this fixture's JScrollPane matches the given value.
 JScrollPaneFixture requireVisible()
          Asserts that this fixture's JScrollPane is visible.
 JScrollPaneFixture rightClick()
          Simulates a user right-clicking this fixture's JScrollPane.
 JPopupMenuFixture showPopupMenu()
          Shows a pop-up menu using this fixture's JScrollPane as the invoker of the pop-up menu.
 JPopupMenuFixture showPopupMenuAt(Point p)
          Shows a pop-up menu at the given point using this fixture's JScrollPane as the invoker of the pop-up menu.
 JScrollBarFixture verticalScrollBar()
          Returns a JScrollBarFixture managing the vertical JScrollBar of this target's JScrollPane.
 
Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JScrollPaneFixture

public JScrollPaneFixture(Robot robot,
                          JScrollPane target)
Creates a new JScrollPaneFixture.

Parameters:
robot - performs simulation of user events on the given JScrollPane.
target - the JScrollPane to be managed by this fixture.
Throws:
NullPointerException - if robot is null.
IllegalArgumentException - if target is null.

JScrollPaneFixture

public JScrollPaneFixture(Robot robot,
                          String panelName)
Creates a new JScrollPaneFixture.

Parameters:
robot - performs simulation of user events on a JScrollPane.
panelName - the name of the JScrollPane to find using the given Robot.
Throws:
NullPointerException - if robot is null.
ComponentLookupException - if a matching JScrollPane could not be found.
ComponentLookupException - if more than one matching JScrollPane is found.
Method Detail

driver

protected final void driver(JScrollPaneDriver newDriver)
Sets the JScrollPaneDriver to be used by this fixture.

Parameters:
newDriver - the new JScrollPaneDriver.
Throws:
NullPointerException - if the given driver is null.

horizontalScrollBar

public JScrollBarFixture horizontalScrollBar()
Returns a JScrollBarFixture managing the horizontal JScrollBar of this target's JScrollPane.

Returns:
a fixture managing the horizontal JScrollBar of this target's JScrollPane.

verticalScrollBar

public JScrollBarFixture verticalScrollBar()
Returns a JScrollBarFixture managing the vertical JScrollBar of this target's JScrollPane.

Returns:
a fixture managing the vertical JScrollBar of this target's JScrollPane.

click

public JScrollPaneFixture click()
Simulates a user clicking this fixture's JScrollPane.

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

click

public JScrollPaneFixture click(MouseButton button)
Simulates a user clicking this fixture's JScrollPane.

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

click

public JScrollPaneFixture click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's JScrollPane.

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 this fixture's JScrollPane is disabled.
IllegalStateException - if this fixture's JScrollPane is not showing on the screen.

doubleClick

public JScrollPaneFixture doubleClick()
Simulates a user double-clicking this fixture's JScrollPane.

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

rightClick

public JScrollPaneFixture rightClick()
Simulates a user right-clicking this fixture's JScrollPane.

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

focus

public JScrollPaneFixture focus()
Gives input focus to this fixture's JScrollPane.

Specified by:
focus in interface FocusableComponentFixture
Returns:
this fixture.
Throws:
IllegalStateException - if this fixture's JScrollPane is disabled.
IllegalStateException - if this fixture's JScrollPane is not showing on the screen.

pressAndReleaseKey

public JScrollPaneFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's JScrollPane. Modifiers is a mask from the available InputEvent masks.

Specified by:
pressAndReleaseKey in interface KeyboardInputSimulationFixture
Parameters:
keyPressInfo - specifies the key and modifiers to press.
Returns:
this fixture.
Throws:
NullPointerException - if the given KeyPressInfo is null.
IllegalArgumentException - if the given code is not a valid key code.
IllegalStateException - if this fixture's JScrollPane is disabled.
IllegalStateException - if this fixture's JScrollPane is not showing on the screen.
See Also:
KeyPressInfo

pressAndReleaseKeys

public JScrollPaneFixture pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on the JScrollPane managed by this fixture.

Specified by:
pressAndReleaseKeys in interface KeyboardInputSimulationFixture
Parameters:
keyCodes - one or more codes of the keys to press.
Returns:
this fixture.
Throws:
NullPointerException - if the given array of codes is null.
IllegalArgumentException - if any of the given code is not a valid key code.
IllegalStateException - if this fixture's JScrollPane is disabled.
IllegalStateException - if this fixture's JScrollPane is not showing on the screen.
See Also:
KeyEvent

pressKey

public JScrollPaneFixture pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's JScrollPane.

Specified by:
pressKey in interface KeyboardInputSimulationFixture
Parameters:
keyCode - the code of the key to press.
Returns:
this fixture.
Throws:
IllegalArgumentException - if any of the given code is not a valid key code.
IllegalStateException - if this fixture's JScrollPane is disabled.
IllegalStateException - if this fixture's JScrollPane is not showing on the screen.
See Also:
KeyEvent

releaseKey

public JScrollPaneFixture releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's JScrollPane.

Specified by:
releaseKey in interface KeyboardInputSimulationFixture
Parameters:
keyCode - the code of the key to release.
Returns:
this fixture.
Throws:
IllegalArgumentException - if any of the given code is not a valid key code.
IllegalStateException - if this fixture's JScrollPane is disabled.
IllegalStateException - if this fixture's JScrollPane is not showing on the screen.
See Also:
KeyEvent

requireFocused

public JScrollPaneFixture requireFocused()
Asserts that this fixture's JScrollPane has input focus.

Specified by:
requireFocused in interface FocusableComponentFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JScrollPane does not have input focus.

requireEnabled

public JScrollPaneFixture requireEnabled()
Asserts that this fixture's JScrollPane is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JScrollPane is disabled.

requireEnabled

public JScrollPaneFixture requireEnabled(Timeout timeout)
Asserts that this fixture's JScrollPane is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Parameters:
timeout - the time this fixture will wait for the component to be enabled.
Returns:
this fixture.
Throws:
WaitTimedOutError - if this fixture's JScrollPane is never enabled.

requireDisabled

public JScrollPaneFixture requireDisabled()
Asserts that this fixture's JScrollPane is disabled.

Specified by:
requireDisabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JScrollPane is enabled.

requireVisible

public JScrollPaneFixture requireVisible()
Asserts that this fixture's JScrollPane is visible.

Specified by:
requireVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JScrollPane is not visible.

requireNotVisible

public JScrollPaneFixture requireNotVisible()
Asserts that this fixture's JScrollPane is not visible.

Specified by:
requireNotVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JScrollPane is visible.

requireToolTip

public JScrollPaneFixture requireToolTip(String expected)
Asserts that the toolTip in this fixture's JScrollPane matches the given value.

Specified by:
requireToolTip in interface ToolTipDisplayFixture
Parameters:
expected - the given value. It can be a regular expression.
Returns:
this fixture.
Throws:
AssertionError - if the toolTip in this fixture's JScrollPane does not match the given value.
Since:
1.2

requireToolTip

public JScrollPaneFixture requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's JScrollPane matches the given regular expression pattern.

Specified by:
requireToolTip in interface ToolTipDisplayFixture
Parameters:
pattern - the regular expression pattern to match.
Returns:
this fixture.
Throws:
NullPointerException - if the given regular expression pattern is null.
AssertionError - if the toolTip in this fixture's JScrollPane does not match the given regular expression.
Since:
1.2

clientProperty

public Object clientProperty(Object key)
Returns the client property stored in this fixture's JScrollPane, under the given key.

Specified by:
clientProperty in interface ClientPropertyStorageFixture
Parameters:
key - the key to use to retrieve the client property.
Returns:
the value of the client property stored under the given key, or null if the property was not found.
Throws:
NullPointerException - if the given key is null.
Since:
1.2

showPopupMenu

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

Specified by:
showPopupMenu in interface JPopupMenuInvokerFixture
Returns:
a fixture that manages the displayed pop-up menu.
Throws:
IllegalStateException - if this fixture's JScrollPane is disabled.
IllegalStateException - if this fixture's JScrollPane is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.

showPopupMenuAt

public JPopupMenuFixture showPopupMenuAt(Point p)
Shows a pop-up menu at the given point using this fixture's JScrollPane as the invoker of the pop-up menu.

Specified by:
showPopupMenuAt in interface JPopupMenuInvokerFixture
Parameters:
p - the given point where to show the pop-up menu.
Returns:
a fixture that manages the displayed pop-up menu.
Throws:
IllegalStateException - if this fixture's JScrollPane is disabled.
IllegalStateException - if this fixture's JScrollPane is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.


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