org.netbeans.jemmy.operators
Class JButtonOperator

java.lang.Object
  extended by org.netbeans.jemmy.operators.Operator
      extended by org.netbeans.jemmy.operators.ComponentOperator
          extended by org.netbeans.jemmy.operators.ContainerOperator
              extended by org.netbeans.jemmy.operators.JComponentOperator
                  extended by org.netbeans.jemmy.operators.AbstractButtonOperator
                      extended by org.netbeans.jemmy.operators.JButtonOperator
All Implemented Interfaces:
Outputable, Timeoutable

public class JButtonOperator
extends AbstractButtonOperator



Timeouts used:
AbstractButtonOperator.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

Nested Class Summary
static class JButtonOperator.JButtonFinder
          Checks component type.
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.AbstractButtonOperator
AbstractButtonOperator.AbstractButtonByLabelFinder, AbstractButtonOperator.AbstractButtonFinder
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.JComponentOperator
JComponentOperator.JComponentByTipFinder, JComponentOperator.JComponentFinder
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.ContainerOperator
ContainerOperator.ContainerFinder
 
Nested classes/interfaces 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 IS_DEFAULT_DPROP
          Identifier for a "default button" property.
 
Fields inherited from class org.netbeans.jemmy.operators.AbstractButtonOperator
IS_SELECTED_DPROP, TEXT_DPROP
 
Fields inherited from class org.netbeans.jemmy.operators.JComponentOperator
A11Y_DATA, A11Y_DESCRIPTION_DPROP, A11Y_NAME_DPROP, TOOLTIP_TEXT_DPROP
 
Fields inherited from class org.netbeans.jemmy.operators.ComponentOperator
HEIGHT_DPROP, IS_SHOWING_DPROP, IS_VISIBLE_DPROP, NAME_DPROP, WIDTH_DPROP, X_DPROP, Y_DPROP
 
Fields inherited from class org.netbeans.jemmy.operators.Operator
CLASS_DPROP, TO_STRING_DPROP
 
Constructor Summary
JButtonOperator(ContainerOperator cont)
          Constructor.
JButtonOperator(ContainerOperator cont, ComponentChooser chooser)
          Constructs a JButtonOperator object.
JButtonOperator(ContainerOperator cont, ComponentChooser chooser, int index)
          Constructs a JButtonOperator object.
JButtonOperator(ContainerOperator cont, int index)
          Constructor.
JButtonOperator(ContainerOperator cont, java.lang.String text)
          Constructor.
JButtonOperator(ContainerOperator cont, java.lang.String text, int index)
          Constructor.
JButtonOperator(javax.swing.JButton b)
          Constructor.
 
Method Summary
static javax.swing.JButton findJButton(java.awt.Container cont, ComponentChooser chooser)
          Searches 0'th JButton in container.
static javax.swing.JButton findJButton(java.awt.Container cont, ComponentChooser chooser, int index)
          Searches JButton in container.
static javax.swing.JButton findJButton(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs)
          Searches JButton by text.
static javax.swing.JButton findJButton(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs, int index)
          Searches JButton by text.
 java.util.Hashtable getDump()
          Returns information about component.
 boolean isDefaultButton()
          Maps JButton.isDefaultButton() through queue
 boolean isDefaultCapable()
          Maps JButton.isDefaultCapable() through queue
protected  void prepareToClick()
          Prepares the button to click.
 void setDefaultCapable(boolean b)
          Maps JButton.setDefaultCapable(boolean) through queue
static javax.swing.JButton waitJButton(java.awt.Container cont, ComponentChooser chooser)
          Waits 0'th JButton in container.
static javax.swing.JButton waitJButton(java.awt.Container cont, ComponentChooser chooser, int index)
          Waits JButton in container.
static javax.swing.JButton waitJButton(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs)
          Waits JButton by text.
static javax.swing.JButton waitJButton(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs, int index)
          Waits JButton by text.
 
Methods inherited from class org.netbeans.jemmy.operators.AbstractButtonOperator
addActionListener, addChangeListener, addItemListener, changeSelection, changeSelectionNoBlock, copyEnvironment, doClick, doClick, findAbstractButton, findAbstractButton, findAbstractButton, findAbstractButton, getActionCommand, getDisabledIcon, getDisabledSelectedIcon, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getMargin, getMnemonic, getModel, getOutput, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getTimeouts, getUI, getVerticalAlignment, getVerticalTextPosition, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, press, push, pushNoBlock, release, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setMargin, setMnemonic, setMnemonic, setModel, setOutput, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setTimeouts, setUI, setVerticalAlignment, setVerticalTextPosition, waitAbstractButton, waitAbstractButton, waitAbstractButton, waitAbstractButton, waitSelected, waitText
 
Methods inherited from class org.netbeans.jemmy.operators.JComponentOperator
addAncestorListener, addVetoableChangeListener, computeVisibleRect, createToolTip, findJComponent, findJComponent, findJComponent, findJComponent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getAutoscrolls, getBorder, getCenterXForClick, getCenterYForClick, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getInsets, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWindowContainerOperator, grabFocus, isFocusCycleRoot, isManagingFocus, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, requestDefaultFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, showToolTip, unregisterKeyboardAction, updateUI, waitJComponent, waitJComponent, waitJComponent, waitJComponent, waitToolTip
 
Methods inherited from class org.netbeans.jemmy.operators.ContainerOperator
add, add, add, add, add, addContainerListener, createSubOperator, createSubOperator, findComponentAt, findComponentAt, findContainer, findContainer, findContainer, findContainer, findContainerUnder, findContainerUnder, findSubComponent, findSubComponent, getComponent, getComponentCount, getComponents, getInsets, getLayout, isAncestorOf, paintComponents, printComponents, remove, remove, removeAll, removeContainerListener, setLayout, waitContainer, waitContainer, waitContainer, waitContainer, waitSubComponent, waitSubComponent
 
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, getCenterY, 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, wtComponentEnabled
 
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, 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, toStringSource, unlockAndThrow, unlockQueue, waitState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_DEFAULT_DPROP

public static final java.lang.String IS_DEFAULT_DPROP
Identifier for a "default button" property.

See Also:
getDump(), Constant Field Values
Constructor Detail

JButtonOperator

public JButtonOperator(javax.swing.JButton b)
Constructor.

Parameters:
b - a component

JButtonOperator

public JButtonOperator(ContainerOperator cont,
                       ComponentChooser chooser,
                       int index)
Constructs a JButtonOperator object.

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

JButtonOperator

public JButtonOperator(ContainerOperator cont,
                       ComponentChooser chooser)
Constructs a JButtonOperator object.

Parameters:
cont - container
chooser - a component chooser specifying searching criteria.

JButtonOperator

public JButtonOperator(ContainerOperator cont,
                       java.lang.String text,
                       int index)
Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.

Parameters:
cont - container
text - Button text.
index - Ordinal component index.
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

JButtonOperator

public JButtonOperator(ContainerOperator cont,
                       java.lang.String text)
Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.

Parameters:
cont - container
text - Button text.
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

JButtonOperator

public JButtonOperator(ContainerOperator cont,
                       int index)
Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.

Parameters:
cont - container
index - Ordinal component index.
Throws:
TimeoutExpiredException

JButtonOperator

public JButtonOperator(ContainerOperator cont)
Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.

Parameters:
cont - container
Throws:
TimeoutExpiredException
Method Detail

findJButton

public static javax.swing.JButton findJButton(java.awt.Container cont,
                                              ComponentChooser chooser,
                                              int index)
Searches JButton in container.

Parameters:
cont - Container to search component in.
chooser - org.netbeans.jemmy.ComponentChooser implementation.
index - Ordinal component index.
Returns:
JButton instance or null if component was not found.

findJButton

public static javax.swing.JButton findJButton(java.awt.Container cont,
                                              ComponentChooser chooser)
Searches 0'th JButton in container.

Parameters:
cont - Container to search component in.
chooser - org.netbeans.jemmy.ComponentChooser implementation.
Returns:
JButton instance or null if component was not found.

findJButton

public static javax.swing.JButton findJButton(java.awt.Container cont,
                                              java.lang.String text,
                                              boolean ce,
                                              boolean ccs,
                                              int index)
Searches JButton 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:
JButton instance or null if component was not found.
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

findJButton

public static javax.swing.JButton findJButton(java.awt.Container cont,
                                              java.lang.String text,
                                              boolean ce,
                                              boolean ccs)
Searches JButton 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:
JButton instance or null if component was not found.
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

waitJButton

public static javax.swing.JButton waitJButton(java.awt.Container cont,
                                              ComponentChooser chooser,
                                              int index)
Waits JButton in container.

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

waitJButton

public static javax.swing.JButton waitJButton(java.awt.Container cont,
                                              ComponentChooser chooser)
Waits 0'th JButton in container.

Parameters:
cont - Container to search component in.
chooser - org.netbeans.jemmy.ComponentChooser implementation.
Returns:
JButton instance.
Throws:
TimeoutExpiredException

waitJButton

public static javax.swing.JButton waitJButton(java.awt.Container cont,
                                              java.lang.String text,
                                              boolean ce,
                                              boolean ccs,
                                              int index)
Waits JButton 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:
JButton instance.
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

waitJButton

public static javax.swing.JButton waitJButton(java.awt.Container cont,
                                              java.lang.String text,
                                              boolean ce,
                                              boolean ccs)
Waits JButton 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:
JButton instance.
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

getDump

public java.util.Hashtable getDump()
Returns information about component.

Overrides:
getDump in class AbstractButtonOperator
Returns:
a Hashtable containing name-value pairs.

isDefaultButton

public boolean isDefaultButton()
Maps JButton.isDefaultButton() through queue


isDefaultCapable

public boolean isDefaultCapable()
Maps JButton.isDefaultCapable() through queue


setDefaultCapable

public void setDefaultCapable(boolean b)
Maps JButton.setDefaultCapable(boolean) through queue


prepareToClick

protected void prepareToClick()
Prepares the button to click.