public class WidgetOperator extends org.netbeans.jemmy.operators.Operator
Usage:
TopComponentOperator tco = new TopComponentOperator("My scene"); LabelWidgetOperator lwo0 = new LabelWidgetOperator(tco, "Label 0"); lwo0.performPopupAction("An action"); LabelWidgetOperator lwo1 = new LabelWidgetOperator(tco, "Label 1"); // drag from one widget to another lwo0.dragNDrop(lwo1);
Modifier and Type | Class and Description |
---|---|
static interface |
WidgetOperator.WidgetChooser
You can implement this interface if you want to find some specific widget
and then you can use it in WidgetOperator constructor.
|
org.netbeans.jemmy.operators.Operator.ComponentVisualizer, org.netbeans.jemmy.operators.Operator.DefaultPathParser, org.netbeans.jemmy.operators.Operator.DefaultStringComparator, org.netbeans.jemmy.operators.Operator.Finder, org.netbeans.jemmy.operators.Operator.MapAction, org.netbeans.jemmy.operators.Operator.MapBooleanAction, org.netbeans.jemmy.operators.Operator.MapByteAction, org.netbeans.jemmy.operators.Operator.MapCharacterAction, org.netbeans.jemmy.operators.Operator.MapDoubleAction, org.netbeans.jemmy.operators.Operator.MapFloatAction, org.netbeans.jemmy.operators.Operator.MapIntegerAction, org.netbeans.jemmy.operators.Operator.MapLongAction, org.netbeans.jemmy.operators.Operator.MapVoidAction, org.netbeans.jemmy.operators.Operator.NoBlockingAction, org.netbeans.jemmy.operators.Operator.PathParser, org.netbeans.jemmy.operators.Operator.StringComparator
Modifier and Type | Field and Description |
---|---|
protected Widget |
widget |
CLASS_DPROP, TO_STRING_DPROP
Constructor and Description |
---|
WidgetOperator(TopComponentOperator tco,
int index)
Waits for index-th Widget in given TopComponent.
|
WidgetOperator(TopComponentOperator tco,
WidgetOperator.WidgetChooser widgetChooser)
Waits for Widget specified by WidgetChooser implementation in given
TopComponent.
|
WidgetOperator(TopComponentOperator tco,
WidgetOperator.WidgetChooser widgetChooser,
int index)
Waits for index-th Widget specified by WidgetChooser implementation in
given TopComponent.
|
WidgetOperator(Widget widget)
Creates operator for given Widget.
|
WidgetOperator(WidgetOperator parentWidgetOper,
int index)
Waits for index-th Widget under given parent.
|
WidgetOperator(WidgetOperator parentWidgetOper,
WidgetOperator.WidgetChooser widgetChooser)
Waits for Widget specified by WidgetChooser implementation under given
parent.
|
WidgetOperator(WidgetOperator parentWidgetOper,
WidgetOperator.WidgetChooser widgetChooser,
int index)
Waits for index-th Widget specified by WidgetChooser implementation under
given parent.
|
Modifier and Type | Method and Description |
---|---|
void |
clickMouse(int clickCount)
Clicks mouse in the center of widget.
|
static WidgetOperator |
createOperator(Widget widget)
Creates WidgetOperator for given widget.
|
void |
dragNDrop(int relativeX,
int relativeY)
Drag from the center of this widget and drop at new position.
|
void |
dragNDrop(int x1,
int y1,
int x2,
int y2)
Drag from start coordinates and drop at end coordinates.
|
void |
dragNDrop(WidgetOperator widgetOperator)
Drag from the center widget and drop at the center of given widget.
|
static Widget |
findWidget(Widget parentWidget,
WidgetOperator.WidgetChooser widgetChooser,
int index)
Finds index-th widget specified by WidgetChooser under given parent
widget.
|
Rectangle |
getBounds()
Returns bounds occupied by widget.
|
Point |
getCenter()
Returns center of this widget in underlying view coordinates.
|
List<WidgetOperator> |
getChildren()
Returns List of WidgetOperators representing children of this Widget.
|
Point |
getLocation()
Returns relative location of this widget to its parent.
|
WidgetOperator |
getParent()
Returns WidgetOperator for parent Widget of this operator or null if
parent doesn't exist.
|
WidgetOperator |
getSceneOperator()
Returns operator for Scene widget which is parent of all other widgets.
|
Component |
getSource()
Returns underlying component which hosts this widget.
|
org.netbeans.jemmy.operators.JComponentOperator |
getViewOperator()
Returns operator of underlying component which hosts this widget.
|
Widget |
getWidget()
Returns Widget represented by this operator.
|
void |
performPopupAction(String popupPath)
Performs popup action on this widget.
|
void |
performPopupActionNoBlock(String popupPath)
Performs popup action on this widget and no block further execution.
|
void |
printDump()
Prints information about this widget and its children.
|
String |
toString()
Returns class name of this widget, its location and bounds.
|
addOperatorPackage, addToDump, addToDump, copyEnvironment, createOperator, getCharBindingMap, getCharKey, getCharModifiers, getCharsKeys, getCharsKeys, getCharsModifiers, getCharsModifiers, getComparator, getDefaultComponentVisualizer, getDefaultMouseButton, getDefaultPathParser, getDefaultStringComparator, getDefaultVerification, getDump, getEnvironmentOperator, getOutput, getParentPath, getParentPath, getPathParser, getPopupMouseButton, getProperties, getQueueTool, getTimeouts, getVerification, getVisualizer, isCaptionEqual, isCaptionEqual, isCaptionEqual, lockQueue, parseString, parseString, produceNoBlocking, produceNoBlocking, produceTimeRestricted, produceTimeRestricted, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, setCharBindingMap, setComparator, setDefaultComponentVisualizer, setDefaultPathParser, setDefaultStringComparator, setDefaultVerification, setOutput, setPathParser, setProperties, setTimeouts, setVerification, setVisualizer, toStringSource, unlockAndThrow, unlockQueue, waitState
protected Widget widget
public WidgetOperator(Widget widget)
widget
- Widget to create operator forpublic WidgetOperator(WidgetOperator parentWidgetOper, WidgetOperator.WidgetChooser widgetChooser)
parentWidgetOper
- parent WidgetOperatorwidgetChooser
- implementation of WidgetChooserpublic WidgetOperator(WidgetOperator parentWidgetOper, int index)
parentWidgetOper
- parent WidgetOperatorindex
- index of widget to be foundpublic WidgetOperator(WidgetOperator parentWidgetOper, WidgetOperator.WidgetChooser widgetChooser, int index)
parentWidgetOper
- parent WidgetOperatorwidgetChooser
- implementation of WidgetChooserindex
- index of widget to be foundpublic WidgetOperator(TopComponentOperator tco, WidgetOperator.WidgetChooser widgetChooser)
tco
- TopComponentOperator to find widgets inwidgetChooser
- implementation of WidgetChooserpublic WidgetOperator(TopComponentOperator tco, int index)
tco
- TopComponentOperator to find widgets inindex
- index of widget to be foundpublic WidgetOperator(TopComponentOperator tco, WidgetOperator.WidgetChooser widgetChooser, int index)
tco
- TopComponentOperator to find widgets inwidgetChooser
- implementation of WidgetChooserindex
- index of widget to be foundpublic static Widget findWidget(Widget parentWidget, WidgetOperator.WidgetChooser widgetChooser, int index)
parentWidget
- parent WidgetwidgetChooser
- WidgetChooser implementationindex
- index to be foundpublic WidgetOperator getSceneOperator()
public List<WidgetOperator> getChildren()
public WidgetOperator getParent()
public Component getSource()
getSource
in class org.netbeans.jemmy.operators.Operator
public org.netbeans.jemmy.operators.JComponentOperator getViewOperator()
public Widget getWidget()
public Point getCenter()
public Point getLocation()
public Rectangle getBounds()
public String toString()
public void printDump()
printDump
in class org.netbeans.jemmy.operators.Operator
public static WidgetOperator createOperator(Widget widget)
widget
- Widget to create operator forpublic void performPopupAction(String popupPath)
popupPath
- path of popup menu item (e.g. 'Go|Next')public void performPopupActionNoBlock(String popupPath)
popupPath
- path of popup menu item (e.g. 'Go|Next')public void clickMouse(int clickCount)
clickCount
- number of clickspublic void dragNDrop(int relativeX, int relativeY)
relativeX
- relative distance of movement along x axisrelativeY
- relative distance of movement along y axispublic void dragNDrop(WidgetOperator widgetOperator)
widgetOperator
- target widget where to droppublic void dragNDrop(int x1, int y1, int x2, int y2)
x1
- start x positiony1
- start y positionx2
- end x positiony2
- end y position