Package org.netbeans.jemmy.operators
Class WindowOperator
- java.lang.Object
-
- org.netbeans.jemmy.operators.Operator
-
- org.netbeans.jemmy.operators.ComponentOperator
-
- org.netbeans.jemmy.operators.ContainerOperator
-
- org.netbeans.jemmy.operators.WindowOperator
-
- All Implemented Interfaces:
Outputable
,Timeoutable
- Direct Known Subclasses:
DialogOperator
,FrameOperator
public class WindowOperator extends ContainerOperator implements Outputable
Timeouts used:
WindowWaiter.WaitWindowTimeout - time to wait window displayed
WindowWaiter.AfterWindowTimeout - time to sleep after window has been dispayed
.- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
Timeouts
-
-
Nested Class Summary
-
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
-
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
Constructors Constructor Description WindowOperator()
Constructor.WindowOperator(int index)
Constructor.WindowOperator(int index, Operator env)
Constructor.WindowOperator(Window w)
Constructor.WindowOperator(WindowOperator owner)
Constructor.WindowOperator(WindowOperator owner, int index)
Constructor.WindowOperator(WindowOperator owner, ComponentChooser chooser)
Constructs a DialogOperator object.WindowOperator(WindowOperator owner, ComponentChooser chooser, int index)
Constructs a DialogOperator object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activate()
Activates the window.void
addWindowListener(WindowListener windowListener)
MapsWindow.addWindowListener(WindowListener)
through queuevoid
applyResourceBundle(String string)
MapsWindow.applyResourceBundle(String)
through queuevoid
applyResourceBundle(ResourceBundle resourceBundle)
MapsWindow.applyResourceBundle(ResourceBundle)
through queuevoid
close()
Deprecated.Use requestClose().void
copyEnvironment(Operator anotherOperator)
Copies all environment (output, timeouts, visualizer) from another operator.void
dispose()
MapsWindow.dispose()
through queueWindow
findSubWindow(ComponentChooser chooser)
Searches a window between windows owned by this window.Window
findSubWindow(ComponentChooser chooser, int index)
Searches an index'th window between windows owned by this window.static Window
findWindow(Window owner, ComponentChooser chooser)
Searches a window.static Window
findWindow(Window owner, ComponentChooser chooser, int index)
Searches an index'th window.static Window
findWindow(ComponentChooser chooser)
Searches a window.static Window
findWindow(ComponentChooser chooser, int index)
Searches an index'th window.Component
getFocusOwner()
MapsWindow.getFocusOwner()
through queueTestOut
getOutput()
Returns print output streams or writers.Window[]
getOwnedWindows()
MapsWindow.getOwnedWindows()
through queueWindow
getOwner()
MapsWindow.getOwner()
through queueString
getWarningString()
MapsWindow.getWarningString()
through queueboolean
isActive()
MapsWindow.isActive()
through queue.boolean
isFocused()
MapsWindow.isFocused()
through queue.void
move(int x, int y)
Moves the window to another location.void
pack()
MapsWindow.pack()
through queuevoid
removeWindowListener(WindowListener windowListener)
MapsWindow.removeWindowListener(WindowListener)
through queuevoid
requestClose()
Requests the window to close.void
requestCloseAndThenHide()
Closes a window by requesting it to close and then hiding it.void
resize(int width, int height)
Resizes the window.void
setOutput(TestOut out)
Defines print output streams or writers.void
toBack()
MapsWindow.toBack()
through queuevoid
toFront()
MapsWindow.toFront()
through queuevoid
waitClosed()
Waits the window to be closed.Window
waitSubWindow(ComponentChooser chooser)
Waits a window between windows owned by this window.Window
waitSubWindow(ComponentChooser chooser, int index)
Waits an index'th window between windows owned by this window.static Window
waitWindow(Window owner, ComponentChooser chooser)
Waits a window.static Window
waitWindow(Window owner, ComponentChooser chooser, int index)
Waits an index'th window.protected static Window
waitWindow(Window owner, ComponentChooser chooser, int index, Timeouts timeouts, TestOut output)
A method to be used from subclasses.static Window
waitWindow(ComponentChooser chooser)
Waits a window.static Window
waitWindow(ComponentChooser chooser, int index)
Waits an index'th window.protected static Window
waitWindow(ComponentChooser chooser, int index, Timeouts timeouts, TestOut output)
A method to be used from subclasses.protected static Window
waitWindow(WindowOperator owner, ComponentChooser chooser, int index)
A method to be used from subclasses.-
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, getDump, 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
-
-
-
-
Constructor Detail
-
WindowOperator
public WindowOperator(Window w)
Constructor.- Parameters:
w
- a component
-
WindowOperator
public WindowOperator(WindowOperator owner, ComponentChooser chooser, int index)
Constructs a DialogOperator object.- Parameters:
owner
- window - ownerchooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.
-
WindowOperator
public WindowOperator(WindowOperator owner, ComponentChooser chooser)
Constructs a DialogOperator object.- Parameters:
owner
- window - ownerchooser
- a component chooser specifying searching criteria.
-
WindowOperator
public WindowOperator(WindowOperator owner, int index)
Constructor. Waits for the index'th displayed owner's child. Uses owner's timeout and output for waiting and to init operator.- Parameters:
owner
- Operator pointing on a window owner.index
- an index between appropriate ones.- Throws:
TimeoutExpiredException
-
WindowOperator
public WindowOperator(WindowOperator owner)
Constructor. Waits for the first displayed owner's child. Uses owner's timeout and output for waiting and to init operator.- Parameters:
owner
- Operator pointing on a window owner.- Throws:
TimeoutExpiredException
-
WindowOperator
public WindowOperator(int index, Operator env)
Constructor. Waits for the index'th displayed window. Constructor can be used in complicated cases when output or timeouts should differ from default.- Parameters:
index
- an index between appropriate ones.env
- an operator to copy environment from.- Throws:
TimeoutExpiredException
-
WindowOperator
public WindowOperator(int index)
Constructor. Waits for the index'th displayed window. Uses current timeouts and output values.- Parameters:
index
- an index between appropriate ones.- Throws:
TimeoutExpiredException
- See Also:
JemmyProperties.getCurrentTimeouts()
,JemmyProperties.getCurrentOutput()
-
WindowOperator
public WindowOperator()
Constructor. Waits for the first displayed window. Uses current timeouts and output values.
-
-
Method Detail
-
findWindow
public static Window findWindow(ComponentChooser chooser, int index)
Searches an index'th window.- Parameters:
chooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.- Returns:
- a window
-
findWindow
public static Window findWindow(ComponentChooser chooser)
Searches a window.- Parameters:
chooser
- a component chooser specifying searching criteria.- Returns:
- a window
-
findWindow
public static Window findWindow(Window owner, ComponentChooser chooser, int index)
Searches an index'th window.- Parameters:
owner
- Window - owner.chooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.- Returns:
- a window
-
findWindow
public static Window findWindow(Window owner, ComponentChooser chooser)
Searches a window.- Parameters:
owner
- Window - owner.chooser
- a component chooser specifying searching criteria.- Returns:
- a window
-
waitWindow
public static Window waitWindow(ComponentChooser chooser, int index)
Waits an index'th window.- Parameters:
chooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.- Returns:
- a window
- Throws:
TimeoutExpiredException
-
waitWindow
public static Window waitWindow(ComponentChooser chooser)
Waits a window.- Parameters:
chooser
- a component chooser specifying searching criteria.- Returns:
- a window
- Throws:
TimeoutExpiredException
-
waitWindow
public static Window waitWindow(Window owner, ComponentChooser chooser, int index)
Waits an index'th window.- Parameters:
owner
- Window - owner.chooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.- Returns:
- a window
- Throws:
TimeoutExpiredException
-
waitWindow
public static Window waitWindow(Window owner, ComponentChooser chooser)
Waits a window.- Parameters:
owner
- Window - owner.chooser
- a component chooser specifying searching criteria.- Returns:
- a window
- Throws:
TimeoutExpiredException
-
setOutput
public void setOutput(TestOut out)
Description copied from interface:Outputable
Defines print output streams or writers.- Specified by:
setOutput
in interfaceOutputable
- Overrides:
setOutput
in classContainerOperator
- 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 interfaceOutputable
- Overrides:
getOutput
in classContainerOperator
- 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 classComponentOperator
- Parameters:
anotherOperator
- an operator to copy the environment to.
-
activate
public void activate()
Activates the window. Uses WindowDriver registered for the operator type.
-
requestClose
public void requestClose()
Requests the window to close. Uses WindowDriver registered for the operator type.
-
requestCloseAndThenHide
public void requestCloseAndThenHide()
Closes a window by requesting it to close and then hiding it. Not implemented for internal frames at the moment. Uses WindowDriver registered for the operator type.- See Also:
requestClose()
-
close
public void close()
Deprecated.Use requestClose(). It is the target window's responsibility to hide itself if needed. Or, if you really have to, use requestCloseAndThenHide().Closes a window by requesting it to close and then, if it's a top-level frame, hiding it. Uses WindowDriver registered for the operator type.- See Also:
requestClose()
,requestCloseAndThenHide()
-
move
public void move(int x, int y)
Moves the window to another location. Uses WindowDriver registered for the operator type.- Parameters:
x
- coordinate in screen coordinate systemy
- coordinate in screen coordinate system
-
resize
public void resize(int width, int height)
Resizes the window. Uses WindowDriver registered for the operator type.- Parameters:
width
- new widthheight
- new height
-
findSubWindow
public Window findSubWindow(ComponentChooser chooser, int index)
Searches an index'th window between windows owned by this window.- Parameters:
chooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.- Returns:
- a subwindow
-
findSubWindow
public Window findSubWindow(ComponentChooser chooser)
Searches a window between windows owned by this window.- Parameters:
chooser
- a component chooser specifying searching criteria.- Returns:
- a subwindow
-
waitSubWindow
public Window waitSubWindow(ComponentChooser chooser, int index)
Waits an index'th window between windows owned by this window.- Parameters:
chooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.- Returns:
- a subwindow
-
waitSubWindow
public Window waitSubWindow(ComponentChooser chooser)
Waits a window between windows owned by this window.- Parameters:
chooser
- a component chooser specifying searching criteria.- Returns:
- a subwindow
-
waitClosed
public void waitClosed()
Waits the window to be closed.
-
addWindowListener
public void addWindowListener(WindowListener windowListener)
MapsWindow.addWindowListener(WindowListener)
through queue
-
applyResourceBundle
public void applyResourceBundle(String string)
MapsWindow.applyResourceBundle(String)
through queue
-
applyResourceBundle
public void applyResourceBundle(ResourceBundle resourceBundle)
MapsWindow.applyResourceBundle(ResourceBundle)
through queue
-
dispose
public void dispose()
MapsWindow.dispose()
through queue
-
getFocusOwner
public Component getFocusOwner()
MapsWindow.getFocusOwner()
through queue
-
getOwnedWindows
public Window[] getOwnedWindows()
MapsWindow.getOwnedWindows()
through queue
-
getOwner
public Window getOwner()
MapsWindow.getOwner()
through queue
-
getWarningString
public String getWarningString()
MapsWindow.getWarningString()
through queue
-
pack
public void pack()
MapsWindow.pack()
through queue
-
removeWindowListener
public void removeWindowListener(WindowListener windowListener)
MapsWindow.removeWindowListener(WindowListener)
through queue
-
toBack
public void toBack()
MapsWindow.toBack()
through queue
-
toFront
public void toFront()
MapsWindow.toFront()
through queue
-
isFocused
public boolean isFocused()
MapsWindow.isFocused()
through queue.- Returns:
- result of the mapped method
-
isActive
public boolean isActive()
MapsWindow.isActive()
through queue.- Returns:
- result of the mapped method
-
waitWindow
protected static Window waitWindow(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.
-
waitWindow
protected static Window waitWindow(WindowOperator owner, ComponentChooser chooser, int index)
A method to be used from subclasses. Usesowner
'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.
-
waitWindow
protected static Window waitWindow(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.
-
-