Class AbstractButtonOperator

All Implemented Interfaces:
Outputable, Timeoutable
Direct Known Subclasses:
JButtonOperator, JMenuItemOperator, JToggleButtonOperator

public class AbstractButtonOperator extends JComponentOperator implements Timeoutable, Outputable


Timeouts used:
AbstractButtonOperator.PushButtonTimeout - time between button pressing and releasing
ComponentOperator.WaitComponentTimeout - time to wait button displayed
ComponentOperator.WaitComponentEnabledTimeout - time to wait button enabled
ComponentOperator.WaitStateTimeout - time to wait for text
.
Author:
Alexandre Iline (alexandre.iline@sun.com)
See Also:
  • Field Details

  • Constructor Details

    • AbstractButtonOperator

      public AbstractButtonOperator(AbstractButton b)
      Constructor.
      Parameters:
      b - The java.awt.AbstractButton managed by this instance.
    • AbstractButtonOperator

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

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

      public AbstractButtonOperator(ContainerOperator cont, String text, int index)
      Constructor. Waits for a component in a container to show. The component is identified as the index+1'th javax.swing.AbstractButton that shows, lies below the container in the display containment hierarchy, and that has the desired text. Uses cont's timeout and output for waiting and to init this operator.
      Parameters:
      cont - The operator for a container containing the sought for button.
      text - Button text.
      index - Ordinal component index. The first component has index 0.
      Throws:
      TimeoutExpiredException
      See Also:
    • AbstractButtonOperator

      public AbstractButtonOperator(ContainerOperator cont, String text)
      Constructor. Waits for a component in a container to show. The component is identified as the first javax.swing.AbstractButton that shows, lies below the container in the display containment hierarchy, and that has the desired text. Uses cont's timeout and output for waiting and to init this operator.
      Parameters:
      cont - The operator for a container containing the sought for button.
      text - Button text.
      Throws:
      TimeoutExpiredException
      See Also:
    • AbstractButtonOperator

      public AbstractButtonOperator(ContainerOperator cont, int index)
      Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.
      Parameters:
      cont - The operator for a container containing the sought for button.
      index - Ordinal component index.
      Throws:
      TimeoutExpiredException
      See Also:
    • AbstractButtonOperator

      public AbstractButtonOperator(ContainerOperator cont)
      Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.
      Parameters:
      cont - The operator for a container containing the sought for button.
      Throws:
      TimeoutExpiredException
      See Also:
  • Method Details

    • findAbstractButton

      public static AbstractButton findAbstractButton(Container cont, ComponentChooser chooser, int index)
      Searches AbstractButton in a container.
      Parameters:
      cont - Container in which to search for the component. The container lies above the component in the display containment hierarchy. The containment need not be direct.
      chooser - org.netbeans.jemmy.ComponentChooser implementation, defining and applying search criteria.
      index - Ordinal component index. The first index is 0.
      Returns:
      AbstractButton instance or null if component was not found.
    • findAbstractButton

      public static AbstractButton findAbstractButton(Container cont, ComponentChooser chooser)
      Searches for the first AbstractButton in a container.
      Parameters:
      cont - Container in which to search for the component. The container lies above the component in the display containment hierarchy. The containment need not be direct.
      chooser - org.netbeans.jemmy.ComponentChooser implementation, defining and applying search criteria.
      Returns:
      AbstractButton instance or null if component was not found.
    • findAbstractButton

      public static AbstractButton findAbstractButton(Container cont, String text, boolean ce, boolean ccs, int index)
      Searches AbstractButton 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:
      AbstractButton instance or null if component was not found.
      See Also:
    • findAbstractButton

      public static AbstractButton findAbstractButton(Container cont, String text, boolean ce, boolean ccs)
      Searches AbstractButton 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:
      AbstractButton instance or null if component was not found.
      See Also:
    • waitAbstractButton

      public static AbstractButton waitAbstractButton(Container cont, ComponentChooser chooser, int index)
      Waits AbstractButton in container.
      Parameters:
      cont - Container to search component in.
      chooser - org.netbeans.jemmy.ComponentChooser implementation.
      index - Ordinal component index.
      Returns:
      AbstractButton instance.
      Throws:
      TimeoutExpiredException
    • waitAbstractButton

      public static AbstractButton waitAbstractButton(Container cont, ComponentChooser chooser)
      Waits 0'th AbstractButton in container.
      Parameters:
      cont - Container to search component in.
      chooser - org.netbeans.jemmy.ComponentChooser implementation.
      Returns:
      AbstractButton instance.
      Throws:
      TimeoutExpiredException
    • waitAbstractButton

      public static AbstractButton waitAbstractButton(Container cont, String text, boolean ce, boolean ccs, int index)
      Waits AbstractButton 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:
      AbstractButton instance.
      Throws:
      TimeoutExpiredException
      See Also:
    • waitAbstractButton

      public static AbstractButton waitAbstractButton(Container cont, String text, boolean ce, boolean ccs)
      Waits AbstractButton 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:
      AbstractButton instance.
      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 JComponentOperator
      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 JComponentOperator
      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 JComponentOperator
      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 JComponentOperator
      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.
    • push

      public void push()
      Pushs the button using a ButtonDriver registered for this operator.
    • pushNoBlock

      public void pushNoBlock()
      Runs push() method in a separate thread.
    • changeSelection

      public void changeSelection(boolean selected)
      Changes selection if necessary. Uses push() method in order to do so.
      Parameters:
      selected - a button selection.
    • changeSelectionNoBlock

      public void changeSelectionNoBlock(boolean selected)
      Runs changeSelection(boolean) method in a separate thread.
      Parameters:
      selected - a button selection.
    • press

      public void press()
      Press the button by mouse.
      Throws:
      TimeoutExpiredException
    • release

      public void release()
      Releases the button by mouse.
      Throws:
      TimeoutExpiredException
    • waitSelected

      public void waitSelected(boolean selected)
      Waits for button to be selected.
      Parameters:
      selected - a button selection.
    • waitText

      public void waitText(String text)
      Waits for text. Uses getComparator() comparator.
      Parameters:
      text - Text to wait for.
    • getDump

      public Hashtable getDump()
      Returns information about component.
      Overrides:
      getDump in class JComponentOperator
      Returns:
      a Hashtable containing name-value pairs.
    • addActionListener

      public void addActionListener(ActionListener actionListener)
      Maps AbstractButton.addActionListener(ActionListener) through queue
    • addChangeListener

      public void addChangeListener(ChangeListener changeListener)
      Maps AbstractButton.addChangeListener(ChangeListener) through queue
    • addItemListener

      public void addItemListener(ItemListener itemListener)
      Maps AbstractButton.addItemListener(ItemListener) through queue
    • doClick

      public void doClick()
      Maps AbstractButton.doClick() through queue
    • doClick

      public void doClick(int i)
      Maps AbstractButton.doClick(int) through queue
    • getActionCommand

      public String getActionCommand()
      Maps AbstractButton.getActionCommand() through queue
    • getDisabledIcon

      public Icon getDisabledIcon()
      Maps AbstractButton.getDisabledIcon() through queue
    • getDisabledSelectedIcon

      public Icon getDisabledSelectedIcon()
      Maps AbstractButton.getDisabledSelectedIcon() through queue
    • getHorizontalAlignment

      public int getHorizontalAlignment()
      Maps AbstractButton.getHorizontalAlignment() through queue
    • getHorizontalTextPosition

      public int getHorizontalTextPosition()
      Maps AbstractButton.getHorizontalTextPosition() through queue
    • getIcon

      public Icon getIcon()
      Maps AbstractButton.getIcon() through queue
    • getMargin

      public Insets getMargin()
      Maps AbstractButton.getMargin() through queue
    • getMnemonic

      public int getMnemonic()
      Maps AbstractButton.getMnemonic() through queue
    • getModel

      public ButtonModel getModel()
      Maps AbstractButton.getModel() through queue
    • getPressedIcon

      public Icon getPressedIcon()
      Maps AbstractButton.getPressedIcon() through queue
    • getRolloverIcon

      public Icon getRolloverIcon()
      Maps AbstractButton.getRolloverIcon() through queue
    • getRolloverSelectedIcon

      public Icon getRolloverSelectedIcon()
      Maps AbstractButton.getRolloverSelectedIcon() through queue
    • getSelectedIcon

      public Icon getSelectedIcon()
      Maps AbstractButton.getSelectedIcon() through queue
    • getSelectedObjects

      public Object[] getSelectedObjects()
      Maps AbstractButton.getSelectedObjects() through queue
    • getText

      public String getText()
      Maps AbstractButton.getText() through queue
    • getUI

      public ButtonUI getUI()
      Maps AbstractButton.getUI() through queue
    • getVerticalAlignment

      public int getVerticalAlignment()
      Maps AbstractButton.getVerticalAlignment() through queue
    • getVerticalTextPosition

      public int getVerticalTextPosition()
      Maps AbstractButton.getVerticalTextPosition() through queue
    • isBorderPainted

      public boolean isBorderPainted()
      Maps AbstractButton.isBorderPainted() through queue
    • isContentAreaFilled

      public boolean isContentAreaFilled()
      Maps AbstractButton.isContentAreaFilled() through queue
    • isFocusPainted

      public boolean isFocusPainted()
      Maps AbstractButton.isFocusPainted() through queue
    • isRolloverEnabled

      public boolean isRolloverEnabled()
      Maps AbstractButton.isRolloverEnabled() through queue
    • isSelected

      public boolean isSelected()
      Maps AbstractButton.isSelected() through queue
    • removeActionListener

      public void removeActionListener(ActionListener actionListener)
      Maps AbstractButton.removeActionListener(ActionListener) through queue
    • removeChangeListener

      public void removeChangeListener(ChangeListener changeListener)
      Maps AbstractButton.removeChangeListener(ChangeListener) through queue
    • removeItemListener

      public void removeItemListener(ItemListener itemListener)
      Maps AbstractButton.removeItemListener(ItemListener) through queue
    • setActionCommand

      public void setActionCommand(String string)
      Maps AbstractButton.setActionCommand(String) through queue
    • setBorderPainted

      public void setBorderPainted(boolean b)
      Maps AbstractButton.setBorderPainted(boolean) through queue
    • setContentAreaFilled

      public void setContentAreaFilled(boolean b)
      Maps AbstractButton.setContentAreaFilled(boolean) through queue
    • setDisabledIcon

      public void setDisabledIcon(Icon icon)
      Maps AbstractButton.setDisabledIcon(Icon) through queue
    • setDisabledSelectedIcon

      public void setDisabledSelectedIcon(Icon icon)
      Maps AbstractButton.setDisabledSelectedIcon(Icon) through queue
    • setFocusPainted

      public void setFocusPainted(boolean b)
      Maps AbstractButton.setFocusPainted(boolean) through queue
    • setHorizontalAlignment

      public void setHorizontalAlignment(int i)
      Maps AbstractButton.setHorizontalAlignment(int) through queue
    • setHorizontalTextPosition

      public void setHorizontalTextPosition(int i)
      Maps AbstractButton.setHorizontalTextPosition(int) through queue
    • setIcon

      public void setIcon(Icon icon)
      Maps AbstractButton.setIcon(Icon) through queue
    • setMargin

      public void setMargin(Insets insets)
      Maps AbstractButton.setMargin(Insets) through queue
    • setMnemonic

      public void setMnemonic(char c)
      Maps AbstractButton.setMnemonic(char) through queue
    • setMnemonic

      public void setMnemonic(int i)
      Maps AbstractButton.setMnemonic(int) through queue
    • setModel

      public void setModel(ButtonModel buttonModel)
      Maps AbstractButton.setModel(ButtonModel) through queue
    • setPressedIcon

      public void setPressedIcon(Icon icon)
      Maps AbstractButton.setPressedIcon(Icon) through queue
    • setRolloverEnabled

      public void setRolloverEnabled(boolean b)
      Maps AbstractButton.setRolloverEnabled(boolean) through queue
    • setRolloverIcon

      public void setRolloverIcon(Icon icon)
      Maps AbstractButton.setRolloverIcon(Icon) through queue
    • setRolloverSelectedIcon

      public void setRolloverSelectedIcon(Icon icon)
      Maps AbstractButton.setRolloverSelectedIcon(Icon) through queue
    • setSelected

      public void setSelected(boolean b)
      Maps AbstractButton.setSelected(boolean) through queue
    • setSelectedIcon

      public void setSelectedIcon(Icon icon)
      Maps AbstractButton.setSelectedIcon(Icon) through queue
    • setText

      public void setText(String string)
      Maps AbstractButton.setText(String) through queue
    • setUI

      public void setUI(ButtonUI buttonUI)
      Maps AbstractButton.setUI(ButtonUI) through queue
    • setVerticalAlignment

      public void setVerticalAlignment(int i)
      Maps AbstractButton.setVerticalAlignment(int) through queue
    • setVerticalTextPosition

      public void setVerticalTextPosition(int i)
      Maps AbstractButton.setVerticalTextPosition(int) through queue