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:
    Timeouts
    • Constructor Detail

      • AbstractButtonOperator

        public AbstractButtonOperator​(javax.swing.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,
                                      java.lang.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:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • AbstractButtonOperator

        public AbstractButtonOperator​(ContainerOperator cont,
                                      java.lang.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:
        Operator.isCaptionEqual(String, String, boolean, boolean)
    • Method Detail

      • findAbstractButton

        public static javax.swing.AbstractButton findAbstractButton​(java.awt.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 javax.swing.AbstractButton findAbstractButton​(java.awt.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 javax.swing.AbstractButton findAbstractButton​(java.awt.Container cont,
                                                                    java.lang.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:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • findAbstractButton

        public static javax.swing.AbstractButton findAbstractButton​(java.awt.Container cont,
                                                                    java.lang.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:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • waitAbstractButton

        public static javax.swing.AbstractButton waitAbstractButton​(java.awt.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 javax.swing.AbstractButton waitAbstractButton​(java.awt.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 javax.swing.AbstractButton waitAbstractButton​(java.awt.Container cont,
                                                                    java.lang.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:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • waitAbstractButton

        public static javax.swing.AbstractButton waitAbstractButton​(java.awt.Container cont,
                                                                    java.lang.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:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • 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.
      • waitSelected

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

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

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

        public void addActionListener​(java.awt.event.ActionListener actionListener)
        Maps AbstractButton.addActionListener(ActionListener) through queue
      • addChangeListener

        public void addChangeListener​(javax.swing.event.ChangeListener changeListener)
        Maps AbstractButton.addChangeListener(ChangeListener) through queue
      • addItemListener

        public void addItemListener​(java.awt.event.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 java.lang.String getActionCommand()
        Maps AbstractButton.getActionCommand() through queue
      • getDisabledIcon

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

        public javax.swing.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 javax.swing.Icon getIcon()
        Maps AbstractButton.getIcon() through queue
      • getMargin

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

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

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

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

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

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

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

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

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

        public javax.swing.plaf.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​(java.awt.event.ActionListener actionListener)
        Maps AbstractButton.removeActionListener(ActionListener) through queue
      • removeChangeListener

        public void removeChangeListener​(javax.swing.event.ChangeListener changeListener)
        Maps AbstractButton.removeChangeListener(ChangeListener) through queue
      • removeItemListener

        public void removeItemListener​(java.awt.event.ItemListener itemListener)
        Maps AbstractButton.removeItemListener(ItemListener) through queue
      • setActionCommand

        public void setActionCommand​(java.lang.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​(javax.swing.Icon icon)
        Maps AbstractButton.setDisabledIcon(Icon) through queue
      • setDisabledSelectedIcon

        public void setDisabledSelectedIcon​(javax.swing.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​(javax.swing.Icon icon)
        Maps AbstractButton.setIcon(Icon) through queue
      • setMargin

        public void setMargin​(java.awt.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​(javax.swing.ButtonModel buttonModel)
        Maps AbstractButton.setModel(ButtonModel) through queue
      • setPressedIcon

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

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

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

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

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

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

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

        public void setUI​(javax.swing.plaf.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