Class 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:
  • Constructor Details

    • 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 - owner
      chooser - 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 - owner
      chooser - 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:
    • WindowOperator

      public WindowOperator()
      Constructor. Waits for the first displayed window. Uses current timeouts and output values.
      Throws:
      TimeoutExpiredException
      See Also:
  • Method Details

    • 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 interface Outputable
      Overrides:
      setOutput in class ContainerOperator
      Parameters:
      out - Identify the streams or writers used for print output.
      See Also:
    • 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 ContainerOperator
      Returns:
      an object that contains references to objects for printing to output and err streams.
      See Also:
    • 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
      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:
    • 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:
    • 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 system
      y - 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 width
      height - 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)
      Maps Window.addWindowListener(WindowListener) through queue
    • applyResourceBundle

      public void applyResourceBundle(String string)
      Maps Window.applyResourceBundle(String) through queue
    • applyResourceBundle

      public void applyResourceBundle(ResourceBundle resourceBundle)
      Maps Window.applyResourceBundle(ResourceBundle) through queue
    • dispose

      public void dispose()
      Maps Window.dispose() through queue
    • getFocusOwner

      public Component getFocusOwner()
      Maps Window.getFocusOwner() through queue
    • getOwnedWindows

      public Window[] getOwnedWindows()
      Maps Window.getOwnedWindows() through queue
    • getOwner

      public Window getOwner()
      Maps Window.getOwner() through queue
    • getWarningString

      public String getWarningString()
      Maps Window.getWarningString() through queue
    • pack

      public void pack()
      Maps Window.pack() through queue
    • removeWindowListener

      public void removeWindowListener(WindowListener windowListener)
      Maps Window.removeWindowListener(WindowListener) through queue
    • toBack

      public void toBack()
      Maps Window.toBack() through queue
    • toFront

      public void toFront()
      Maps Window.toFront() through queue
    • isFocused

      public boolean isFocused()
      Maps Window.isFocused() through queue.
      Returns:
      result of the mapped method
    • isActive

      public boolean isActive()
      Maps Window.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. 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.
    • 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.