org.netbeans.jemmy.operators
Class DialogOperator

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.WindowOperator
                  extended by org.netbeans.jemmy.operators.DialogOperator
All Implemented Interfaces:
Outputable, Timeoutable
Direct Known Subclasses:
JDialogOperator

public class DialogOperator
extends WindowOperator



Timeouts used:
DialogWaiter.WaitDialogTimeout - time to wait dialog displayed
DialogWaiter.AfterDialogTimeout - time to sleep after dialog has been dispayed
ComponentOperator.WaitStateTimeout - time to wait for title
.

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

Nested Class Summary
static class DialogOperator.DialogByTitleFinder
          Allows to find component by title.
static class DialogOperator.DialogFinder
          Checks component type.
 
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_MODAL_DPROP
          Identifier for a modal property.
static java.lang.String IS_RESIZABLE_DPROP
          Identifier for a resizable property.
static java.lang.String TITLE_DPROP
          Identifier for a title property.
 
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
DialogOperator()
          Constructor.
DialogOperator(ComponentChooser chooser)
          Constructs a DialogOperator object.
DialogOperator(ComponentChooser chooser, int index)
          Constructs a DialogOperator object.
DialogOperator(ComponentChooser chooser, int index, Operator env)
          Constructs a DialogOperator object.
DialogOperator(java.awt.Dialog w)
          Constructs a DialogOperator object.
DialogOperator(int index)
          Constructor.
DialogOperator(java.lang.String title)
          Constructor.
DialogOperator(java.lang.String title, int index)
          Constructor.
DialogOperator(java.lang.String title, int index, Operator env)
          Constructor.
DialogOperator(WindowOperator owner)
          Constructor.
DialogOperator(WindowOperator owner, ComponentChooser chooser)
          Constructs a DialogOperator object.
DialogOperator(WindowOperator owner, ComponentChooser chooser, int index)
          Constructs a DialogOperator object.
DialogOperator(WindowOperator owner, int index)
          Constructor.
DialogOperator(WindowOperator owner, java.lang.String title)
          Uses owner's timeout and output for waiting and to init operator.
DialogOperator(WindowOperator owner, java.lang.String title, int index)
          Constructor.
 
Method Summary
 java.util.Hashtable getDump()
          Returns information about component.
 java.lang.String getTitle()
          Maps Dialog.getTitle() through queue
 boolean isModal()
          Maps Dialog.isModal() through queue
 boolean isResizable()
          Maps Dialog.isResizable() through queue
 void setModal(boolean b)
          Maps Dialog.setModal(boolean) through queue
 void setResizable(boolean b)
          Maps Dialog.setResizable(boolean) through queue
 void setTitle(java.lang.String string)
          Maps Dialog.setTitle(String) through queue
protected static java.awt.Dialog waitDialog(ComponentChooser chooser, int index, Timeouts timeouts, TestOut output)
          A method to be used from subclasses.
protected static java.awt.Dialog waitDialog(java.awt.Window owner, ComponentChooser chooser, int index, Timeouts timeouts, TestOut output)
          A method to be used from subclasses.
protected static java.awt.Dialog waitDialog(WindowOperator owner, ComponentChooser chooser, int index)
          A method to be used from subclasses.
 void waitTitle(java.lang.String title)
          Waits for title.
 
Methods inherited from class org.netbeans.jemmy.operators.WindowOperator
activate, addWindowListener, applyResourceBundle, applyResourceBundle, close, copyEnvironment, dispose, findSubWindow, findSubWindow, findWindow, findWindow, findWindow, findWindow, getFocusOwner, getOutput, getOwnedWindows, getOwner, getWarningString, isActive, isFocused, move, pack, removeWindowListener, resize, setOutput, toBack, toFront, waitClosed, waitSubWindow, waitSubWindow, waitWindow, waitWindow, waitWindow, waitWindow, waitWindow, waitWindow, waitWindow
 
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, getTimeouts, isAncestorOf, paintComponents, printComponents, remove, remove, removeAll, removeContainerListener, setLayout, setTimeouts, 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, 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, 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

TITLE_DPROP

public static final java.lang.String TITLE_DPROP
Identifier for a title property.

See Also:
getDump(), Constant Field Values

IS_MODAL_DPROP

public static final java.lang.String IS_MODAL_DPROP
Identifier for a modal property.

See Also:
getDump(), Constant Field Values

IS_RESIZABLE_DPROP

public static final java.lang.String IS_RESIZABLE_DPROP
Identifier for a resizable property.

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

DialogOperator

public DialogOperator(java.awt.Dialog w)
Constructs a DialogOperator object.

Parameters:
w - window

DialogOperator

public DialogOperator(ComponentChooser chooser,
                      int index,
                      Operator env)
Constructs a DialogOperator object.

Parameters:
chooser - a component chooser specifying searching criteria.
index - an index between appropriate ones.
env - an operator to copy environment from.

DialogOperator

public DialogOperator(ComponentChooser chooser,
                      int index)
Constructs a DialogOperator object.

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

DialogOperator

public DialogOperator(ComponentChooser chooser)
Constructs a DialogOperator object.

Parameters:
chooser - a component chooser specifying searching criteria.

DialogOperator

public DialogOperator(WindowOperator owner,
                      ComponentChooser chooser,
                      int index)
Constructs a DialogOperator object.

Parameters:
owner - window - owner
chooser - a component chooser specifying searching criteria.
index - an index between appropriate ones.

DialogOperator

public DialogOperator(WindowOperator owner,
                      ComponentChooser chooser)
Constructs a DialogOperator object.

Parameters:
owner - window - owner
chooser - a component chooser specifying searching criteria.

DialogOperator

public DialogOperator(WindowOperator owner,
                      java.lang.String title,
                      int index)
Constructor. Waits for a dialog to show. The dialog is identified as the index+1'th java.awt.Dialog that shows, is owned by the window managed by the WindowOperator owner, and that has the desired title. Uses owner's timeout and output for waiting and to init this operator.

Parameters:
owner - Operator pointing to a window owner.
title - The desired title.
index - Ordinal index. The first dialog has index 0.
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

DialogOperator

public DialogOperator(WindowOperator owner,
                      java.lang.String title)
Uses owner's timeout and output for waiting and to init operator. Waits for a dialog to show. The dialog is identified as the first java.awt.Dialog that shows, is owned by the window managed by the WindowOperator owner, and that has the desired title. Uses owner's timeout and output for waiting and to init this operator.

Parameters:
owner - Operator pointing to a window owner.
title - The desired title.
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

DialogOperator

public DialogOperator(WindowOperator owner,
                      int index)
Constructor. Waits for the index'th dialog between owner's children. Uses owner'th timeout and output for waiting and to init operator.

Parameters:
owner - Operator pointing to a window owner.
index - Ordinal component index.
Throws:
TimeoutExpiredException

DialogOperator

public DialogOperator(WindowOperator owner)
Constructor. Waits for the first dialog between owner's children. Uses owner'th timeout and output for waiting and to init operator.

Parameters:
owner - Operator pointing to a window owner.
Throws:
TimeoutExpiredException

DialogOperator

public DialogOperator(java.lang.String title,
                      int index,
                      Operator env)
Constructor. Waits for the dialog with "title" subtitle. Constructor can be used in complicated cases when output or timeouts should differ from default.

Parameters:
title - a window title
index - Ordinal component index.
env - an operator to copy environment from.
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)

DialogOperator

public DialogOperator(java.lang.String title,
                      int index)
Constructor. Waits for the dialog with "title" subtitle. Uses current timeouts and output values.

Parameters:
title - a window title
index - Ordinal component index.
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean), JemmyProperties.getCurrentTimeouts(), JemmyProperties.getCurrentOutput()

DialogOperator

public DialogOperator(java.lang.String title)
Constructor. Waits for the dialog with "title" subtitle. Uses current timeouts and output values.

Parameters:
title - a window title
Throws:
TimeoutExpiredException
See Also:
Operator.isCaptionEqual(String, String, boolean, boolean), JemmyProperties.getCurrentTimeouts(), JemmyProperties.getCurrentOutput()

DialogOperator

public DialogOperator(int index)
Constructor. Waits for the index'th dialog. Uses current timeout and output for waiting and to init operator.

Parameters:
index - Ordinal component index.
Throws:
TimeoutExpiredException

DialogOperator

public DialogOperator()
Constructor. Waits for the first dialog. Uses current timeout and output for waiting and to init operator.

Throws:
TimeoutExpiredException
Method Detail

waitTitle

public void waitTitle(java.lang.String title)
Waits for title. Uses getComparator() comparator.

Parameters:
title - Title to wait for.

getDump

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

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

getTitle

public java.lang.String getTitle()
Maps Dialog.getTitle() through queue


isModal

public boolean isModal()
Maps Dialog.isModal() through queue


isResizable

public boolean isResizable()
Maps Dialog.isResizable() through queue


setModal

public void setModal(boolean b)
Maps Dialog.setModal(boolean) through queue


setResizable

public void setResizable(boolean b)
Maps Dialog.setResizable(boolean) through queue


setTitle

public void setTitle(java.lang.String string)
Maps Dialog.setTitle(String) through queue


waitDialog

protected static java.awt.Dialog waitDialog(ComponentChooser chooser,
                                            int index,
                                            Timeouts timeouts,
                                            TestOut output)
A method to be used from subclasses. Uses timeouts and output passed as parameters during the waiting.

Parameters:
chooser - org.netbeans.jemmy.ComponentChooser implementation.
index - Ordinal component index.
timeouts - timeouts to be used during the waiting.
output - an output to be used during the waiting.
Returns:
Component instance or null if component was not found.

waitDialog

protected static java.awt.Dialog waitDialog(WindowOperator owner,
                                            ComponentChooser chooser,
                                            int index)
A method to be used from subclasses. Uses owner's timeouts and output during the waiting.

Parameters:
owner - a window - dialog owner.
chooser - org.netbeans.jemmy.ComponentChooser implementation.
index - Ordinal component index.
Returns:
Component instance or null if component was not found.

waitDialog

protected static java.awt.Dialog waitDialog(java.awt.Window owner,
                                            ComponentChooser chooser,
                                            int index,
                                            Timeouts timeouts,
                                            TestOut output)
A method to be used from subclasses. Uses timeouts and output passed as parameters during the waiting.

Parameters:
owner - a window - dialog owner.
chooser - org.netbeans.jemmy.ComponentChooser implementation.
index - Ordinal component index.
timeouts - timeouts to be used during the waiting.
output - an output to be used during the waiting.
Returns:
Component instance or null if component was not found.