org.uispec4j
Class Slider

java.lang.Object
  extended by org.uispec4j.AbstractUIComponent
      extended by org.uispec4j.Slider
All Implemented Interfaces:
UIComponent

public class Slider
extends AbstractUIComponent

Wrapper for JSlider components.

This class provides means for checking the contents and the current position of the knob, changing the position, etc.


Field Summary
static java.lang.Class[] SWING_CLASSES
           
static java.lang.String TYPE_NAME
           
 
Constructor Summary
Slider(javax.swing.JSlider jSlider)
           
 
Method Summary
 javax.swing.JSlider getAwtComponent()
          Returns the Java GUI component represented by this object.
 java.lang.String getDescriptionTypeName()
          Returns the name of the component as it will appear in the XML representation returned by UIComponent.getDescription().
 Assertion labelsEqual(java.lang.String... expected)
          Checks the slider labels in order.
 Assertion positionEquals(java.lang.String expectedLabel)
          Checks that the current position corresponds to the specified label
 Assertion relativePositionEquals(int expectedValue)
          Checks the knob position as a percentage (0-100) of the available range.
 void setPosition(java.lang.String label)
          Moves the knob at the specified label position
 void setPrecision(int value)
          Sets the precision for the relative position check.
 void setRelativePosition(int percentage)
          Sets the knob position as a percentage (0-100) of the available range.
 
Methods inherited from class org.uispec4j.AbstractUIComponent
addAttributes, backgroundEquals, backgroundNear, foregroundEquals, foregroundNear, getContainer, getContainer, getDescription, getDescription, getLabel, getName, getSubDescription, isEnabled, isVisible, pressKey, releaseKey, typeKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_NAME

public static final java.lang.String TYPE_NAME
See Also:
Constant Field Values

SWING_CLASSES

public static final java.lang.Class[] SWING_CLASSES
Constructor Detail

Slider

public Slider(javax.swing.JSlider jSlider)
Method Detail

getAwtComponent

public javax.swing.JSlider getAwtComponent()
Description copied from interface: UIComponent
Returns the Java GUI component represented by this object.


getDescriptionTypeName

public java.lang.String getDescriptionTypeName()
Description copied from interface: UIComponent
Returns the name of the component as it will appear in the XML representation returned by UIComponent.getDescription().


labelsEqual

public Assertion labelsEqual(java.lang.String... expected)
Checks the slider labels in order.


setPosition

public void setPosition(java.lang.String label)
                 throws ItemNotFoundException
Moves the knob at the specified label position

Throws:
ItemNotFoundException

positionEquals

public Assertion positionEquals(java.lang.String expectedLabel)
Checks that the current position corresponds to the specified label


relativePositionEquals

public Assertion relativePositionEquals(int expectedValue)
Checks the knob position as a percentage (0-100) of the available range. The actual position must be equal to the given value plus or minus the slider precision.

Parameters:
expectedValue - an int between 0 and 100, or -1 if the status is undeterminate
See Also:
setPrecision(int)

setRelativePosition

public void setRelativePosition(int percentage)
Sets the knob position as a percentage (0-100) of the available range.

Parameters:
percentage - an int between 0 and 100

setPrecision

public void setPrecision(int value)
Sets the precision for the relative position check. This precision is the greatest difference allowed between the actual and expected position values (both are integers between 0 and 100).

The default precision is 2.

See Also:
relativePositionEquals(int)


Copyright © 2004-2010. All Rights Reserved.