Class TextComponentOperator

    • Constructor Detail

      • TextComponentOperator

        public TextComponentOperator​(TextComponent b)
        Constructor.
        Parameters:
        b - The java.awt.TextComponent managed by this instance.
      • TextComponentOperator

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

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

        public TextComponentOperator​(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 java.awt.TextComponent 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 textComponent.
        text - TextComponent text.
        index - Ordinal component index. The first component has index 0.
        See Also:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • TextComponentOperator

        public TextComponentOperator​(ContainerOperator cont,
                                     String text)
        Constructor. Waits for a component in a container to show. The component is identified as the first java.awt.TextComponent 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 textComponent.
        text - TextComponent text.
        See Also:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • TextComponentOperator

        public TextComponentOperator​(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 textComponent.
        index - Ordinal component index.
        See Also:
        Operator.isCaptionEqual(String, String, boolean, boolean)
    • Method Detail

      • findTextComponent

        public static TextComponent findTextComponent​(Container cont,
                                                      ComponentChooser chooser,
                                                      int index)
        Searches TextComponent 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:
        TextComponent instance or null if component was not found.
      • findTextComponent

        public static TextComponent findTextComponent​(Container cont,
                                                      ComponentChooser chooser)
        Searches for the first TextComponent 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:
        TextComponent instance or null if component was not found.
      • findTextComponent

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

        public static TextComponent findTextComponent​(Container cont,
                                                      String text,
                                                      boolean ce,
                                                      boolean ccs)
        Searches TextComponent by text.
        Parameters:
        cont - Container to search component in.
        text - TextComponent text. If null, contents is not checked.
        ce - Compare text exactly.
        ccs - Compare text case sensitively.
        Returns:
        TextComponent instance or null if component was not found.
        See Also:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • waitTextComponent

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

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

        public static TextComponent waitTextComponent​(Container cont,
                                                      String text,
                                                      boolean ce,
                                                      boolean ccs,
                                                      int index)
        Waits TextComponent by text.
        Parameters:
        cont - Container to search component in.
        text - TextComponent text. If null, contents is not checked.
        ce - Compare text exactly.
        ccs - Compare text case sensitively.
        index - Ordinal component index.
        Returns:
        TextComponent instance.
        See Also:
        Operator.isCaptionEqual(String, String, boolean, boolean)
      • waitTextComponent

        public static TextComponent waitTextComponent​(Container cont,
                                                      String text,
                                                      boolean ce,
                                                      boolean ccs)
        Waits TextComponent by text.
        Parameters:
        cont - Container to search component in.
        text - TextComponent text. If null, contents is not checked.
        ce - Compare text exactly.
        ccs - Compare text case sensitively.
        Returns:
        TextComponent instance.
        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.
      • changeCaretPosition

        public void changeCaretPosition​(int position)
        Changes caret position.
        Parameters:
        position - Position to move caret to.
      • selectText

        public void selectText​(int startPosition,
                               int finalPosition)
        Selects a part of text.
        Parameters:
        startPosition - Start caret position
        finalPosition - Final caret position
      • getPositionByText

        public int getPositionByText​(String text,
                                     int index)
        Finds start text position.
        Parameters:
        text - Text to be searched.
        index - Index of text instance (first instance has index 0)
        Returns:
        Caret position correspondent to text start.
      • getPositionByText

        public int getPositionByText​(String text)
        Finds start text position.
        Parameters:
        text - Text to be searched.
        Returns:
        Caret position correspondent to text start.
      • clearText

        public void clearText()
        Clears text.
      • typeText

        public void typeText​(String text,
                             int caretPosition)
        Types text starting from known position.
        Parameters:
        text - Text to be typed.
        caretPosition - Position to start type text
      • typeText

        public void typeText​(String text)
        Types text starting from known position.
        Parameters:
        text - Text to be typed.
      • enterText

        public void enterText​(String text)
        Requests a focus, clears text, types new one and pushes Enter.
        Parameters:
        text - New text value. Shouln't include final '\n'.
      • addTextListener

        public void addTextListener​(TextListener textListener)
        Maps TextComponent.addTextListener(TextListener) through queue
      • getCaretPosition

        public int getCaretPosition()
        Maps TextComponent.getCaretPosition() through queue
      • getSelectedText

        public String getSelectedText()
        Maps TextComponent.getSelectedText() through queue
      • getSelectionEnd

        public int getSelectionEnd()
        Maps TextComponent.getSelectionEnd() through queue
      • getSelectionStart

        public int getSelectionStart()
        Maps TextComponent.getSelectionStart() through queue
      • getText

        public String getText()
        Maps TextComponent.getText() through queue
      • isEditable

        public boolean isEditable()
        Maps TextComponent.isEditable() through queue
      • removeTextListener

        public void removeTextListener​(TextListener textListener)
        Maps TextComponent.removeTextListener(TextListener) through queue
      • select

        public void select​(int i,
                           int i1)
        Maps TextComponent.select(int, int) through queue
      • selectAll

        public void selectAll()
        Maps TextComponent.selectAll() through queue
      • setCaretPosition

        public void setCaretPosition​(int i)
        Maps TextComponent.setCaretPosition(int) through queue
      • setEditable

        public void setEditable​(boolean b)
        Maps TextComponent.setEditable(boolean) through queue
      • setSelectionEnd

        public void setSelectionEnd​(int i)
        Maps TextComponent.setSelectionEnd(int) through queue
      • setSelectionStart

        public void setSelectionStart​(int i)
        Maps TextComponent.setSelectionStart(int) through queue
      • setText

        public void setText​(String string)
        Maps TextComponent.setText(String) through queue
      • getTextDriver

        protected TextDriver getTextDriver()
        Return a TextDriver used by this component.
        Returns:
        a driver got by the operator during creation.