Class AbstractScrollDriver
- java.lang.Object
-
- org.netbeans.jemmy.drivers.LightSupportiveDriver
-
- org.netbeans.jemmy.drivers.scrolling.AbstractScrollDriver
-
- All Implemented Interfaces:
LightDriver
,ScrollDriver
- Direct Known Subclasses:
AWTScrollDriver
,JScrollBarAPIDriver
,JScrollBarDriver
,JSliderAPIDriver
,JSliderDriver
public abstract class AbstractScrollDriver extends LightSupportiveDriver implements ScrollDriver
Superclass for all scroll drivers. Contains all the logic of scrolling. Tryes allowed operations in this order: "jump", "drag'n'drop", "push'n'wait", "step". Repeats "step" scrolling while scroller value is not equal to the necessary value, but no more thanADJUST_CLICK_COUNT
.- Author:
- Alexandre Iline(alexandre.iline@sun.com)
-
-
Field Summary
Fields Modifier and Type Field Description static int
ADJUST_CLICK_COUNT
Maximal number of attemps to reach required position by minimal scrolling operation.
-
Constructor Summary
Constructors Constructor Description AbstractScrollDriver(java.lang.String[] supported)
Constructs an AbstractScrollDriver.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
canDragAndDrop(ComponentOperator oper)
Tells if this driver allows to perform drag'n'drop scrolling.protected abstract boolean
canJump(ComponentOperator oper)
Tells if this driver allows to perform jumps.protected abstract boolean
canPushAndWait(ComponentOperator oper)
Tells if this driver allows to perform "push and wait" scrolling.protected void
doDragAndDrop(ComponentOperator oper, ScrollAdjuster adj)
Performs drag'n'drop scrolling till scroller's value does not cross required value.protected void
doJumps(ComponentOperator oper, ScrollAdjuster adj)
Performs jump scrolling till scroller's value does not cross required value.protected void
doPushAndWait(ComponentOperator oper, ScrollAdjuster adj)
Performs "push and wait" scrolling till scroller's value does not cross required value.protected void
doSteps(ComponentOperator oper, ScrollAdjuster adj)
Performs minimal scrollings till scroller's value does not cross required value.protected abstract void
drag(ComponentOperator oper, java.awt.Point pnt)
Drag to a specified point.protected abstract void
drop(ComponentOperator oper, java.awt.Point pnt)
Drop at a specified point.protected abstract int
getDragAndDropStepLength(ComponentOperator oper)
Returns a number of pixels in one drag and drop scrolling.protected abstract Timeout
getScrollDeltaTimeout(ComponentOperator oper)
Returns a timeout for sleeping between verifications during "push and wait" scrolling.protected abstract void
jump(ComponentOperator oper, ScrollAdjuster adj)
Performs maximal scroll step.void
scroll(ComponentOperator oper, ScrollAdjuster adj)
Changes value.protected abstract java.awt.Point
startDragging(ComponentOperator oper)
Starts drag'n'drop scrolling.protected abstract void
startPushAndWait(ComponentOperator oper, int direction, int orientation)
Presses something like a scroll button.protected abstract void
step(ComponentOperator oper, ScrollAdjuster adj)
Performs minimal scrolling step.protected abstract void
stopPushAndWait(ComponentOperator oper, int direction, int orientation)
Releases something like a scroll button.-
Methods inherited from class org.netbeans.jemmy.drivers.LightSupportiveDriver
checkSupported, getSupported
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.netbeans.jemmy.drivers.ScrollDriver
scrollToMaximum, scrollToMinimum
-
-
-
-
Field Detail
-
ADJUST_CLICK_COUNT
public static final int ADJUST_CLICK_COUNT
Maximal number of attemps to reach required position by minimal scrolling operation.- See Also:
- Constant Field Values
-
-
Method Detail
-
scroll
public void scroll(ComponentOperator oper, ScrollAdjuster adj)
Description copied from interface:ScrollDriver
Changes value.- Specified by:
scroll
in interfaceScrollDriver
- Parameters:
oper
- Scroller operator.adj
- Object defines scroll position.
-
step
protected abstract void step(ComponentOperator oper, ScrollAdjuster adj)
Performs minimal scrolling step.- Parameters:
oper
- an operator.adj
- a scroll adjuster
-
jump
protected abstract void jump(ComponentOperator oper, ScrollAdjuster adj)
Performs maximal scroll step.- Parameters:
oper
- an operator.adj
- a scroll adjuster
-
startPushAndWait
protected abstract void startPushAndWait(ComponentOperator oper, int direction, int orientation)
Presses something like a scroll button.- Parameters:
oper
- an operator.direction
- - one of the ScrollAdjister.INCREASE_SCROLL_DIRECTION, ScrollAdjister.DECREASE_SCROLL_DIRECTION, ScrollAdjister.DO_NOT_TOUCH_SCROLL_DIRECTION values.orientation
- one of the Adjustable.HORIZONTAL or Adjustable.VERTICAL values.
-
stopPushAndWait
protected abstract void stopPushAndWait(ComponentOperator oper, int direction, int orientation)
Releases something like a scroll button.- Parameters:
oper
- an operator.direction
- - one of the ScrollAdjister.INCREASE_SCROLL_DIRECTION, ScrollAdjister.DECREASE_SCROLL_DIRECTION, ScrollAdjister.DO_NOT_TOUCH_SCROLL_DIRECTION values.orientation
- one of the Adjustable.HORIZONTAL or Adjustable.VERTICAL values.
-
startDragging
protected abstract java.awt.Point startDragging(ComponentOperator oper)
Starts drag'n'drop scrolling.- Parameters:
oper
- an operator.- Returns:
- start drigging point.
-
drop
protected abstract void drop(ComponentOperator oper, java.awt.Point pnt)
Drop at a specified point.- Parameters:
oper
- an operator.pnt
- the point to drop.
-
drag
protected abstract void drag(ComponentOperator oper, java.awt.Point pnt)
Drag to a specified point.- Parameters:
oper
- an operator.pnt
- the point to drag to.
-
getScrollDeltaTimeout
protected abstract Timeout getScrollDeltaTimeout(ComponentOperator oper)
Returns a timeout for sleeping between verifications during "push and wait" scrolling.- Parameters:
oper
- an operator.- Returns:
- a timeout
-
canDragAndDrop
protected abstract boolean canDragAndDrop(ComponentOperator oper)
Tells if this driver allows to perform drag'n'drop scrolling.- Parameters:
oper
- an operator.- Returns:
- true if this driver allows to drag'n'drop.
-
canJump
protected abstract boolean canJump(ComponentOperator oper)
Tells if this driver allows to perform jumps.- Parameters:
oper
- an operator.- Returns:
- true if this driver allows to jump.
-
canPushAndWait
protected abstract boolean canPushAndWait(ComponentOperator oper)
Tells if this driver allows to perform "push and wait" scrolling.- Parameters:
oper
- an operator.- Returns:
- true if this driver allows to "push and wait".
-
getDragAndDropStepLength
protected abstract int getDragAndDropStepLength(ComponentOperator oper)
Returns a number of pixels in one drag and drop scrolling.- Parameters:
oper
- an operator.- Returns:
- drag'n'drop step length.
-
doDragAndDrop
protected void doDragAndDrop(ComponentOperator oper, ScrollAdjuster adj)
Performs drag'n'drop scrolling till scroller's value does not cross required value.- Parameters:
oper
- an operator.adj
- a scroll adjuster
-
doJumps
protected void doJumps(ComponentOperator oper, ScrollAdjuster adj)
Performs jump scrolling till scroller's value does not cross required value.- Parameters:
oper
- an operator.adj
- a scroll adjuster
-
doPushAndWait
protected void doPushAndWait(ComponentOperator oper, ScrollAdjuster adj)
Performs "push and wait" scrolling till scroller's value does not cross required value.- Parameters:
oper
- an operator.adj
- a scroll adjuster
-
doSteps
protected void doSteps(ComponentOperator oper, ScrollAdjuster adj)
Performs minimal scrollings till scroller's value does not cross required value.- Parameters:
oper
- an operator.adj
- a scroll adjuster
-
-