Class JComponentOperator

All Implemented Interfaces:
Outputable, Timeoutable
Direct Known Subclasses:
AbstractButtonOperator, JColorChooserOperator, JComboBoxOperator, JFileChooserOperator, JInternalFrameOperator, JInternalFrameOperator.JDesktopIconOperator, JLabelOperator, JListOperator, JMenuBarOperator, JPopupMenuOperator, JProgressBarOperator, JScrollBarOperator, JScrollPaneOperator, JSliderOperator, JSpinnerOperator, JSplitPaneOperator, JTabbedPaneOperator, JTableHeaderOperator, JTableOperator, JTextComponentOperator, JTreeOperator

public class JComponentOperator extends ContainerOperator implements Timeoutable, Outputable


Timeouts used:
JComponentOperator.WaitToolTipTimeout - time to wait tool tip displayed
JComponentOperator.ShowToolTipTimeout - time to show tool tip
ComponentOperator.WaitComponentTimeout - time to wait component displayed
.
Author:
Alexandre Iline (alexandre.iline@sun.com)
See Also:
  • Field Details

  • Constructor Details

    • JComponentOperator

      public JComponentOperator(JComponent b)
      Constructor.
      Parameters:
      b - a component
    • JComponentOperator

      public JComponentOperator(ContainerOperator cont, ComponentChooser chooser, int index)
      Constructs a JComponentOperator object.
      Parameters:
      cont - a container
      chooser - a component chooser specifying searching criteria.
      index - an index between appropriate ones.
    • JComponentOperator

      public JComponentOperator(ContainerOperator cont, ComponentChooser chooser)
      Constructs a JComponentOperator object.
      Parameters:
      cont - a container
      chooser - a component chooser specifying searching criteria.
    • JComponentOperator

      public JComponentOperator(ContainerOperator cont, int index)
      Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.
      Parameters:
      cont - Operator pointing a container to search component in.
      index - Ordinal component index.
      Throws:
      TimeoutExpiredException
    • JComponentOperator

      public JComponentOperator(ContainerOperator cont)
      Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.
      Parameters:
      cont - Operator pointing a container to search component in.
      Throws:
      TimeoutExpiredException
  • Method Details

    • findJComponent

      public static JComponent findJComponent(Container cont, ComponentChooser chooser, int index)
      Searches JComponent in container.
      Parameters:
      cont - Container to search component in.
      chooser - org.netbeans.jemmy.ComponentChooser implementation.
      index - Ordinal component index.
      Returns:
      JComponent instance or null if component was not found.
    • findJComponent

      public static JComponent findJComponent(Container cont, ComponentChooser chooser)
      Searches 0'th JComponent in container.
      Parameters:
      cont - Container to search component in.
      chooser - org.netbeans.jemmy.ComponentChooser implementation.
      Returns:
      JComponent instance or null if component was not found.
    • findJComponent

      public static JComponent findJComponent(Container cont, String toolTipText, boolean ce, boolean ccs, int index)
      Searches JComponent by tooltip text.
      Parameters:
      cont - Container to search component in.
      toolTipText - Tooltip text. If null, contents is not checked.
      ce - Compare text exactly.
      ccs - Compare text case sensitively.
      index - Ordinal component index.
      Returns:
      JComponent instance or null if component was not found.
      See Also:
    • findJComponent

      public static JComponent findJComponent(Container cont, String toolTipText, boolean ce, boolean ccs)
      Searches JComponent by tooltip text.
      Parameters:
      cont - Container to search component in.
      toolTipText - Tooltip text. If null, contents is not checked.
      ce - Compare text exactly.
      ccs - Compare text case sensitively.
      Returns:
      JComponent instance or null if component was not found.
      See Also:
    • waitJComponent

      public static JComponent waitJComponent(Container cont, ComponentChooser chooser, int index)
      Waits JComponent in container.
      Parameters:
      cont - Container to search component in.
      chooser - org.netbeans.jemmy.ComponentChooser implementation.
      index - Ordinal component index.
      Returns:
      JComponent instance or null if component was not found.
      Throws:
      TimeoutExpiredException
    • waitJComponent

      public static JComponent waitJComponent(Container cont, ComponentChooser chooser)
      Waits 0'th JComponent in container.
      Parameters:
      cont - Container to search component in.
      chooser - org.netbeans.jemmy.ComponentChooser implementation.
      Returns:
      JComponent instance or null if component was not found.
      Throws:
      TimeoutExpiredException
    • waitJComponent

      public static JComponent waitJComponent(Container cont, String toolTipText, boolean ce, boolean ccs, int index)
      Waits JComponent by tooltip text.
      Parameters:
      cont - Container to search component in.
      toolTipText - Tooltip text. If null, contents is not checked.
      ce - Compare text exactly.
      ccs - Compare text case sensitively.
      index - Ordinal component index.
      Returns:
      JComponent instance or null if component was not found.
      Throws:
      TimeoutExpiredException
      See Also:
    • waitJComponent

      public static JComponent waitJComponent(Container cont, String toolTipText, boolean ce, boolean ccs)
      Waits JComponent by tooltip text.
      Parameters:
      cont - Container to search component in.
      toolTipText - Tooltip text. If null, contents is not checked.
      ce - Compare text exactly.
      ccs - Compare text case sensitively.
      Returns:
      JComponent instance or null if component was not found.
      Throws:
      TimeoutExpiredException
      See Also:
    • setTimeouts

      public void setTimeouts(Timeouts timeouts)
      Description copied from interface: Timeoutable
      Defines current timeouts.
      Specified by:
      setTimeouts in interface Timeoutable
      Overrides:
      setTimeouts in class ContainerOperator
      Parameters:
      timeouts - A collection of timeout assignments.
      See Also:
    • getTimeouts

      public Timeouts getTimeouts()
      Description copied from interface: Timeoutable
      Return current timeouts.
      Specified by:
      getTimeouts in interface Timeoutable
      Overrides:
      getTimeouts in class ContainerOperator
      Returns:
      the collection of current timeout assignments.
      See Also:
    • 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:
    • getCenterXForClick

      public int getCenterXForClick()
      Description copied from class: ComponentOperator
      Return the x coordinate which should be used for mouse operations by default.
      Overrides:
      getCenterXForClick in class ComponentOperator
      Returns:
      the center x coordinate of the visible component part.
    • getCenterYForClick

      public int getCenterYForClick()
      Description copied from class: ComponentOperator
      Return the y coordinate which should be used for mouse operations by default.
      Overrides:
      getCenterYForClick in class ComponentOperator
      Returns:
      the center y coordinate of the visible component part.
    • showToolTip

      public JToolTip showToolTip()
      Showes tool tip.
      Returns:
      JToolTip component.
      Throws:
      TimeoutExpiredException
    • waitToolTip

      public JToolTip waitToolTip()
    • getWindowContainerOperator

      public ContainerOperator getWindowContainerOperator()
      Looks for a first window-like container.
      Returns:
      either WindowOperator of JInternalFrameOperator
    • getDump

      public Hashtable getDump()
      Description copied from class: ComponentOperator
      Returns information about component.
      Overrides:
      getDump in class ComponentOperator
      Returns:
      a Hashtable containing name-value pairs.
    • addAncestorListener

      public void addAncestorListener(AncestorListener ancestorListener)
      Maps JComponent.addAncestorListener(AncestorListener) through queue
    • addVetoableChangeListener

      public void addVetoableChangeListener(VetoableChangeListener vetoableChangeListener)
      Maps JComponent.addVetoableChangeListener(VetoableChangeListener) through queue
    • computeVisibleRect

      public void computeVisibleRect(Rectangle rectangle)
      Maps JComponent.computeVisibleRect(Rectangle) through queue
    • createToolTip

      public JToolTip createToolTip()
      Maps JComponent.createToolTip() through queue
    • firePropertyChange

      public void firePropertyChange(String string, byte b, byte b1)
      Maps JComponent.firePropertyChange(String, byte, byte) through queue
    • firePropertyChange

      public void firePropertyChange(String string, char c, char c1)
      Maps JComponent.firePropertyChange(String, char, char) through queue
    • firePropertyChange

      public void firePropertyChange(String string, double d, double d1)
      Maps JComponent.firePropertyChange(String, double, double) through queue
    • firePropertyChange

      public void firePropertyChange(String string, float f, float f1)
      Maps JComponent.firePropertyChange(String, float, float) through queue
    • firePropertyChange

      public void firePropertyChange(String string, int i, int i1)
      Maps JComponent.firePropertyChange(String, int, int) through queue
    • firePropertyChange

      public void firePropertyChange(String string, long l, long l1)
      Maps JComponent.firePropertyChange(String, long, long) through queue
    • firePropertyChange

      public void firePropertyChange(String string, short s, short s1)
      Maps JComponent.firePropertyChange(String, short, short) through queue
    • firePropertyChange

      public void firePropertyChange(String string, boolean b, boolean b1)
      Maps JComponent.firePropertyChange(String, boolean, boolean) through queue
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Maps JComponent.getAccessibleContext() through queue
    • getActionForKeyStroke

      public ActionListener getActionForKeyStroke(KeyStroke keyStroke)
      Maps JComponent.getActionForKeyStroke(KeyStroke) through queue
    • getAutoscrolls

      public boolean getAutoscrolls()
      Maps JComponent.getAutoscrolls() through queue
    • getBorder

      public Border getBorder()
      Maps JComponent.getBorder() through queue
    • getClientProperty

      public Object getClientProperty(Object object)
      Maps JComponent.getClientProperty(Object) through queue
    • getConditionForKeyStroke

      public int getConditionForKeyStroke(KeyStroke keyStroke)
      Maps JComponent.getConditionForKeyStroke(KeyStroke) through queue
    • getDebugGraphicsOptions

      public int getDebugGraphicsOptions()
      Maps JComponent.getDebugGraphicsOptions() through queue
    • getInsets

      public Insets getInsets(Insets insets)
      Maps JComponent.getInsets(Insets) through queue
    • getNextFocusableComponent

      public Component getNextFocusableComponent()
      Maps JComponent.getNextFocusableComponent() through queue
    • getRegisteredKeyStrokes

      public KeyStroke[] getRegisteredKeyStrokes()
      Maps JComponent.getRegisteredKeyStrokes() through queue
    • getRootPane

      public JRootPane getRootPane()
      Maps JComponent.getRootPane() through queue
    • getToolTipLocation

      public Point getToolTipLocation(MouseEvent mouseEvent)
      Maps JComponent.getToolTipLocation(MouseEvent) through queue
    • getToolTipText

      public String getToolTipText()
      Maps JComponent.getToolTipText() through queue
    • getToolTipText

      public String getToolTipText(MouseEvent mouseEvent)
      Maps JComponent.getToolTipText(MouseEvent) through queue
    • getTopLevelAncestor

      public Container getTopLevelAncestor()
      Maps JComponent.getTopLevelAncestor() through queue
    • getUIClassID

      public String getUIClassID()
      Maps JComponent.getUIClassID() through queue
    • getVisibleRect

      public Rectangle getVisibleRect()
      Maps JComponent.getVisibleRect() through queue
    • grabFocus

      public void grabFocus()
      Maps JComponent.grabFocus() through queue
    • isFocusCycleRoot

      public boolean isFocusCycleRoot()
      Maps JComponent.isFocusCycleRoot() through queue
    • isManagingFocus

      public boolean isManagingFocus()
      Maps JComponent.isManagingFocus() through queue
    • isOptimizedDrawingEnabled

      public boolean isOptimizedDrawingEnabled()
      Maps JComponent.isOptimizedDrawingEnabled() through queue
    • isPaintingTile

      public boolean isPaintingTile()
      Maps JComponent.isPaintingTile() through queue
    • isRequestFocusEnabled

      public boolean isRequestFocusEnabled()
      Maps JComponent.isRequestFocusEnabled() through queue
    • isValidateRoot

      public boolean isValidateRoot()
      Maps JComponent.isValidateRoot() through queue
    • paintImmediately

      public void paintImmediately(int i, int i1, int i2, int i3)
      Maps JComponent.paintImmediately(int, int, int, int) through queue
    • paintImmediately

      public void paintImmediately(Rectangle rectangle)
      Maps JComponent.paintImmediately(Rectangle) through queue
    • putClientProperty

      public void putClientProperty(Object object, Object object1)
      Maps JComponent.putClientProperty(Object, Object) through queue
    • registerKeyboardAction

      public void registerKeyboardAction(ActionListener actionListener, String string, KeyStroke keyStroke, int i)
      Maps JComponent.registerKeyboardAction(ActionListener, String, KeyStroke, int) through queue
    • registerKeyboardAction

      public void registerKeyboardAction(ActionListener actionListener, KeyStroke keyStroke, int i)
      Maps JComponent.registerKeyboardAction(ActionListener, KeyStroke, int) through queue
    • removeAncestorListener

      public void removeAncestorListener(AncestorListener ancestorListener)
      Maps JComponent.removeAncestorListener(AncestorListener) through queue
    • removeVetoableChangeListener

      public void removeVetoableChangeListener(VetoableChangeListener vetoableChangeListener)
      Maps JComponent.removeVetoableChangeListener(VetoableChangeListener) through queue
    • repaint

      public void repaint(Rectangle rectangle)
      Maps JComponent.repaint(Rectangle) through queue
    • requestDefaultFocus

      public boolean requestDefaultFocus()
      Maps JComponent.requestDefaultFocus() through queue
    • resetKeyboardActions

      public void resetKeyboardActions()
      Maps JComponent.resetKeyboardActions() through queue
    • revalidate

      public void revalidate()
      Maps JComponent.revalidate() through queue
    • scrollRectToVisible

      public void scrollRectToVisible(Rectangle rectangle)
      Maps JComponent.scrollRectToVisible(Rectangle) through queue
    • setAlignmentX

      public void setAlignmentX(float f)
      Maps JComponent.setAlignmentX(float) through queue
    • setAlignmentY

      public void setAlignmentY(float f)
      Maps JComponent.setAlignmentY(float) through queue
    • setAutoscrolls

      public void setAutoscrolls(boolean b)
      Maps JComponent.setAutoscrolls(boolean) through queue
    • setBorder

      public void setBorder(Border border)
      Maps JComponent.setBorder(Border) through queue
    • setDebugGraphicsOptions

      public void setDebugGraphicsOptions(int i)
      Maps JComponent.setDebugGraphicsOptions(int) through queue
    • setDoubleBuffered

      public void setDoubleBuffered(boolean b)
      Maps JComponent.setDoubleBuffered(boolean) through queue
    • setMaximumSize

      public void setMaximumSize(Dimension dimension)
      Maps JComponent.setMaximumSize(Dimension) through queue
    • setMinimumSize

      public void setMinimumSize(Dimension dimension)
      Maps JComponent.setMinimumSize(Dimension) through queue
    • setNextFocusableComponent

      public void setNextFocusableComponent(Component component)
      Maps JComponent.setNextFocusableComponent(Component) through queue
    • setOpaque

      public void setOpaque(boolean b)
      Maps JComponent.setOpaque(boolean) through queue
    • setPreferredSize

      public void setPreferredSize(Dimension dimension)
      Maps JComponent.setPreferredSize(Dimension) through queue
    • setRequestFocusEnabled

      public void setRequestFocusEnabled(boolean b)
      Maps JComponent.setRequestFocusEnabled(boolean) through queue
    • setToolTipText

      public void setToolTipText(String string)
      Maps JComponent.setToolTipText(String) through queue
    • unregisterKeyboardAction

      public void unregisterKeyboardAction(KeyStroke keyStroke)
      Maps JComponent.unregisterKeyboardAction(KeyStroke) through queue
    • updateUI

      public void updateUI()
      Maps JComponent.updateUI() through queue