org.netbeans.modules.jellytools.platform/3 3.13

org.netbeans.jellytools.widgets
Class WidgetOperator

java.lang.Object
  extended by org.netbeans.jemmy.operators.Operator
      extended by org.netbeans.jellytools.widgets.WidgetOperator
All Implemented Interfaces:
org.netbeans.jemmy.Outputable, org.netbeans.jemmy.Timeoutable
Direct Known Subclasses:
ConnectionWidgetOperator, LabelWidgetOperator

public class WidgetOperator
extends org.netbeans.jemmy.operators.Operator

Handle org.netbeans.api.visual.widget.Widget object which represents some graphical content.

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);
 


Nested Class Summary
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.
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.Operator
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
 
Field Summary
protected  Widget widget
           
 
Fields inherited from class org.netbeans.jemmy.operators.Operator
CLASS_DPROP, TO_STRING_DPROP
 
Constructor Summary
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.
 
Method Summary
 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 undelying 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.
 
Methods inherited from class org.netbeans.jemmy.operators.Operator
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

widget

protected Widget widget
Constructor Detail

WidgetOperator

public WidgetOperator(Widget widget)
Creates operator for given Widget.

Parameters:
widget - Widget to create operator for

WidgetOperator

public WidgetOperator(WidgetOperator parentWidgetOper,
                      WidgetOperator.WidgetChooser widgetChooser)
Waits for Widget specified by WidgetChooser implementation under given parent.

Parameters:
parentWidgetOper - parent WidgetOperator
widgetChooser - implementation of WidgetChooser

WidgetOperator

public WidgetOperator(WidgetOperator parentWidgetOper,
                      int index)
Waits for index-th Widget under given parent.

Parameters:
parentWidgetOper - parent WidgetOperator
index - index of widget to be found

WidgetOperator

public WidgetOperator(WidgetOperator parentWidgetOper,
                      WidgetOperator.WidgetChooser widgetChooser,
                      int index)
Waits for index-th Widget specified by WidgetChooser implementation under given parent.

Parameters:
parentWidgetOper - parent WidgetOperator
widgetChooser - implementation of WidgetChooser
index - index of widget to be found

WidgetOperator

public WidgetOperator(TopComponentOperator tco,
                      WidgetOperator.WidgetChooser widgetChooser)
Waits for Widget specified by WidgetChooser implementation in given TopComponent.

Parameters:
tco - TopComponentOperator to find widgets in
widgetChooser - implementation of WidgetChooser

WidgetOperator

public WidgetOperator(TopComponentOperator tco,
                      int index)
Waits for index-th Widget in given TopComponent.

Parameters:
tco - TopComponentOperator to find widgets in
index - index of widget to be found

WidgetOperator

public WidgetOperator(TopComponentOperator tco,
                      WidgetOperator.WidgetChooser widgetChooser,
                      int index)
Waits for index-th Widget specified by WidgetChooser implementation in given TopComponent.

Parameters:
tco - TopComponentOperator to find widgets in
widgetChooser - implementation of WidgetChooser
index - index of widget to be found
Method Detail

findWidget

public static Widget findWidget(Widget parentWidget,
                                WidgetOperator.WidgetChooser widgetChooser,
                                int index)
Finds index-th widget specified by WidgetChooser under given parent widget.

Parameters:
parentWidget - parent Widget
widgetChooser - WidgetChooser implementation
index - index to be found
Returns:
Widget instance or null if not found

getSceneOperator

public WidgetOperator getSceneOperator()
Returns operator for Scene widget which is parent of all other widgets.

Returns:
WidgetOperator instance representing Scene widget

getChildren

public List<WidgetOperator> getChildren()
Returns List of WidgetOperators representing children of this Widget.

Returns:
List with children of this Widget

getParent

public WidgetOperator getParent()
Returns WidgetOperator for parent Widget of this operator or null if parent doesn't exist.

Returns:
WidgetOperator instance of parent Widget or null if parent doesn't exist

getSource

public Component getSource()
Returns undelying component which hosts this widget.

Specified by:
getSource in class org.netbeans.jemmy.operators.Operator
Returns:
underlying Component instance

getViewOperator

public org.netbeans.jemmy.operators.JComponentOperator getViewOperator()
Returns operator of underlying component which hosts this widget.

Returns:
JComponentOperator instance of underlying component

getWidget

public Widget getWidget()
Returns Widget represented by this operator.

Returns:
Widget instance represented by this operator

getCenter

public Point getCenter()
Returns center of this widget in underlying view coordinates. It can be used for mouse click.

Returns:
Point representing center of this widget

getLocation

public Point getLocation()
Returns relative location of this widget to its parent.

Returns:
Point representing relative location to its parent

getBounds

public Rectangle getBounds()
Returns bounds occupied by widget.

Returns:
bounds occupied by widget

toString

public String toString()
Returns class name of this widget, its location and bounds.

Overrides:
toString in class Object
Returns:
class name of this widget, its location and bounds

printDump

public void printDump()
Prints information about this widget and its children.

Overrides:
printDump in class org.netbeans.jemmy.operators.Operator

createOperator

public static WidgetOperator createOperator(Widget widget)
Creates WidgetOperator for given widget.

Parameters:
widget - Widget to create operator for
Returns:
WidgetOperator instance for given Widget

performPopupAction

public void performPopupAction(String popupPath)
Performs popup action on this widget.

Parameters:
popupPath - path of popup menu item (e.g. 'Go|Next')

performPopupActionNoBlock

public void performPopupActionNoBlock(String popupPath)
Performs popup action on this widget and no block further execution.

Parameters:
popupPath - path of popup menu item (e.g. 'Go|Next')

clickMouse

public void clickMouse(int clickCount)
Clicks mouse in the center of widget.

Parameters:
clickCount - number of clicks

dragNDrop

public void dragNDrop(int relativeX,
                      int relativeY)
Drag from the center of this widget and drop at new position.

Parameters:
relativeX - relative distance of movement along x axis
relativeY - relative distance of movement along y axis

dragNDrop

public void dragNDrop(WidgetOperator widgetOperator)
Drag from the center widget and drop at the center of given widget.

Parameters:
widgetOperator - target widget where to drop

dragNDrop

public void dragNDrop(int x1,
                      int y1,
                      int x2,
                      int y2)
Drag from start coordinates and drop at end coordinates.

Parameters:
x1 - start x position
y1 - start y position
x2 - end x position
y2 - end y position

org.netbeans.modules.jellytools.platform/3 3.13

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.