Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.netbeans.jemmy.operators
Class ButtonOperator

    java.lang.Object
      |
      +--org.netbeans.jemmy.operators.Operator
            |
            +--org.netbeans.jemmy.operators.ComponentOperator
                  |
                  +--org.netbeans.jemmy.operators.ButtonOperator

All Implemented Interfaces:
  Outputable, Timeoutable

public class ButtonOperator
extends ComponentOperator
implements Timeoutable, Outputable

Timeouts used:
ButtonOperator.PushButtonTimeout - time between button pressing and releasing
ComponentOperator.WaitComponentTimeout - time to wait button displayed
ComponentOperator.WaitComponentEnabledTimeout - time to wait button enabled
.

Author:
  Alexandre Iline (alexandre.iline@sun.com)
See Also:
  `Timeouts`

Inner Class Summary
`static class` | `ButtonOperator.ButtonByLabelFinder` Allows to find component by label.
`static class` | `ButtonOperator.ButtonFinder` Checks component type.

Inner classes inherited from class org.netbeans.jemmy.operators.Operator
`Operator.ComponentVisualizer, Operator.DefaultPathParser, Operator.DefaultStringComparator, Operator.Finder, Operator.MapAction, Operator.MapBooleanAction, Operator.MapByteAction, Operator.MapCharacterAction, Operator.MapDoubleAction, Operator.MapFloatAction, Operator.MapIntegerAction, Operator.MapLongAction, Operator.MapVoidAction, Operator.NoBlockingAction, Operator.PathParser, Operator.StringComparator`

Field Summary
`static java.lang.String` | `TEXT_DPROP` Identifier for a label property.

Fields inherited from class org.netbeans.jemmy.operators.ComponentOperator
`HEIGHT_DPROP, IS_SHOWING_DPROP, IS_VISIBLE_DPROP, WIDTH_DPROP, X_DPROP, Y_DPROP`

Fields inherited from class org.netbeans.jemmy.operators.Operator
`CLASS_DPROP, TO_STRING_DPROP`

Constructor Summary
`ButtonOperator(java.awt.Button b)` Constructor.
`ButtonOperator(ContainerOperator cont)` Constructor.
`ButtonOperator(ContainerOperator cont, ComponentChooser chooser)` Constructs a ButtonOperator object.
`ButtonOperator(ContainerOperator cont, ComponentChooser chooser, int index)` Constructs a ButtonOperator object.
`ButtonOperator(ContainerOperator cont, int index)` Constructor.
`ButtonOperator(ContainerOperator cont, java.lang.String text)` Constructor.
`ButtonOperator(ContainerOperator cont, java.lang.String text, int index)` Constructor.

Method Summary
`void` | `addActionListener(java.awt.event.ActionListener actionListener)` Maps `Button.addActionListener(ActionListener)` through queue
`void` | `copyEnvironment(Operator anotherOperator)` Copies all environment (output, timeouts, visualizer) from another operator.
`static java.awt.Button` | `findButton(java.awt.Container cont, ComponentChooser chooser)` Searches for the first Button in a container.
`static java.awt.Button` | `findButton(java.awt.Container cont, ComponentChooser chooser, int index)` Searches Button in a container.
`static java.awt.Button` | `findButton(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs)` Searches Button by text.
`static java.awt.Button` | `findButton(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs, int index)` Searches Button by text.
`java.lang.String` | `getActionCommand()` Maps `Button.getActionCommand()` through queue
`java.util.Hashtable` | `getDump()` Returns information about component.
`java.lang.String` | `getLabel()` Maps `Button.getLabel()` through queue
`TestOut` | `getOutput()` Returns print output streams or writers.
`Timeouts` | `getTimeouts()` Return current timeouts.
`void` | `press()` Press the button by mouse.
`void` | `push()` Pushes the button by mouse click.
`void` | `pushNoBlock()` Runs `push()` method in a separate thread.
`void` | `release()` Releases the button by mouse.
`void` | `removeActionListener(java.awt.event.ActionListener actionListener)` Maps `Button.removeActionListener(ActionListener)` through queue
`void` | `setActionCommand(java.lang.String string)` Maps `Button.setActionCommand(String)` through queue
`void` | `setLabel(java.lang.String string)` Maps `Button.setLabel(String)` through queue
`void` | `setOutput(TestOut out)` Defines print output streams or writers.
`void` | `setTimeouts(Timeouts timeouts)` Defines current timeouts.
`static java.awt.Button` | `waitButton(java.awt.Container cont, ComponentChooser chooser)` Waits 0'th Button in container.
`static java.awt.Button` | `waitButton(java.awt.Container cont, ComponentChooser chooser, int index)` Waits Button in container.
`static java.awt.Button` | `waitButton(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs)` Waits Button by text.
`static java.awt.Button` | `waitButton(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs, int index)` Waits Button by text.

Methods inherited from class org.netbeans.jemmy.operators.ComponentOperator
`activateWindow, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, checkImage, checkImage, clickForPopup, clickForPopup, clickForPopup, clickForPopup, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, contains, contains, createImage, createImage, dispatchEvent, doLayout, dragMouse, dragMouse, dragMouse, dragNDrop, dragNDrop, dragNDrop, enableInputMethods, enterMouse, exitMouse, findComponent, findComponent, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getCenterX, getCenterXForClick, getCenterY, getCenterYForClick, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getContainer, getContainers, getCursor, getDropTarget, getEventDispatcher, getFocus, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getSize, getSource, getToolkit, getTreeLock, getWidth, getWindow, getX, getY, hasFocus, imageUpdate, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, list, list, list, list, list, makeComponentVisible, moveMouse, paint, paintAll, prepareImage, prepareImage, pressKey, pressKey, pressMouse, pressMouse, print, printAll, pushKey, pushKey, releaseKey, releaseKey, releaseMouse, releaseMouse, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, transferFocus, typeKey, typeKey, typeKey, update, validate, waitComponent, waitComponent, waitComponent, waitComponent, waitComponentEnabled, waitComponentShowing, waitComponentVisible, waitHasFocus`

Methods inherited from class org.netbeans.jemmy.operators.Operator
`addOperatorPackage, addToDump, addToDump, createOperator, getCharBindingMap, getCharKey, getCharModifiers, getCharsKeys, getCharsKeys, getCharsModifiers, getCharsModifiers, getComparator, getDefaultComponentVisualizer, getDefaultMouseButton, getDefaultPathParser, getDefaultStringComparator, getDefaultVerification, getEnvironmentOperator, getParentPath, getPathParser, getPopupMouseButton, getProperties, getQueueTool, getVerification, getVisualizer, isCaptionEqual, isCaptionEqual, isCaptionEqual, lockQueue, parseString, parseString, printDump, produceNoBlocking, produceNoBlocking, produceTimeRestricted, produceTimeRestricted, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, setCharBindingMap, setComparator, setDefaultComponentVisualizer, setDefaultPathParser, setDefaultStringComparator, setDefaultVerification, setPathParser, setProperties, setVerification, setVisualizer, unlockAndThrow, unlockQueue, waitState`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TEXT_DPROP

    public static final java.lang.String TEXT_DPROP

  Identifier for a label property.
  See Also:
    `getDump()`

Constructor Detail

### ButtonOperator

    public ButtonOperator(java.awt.Button b)

  Constructor.
  Parameters:
    `b` - The `java.awt.Button` managed by this instance.

### ButtonOperator

    public ButtonOperator(ContainerOperator cont,
                          ComponentChooser chooser,
                          int index)

  Constructs a ButtonOperator object.
  Parameters:
    `cont` - container
    `chooser` - a component chooser specifying searching criteria.
    `index` - an index between appropriate ones.

### ButtonOperator

    public ButtonOperator(ContainerOperator cont,
                          ComponentChooser chooser)

  Constructs a ButtonOperator object.
  Parameters:
    `cont` - container
    `chooser` - a component chooser specifying searching criteria.

### ButtonOperator

    public ButtonOperator(ContainerOperator cont,
                          java.lang.String text,
                          int index)

  Constructor. Waits for a component in a container to show. The component is identified as the `index+1`'th `java.awt.Button` that shows, lies below the container in the display containment hierarchy, and that has the desired text. Uses cont's timeout and output for waiting and to init this operator.
  Parameters:
    `cont` - The operator for a container containing the sought for button.
    `text` - Button text.
    `index` - Ordinal component index. The first component has `index` 0.
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `Operator.isCaptionEqual(String, String, boolean, boolean)`

### ButtonOperator

    public ButtonOperator(ContainerOperator cont,
                          java.lang.String text)

  Constructor. Waits for a component in a container to show. The component is identified as the first `java.awt.Button` that shows, lies below the container in the display containment hierarchy, and that has the desired text. Uses cont's timeout and output for waiting and to init this operator.
  Parameters:
    `cont` - The operator for a container containing the sought for button.
    `text` - Button text.
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `Operator.isCaptionEqual(String, String, boolean, boolean)`

### ButtonOperator

    public ButtonOperator(ContainerOperator cont,
                          int index)

  Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.
  Parameters:
    `cont` - The operator for a container containing the sought for button.
    `index` - Ordinal component index.
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `Operator.isCaptionEqual(String, String, boolean, boolean)`

### ButtonOperator

    public ButtonOperator(ContainerOperator cont)

  Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.
  Parameters:
    `cont` - The operator for a container containing the sought for button.
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `Operator.isCaptionEqual(String, String, boolean, boolean)`

Method Detail

### findButton

    public static java.awt.Button findButton(java.awt.Container cont,
                                             ComponentChooser chooser,
                                             int index)

  Searches Button in a container.
  Parameters:
    `cont` - Container in which to search for the component. The container lies above the component in the display containment hierarchy. The containment need not be direct.
    `chooser` - org.netbeans.jemmy.ComponentChooser implementation, defining and applying search criteria.
    `index` - Ordinal component index. The first `index` is 0.
  Returns:
    Button instance or null if component was not found.

### findButton

    public static java.awt.Button findButton(java.awt.Container cont,
                                             ComponentChooser chooser)

  Searches for the first Button in a container.
  Parameters:
    `cont` - Container in which to search for the component. The container lies above the component in the display containment hierarchy. The containment need not be direct.
    `chooser` - org.netbeans.jemmy.ComponentChooser implementation, defining and applying search criteria.
  Returns:
    Button instance or null if component was not found.

### findButton

    public static java.awt.Button findButton(java.awt.Container cont,
                                             java.lang.String text,
                                             boolean ce,
                                             boolean ccs,
                                             int index)

  Searches Button by text.
  Parameters:
    `cont` - Container to search component in.
    `text` - Button text. If null, contents is not checked.
    `ce` - Compare text exactly.
    `ccs` - Compare text case sensitively.
    `index` - Ordinal component index.
  Returns:
    Button instance or null if component was not found.
  See Also:
    `Operator.isCaptionEqual(String, String, boolean, boolean)`

### findButton

    public static java.awt.Button findButton(java.awt.Container cont,
                                             java.lang.String text,
                                             boolean ce,
                                             boolean ccs)

  Searches Button by text.
  Parameters:
    `cont` - Container to search component in.
    `text` - Button text. If null, contents is not checked.
    `ce` - Compare text exactly.
    `ccs` - Compare text case sensitively.
  Returns:
    Button instance or null if component was not found.
  See Also:
    `Operator.isCaptionEqual(String, String, boolean, boolean)`

### waitButton

    public static java.awt.Button waitButton(java.awt.Container cont,
                                             ComponentChooser chooser,
                                             int index)

  Waits Button in container.
  Parameters:
    `cont` - Container to search component in.
    `chooser` - org.netbeans.jemmy.ComponentChooser implementation.
    `index` - Ordinal component index.
  Returns:
    Button instance.
  Throws:
    `TimeoutExpiredException` -

### waitButton

    public static java.awt.Button waitButton(java.awt.Container cont,
                                             ComponentChooser chooser)

  Waits 0'th Button in container.
  Parameters:
    `cont` - Container to search component in.
    `chooser` - org.netbeans.jemmy.ComponentChooser implementation.
  Returns:
    Button instance.
  Throws:
    `TimeoutExpiredException` -

### waitButton

    public static java.awt.Button waitButton(java.awt.Container cont,
                                             java.lang.String text,
                                             boolean ce,
                                             boolean ccs,
                                             int index)

  Waits Button by text.
  Parameters:
    `cont` - Container to search component in.
    `text` - Button text. If null, contents is not checked.
    `ce` - Compare text exactly.
    `ccs` - Compare text case sensitively.
    `index` - Ordinal component index.
  Returns:
    Button instance.
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `Operator.isCaptionEqual(String, String, boolean, boolean)`

### waitButton

    public static java.awt.Button waitButton(java.awt.Container cont,
                                             java.lang.String text,
                                             boolean ce,
                                             boolean ccs)

  Waits Button by text.
  Parameters:
    `cont` - Container to search component in.
    `text` - Button text. If null, contents is not checked.
    `ce` - Compare text exactly.
    `ccs` - Compare text case sensitively.
  Returns:
    Button instance.
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `Operator.isCaptionEqual(String, String, boolean, boolean)`

### setTimeouts

    public void setTimeouts(Timeouts timeouts)

  Description copied from interface: `Timeoutable`
  Defines current timeouts.
  Specified by:
    `setTimeouts` in interface `Timeoutable`
  Overrides:
    `setTimeouts` in class `ComponentOperator`
  Following copied from interface: `org.netbeans.jemmy.Timeoutable`
  Parameters:
    `t` - A collection of timeout assignments.
  See Also:
    `Timeoutable.getTimeouts()`

### getTimeouts

    public Timeouts getTimeouts()

  Description copied from interface: `Timeoutable`
  Return current timeouts.
  Specified by:
    `getTimeouts` in interface `Timeoutable`
  Overrides:
    `getTimeouts` in class `ComponentOperator`
  Following copied from interface: `org.netbeans.jemmy.Timeoutable`
  Returns:
    the collection of current timeout assignments.
  See Also:
    `Timeoutable.setTimeouts(org.netbeans.jemmy.Timeouts)`

### setOutput

    public void setOutput(TestOut out)

  Description copied from interface: `Outputable`
  Defines print output streams or writers.
  Specified by:
    `setOutput` in interface `Outputable`
  Overrides:
    `setOutput` in class `ComponentOperator`
  Following copied from interface: `org.netbeans.jemmy.Outputable`
  Parameters:
    `out` - Identify the streams or writers used for print output.
  See Also:
    `Outputable.getOutput()`

### getOutput

    public TestOut getOutput()

  Description copied from interface: `Outputable`
  Returns print output streams or writers.
  Specified by:
    `getOutput` in interface `Outputable`
  Overrides:
    `getOutput` in class `ComponentOperator`
  Following copied from interface: `org.netbeans.jemmy.Outputable`
  Returns:
    an object that contains references to objects for printing to output and err streams.
  See Also:
    `Outputable.setOutput(org.netbeans.jemmy.TestOut)`

### copyEnvironment

    public void copyEnvironment(Operator anotherOperator)

  Description copied from class: `Operator`
  Copies all environment (output, timeouts, visualizer) from another operator.
  Overrides:
    `copyEnvironment` in class `ComponentOperator`
  Following copied from class: `org.netbeans.jemmy.operators.Operator`
  Parameters:
    `anotherOperator` - an operator to copy the environment to.

### push

    public void push()

  Pushes the button by mouse click.
  Throws:
    `TimeoutExpiredException` -

### pushNoBlock

    public void pushNoBlock()

  Runs `push()` method in a separate thread.

### press

    public void press()

  Press the button by mouse.
  Throws:
    `TimeoutExpiredException` -

### release

    public void release()

  Releases the button by mouse.
  Throws:
    `TimeoutExpiredException` -

### getDump

    public java.util.Hashtable getDump()

  Returns information about component.
  Overrides:
    `getDump` in class `ComponentOperator`
  Following copied from class: `org.netbeans.jemmy.operators.Operator`
  Returns:
    a Hashtable containing name-value pairs.

### addActionListener

    public void addActionListener(java.awt.event.ActionListener actionListener)

  Maps `Button.addActionListener(ActionListener)` through queue

### getActionCommand

    public java.lang.String getActionCommand()

  Maps `Button.getActionCommand()` through queue

### getLabel

    public java.lang.String getLabel()

  Maps `Button.getLabel()` through queue

### removeActionListener

    public void removeActionListener(java.awt.event.ActionListener actionListener)

  Maps `Button.removeActionListener(ActionListener)` through queue

### setActionCommand

    public void setActionCommand(java.lang.String string)

  Maps `Button.setActionCommand(String)` through queue

### setLabel

    public void setLabel(java.lang.String string)

  Maps `Button.setLabel(String)` through queue

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD