org.eclipse.jubula.rc.swing.swing.implclasses
Class JTextComponentImplClass

java.lang.Object
  extended by org.eclipse.jubula.rc.swing.swing.implclasses.AbstractSwingImplClass
      extended by org.eclipse.jubula.rc.swing.swing.implclasses.JTextComponentImplClass
All Implemented Interfaces:
org.eclipse.jubula.rc.common.implclasses.IBaseImplementationClass, IImplementationClass

public class JTextComponentImplClass
extends AbstractSwingImplClass

Implementation class for JTextComponent and subclasses.

Created:
05.08.2005

Field Summary
 
Fields inherited from class org.eclipse.jubula.rc.swing.swing.implclasses.AbstractSwingImplClass
INDEX_LIST_SEP_CHAR, POS_UNI_PERCENT, POS_UNIT_PIXEL, RENDERER_FALLBACK_TEXT_GETTER_METHOD_1, RENDERER_FALLBACK_TEXT_GETTER_METHOD_2, VALUE_SEPARATOR
 
Constructor Summary
JTextComponentImplClass()
           
 
Method Summary
 void gdClick(int count)
          performs a count -click with the left button on the textfield.
 void gdClick(int count, int button)
          performs a count -click on the textfield.
 void gdInputText(java.lang.String text)
          Types text into the component.
 void gdInsertText(java.lang.String text, int index)
          Inserts text at the position index.
 void gdInsertText(java.lang.String text, java.lang.String pattern, java.lang.String operator, boolean after)
          Inserts text before or after the first appearance of pattern.
 java.lang.String gdReadValue(java.lang.String variable)
          Action to read the value of a JTextComponent to store it in a variable in the Client
 void gdReplaceText(java.lang.String text)
          Types text into the component.
 void gdSelect()
          select the whole text of the textfield by pressing ctrl + A; in case this won't work the whole text is selected programmatically
 void gdSelect(java.lang.String pattern, java.lang.String operator)
          Selects the first (not)appearance of pattern in the text component's content.
 void gdVerifyEditable(boolean editable)
          Verifies the editable property.
 void gdVerifyText(java.lang.String text)
          Verifies if the textfield shows the passed text.
 void gdVerifyText(java.lang.String text, java.lang.String operator)
          Verifies if the textfield shows the passed text.
 javax.swing.JComponent getComponent()
          
protected  java.lang.String getSelectionText()
           
protected  java.lang.String getText()
          Get a String representation of the "text" of the component.
 java.lang.String[] getTextArrayFromComponent()
          Returns a descriptive text array that represents the given gui component.
protected  javax.swing.text.JTextComponent getTextComponent()
           
 void setComponent(java.lang.Object graphicsComponent)
          Set the component the methods this implementation class implements have to work with.
 
Methods inherited from class org.eclipse.jubula.rc.swing.swing.implclasses.AbstractSwingImplClass
gdClickDirect, gdDrag, gdDrop, gdPopupSelectByIndexPath, gdPopupSelectByIndexPath, gdPopupSelectByIndexPath, gdPopupSelectByIndexPath, gdPopupSelectByTextPath, gdPopupSelectByTextPath, gdPopupSelectByTextPath, gdPopupSelectByTextPath, gdPopupVerifyEnabledByIndexPath, gdPopupVerifyEnabledByIndexPath, gdPopupVerifyEnabledByTextPath, gdPopupVerifyEnabledByTextPath, gdPopupVerifyExistsByIndexPath, gdPopupVerifyExistsByIndexPath, gdPopupVerifyExistsByTextPath, gdPopupVerifyExistsByTextPath, gdPopupVerifySelectedByIndexPath, gdPopupVerifySelectedByIndexPath, gdPopupVerifySelectedByTextPath, gdPopupVerifySelectedByTextPath, gdShowText, gdStorePropertyValue, gdVerifyEnabled, gdVerifyExists, gdVerifyFocus, gdVerifyProperty, gdWaitForComponent, getClickModifier, getEventThreadQueuer, getRenderedText, getRenderedText, getRobot, getRobotFactory, hasFocus, highLight, lowLight, pressOrReleaseModifiers, resolveRenderedText, showPopup, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTextComponentImplClass

public JTextComponentImplClass()
Method Detail

getTextComponent

protected javax.swing.text.JTextComponent getTextComponent()
Returns:
The JTextComponent instance.

getComponent

public javax.swing.JComponent getComponent()

Specified by:
getComponent in class AbstractSwingImplClass
Returns:
The component passed to the implementation class by calling IBaseImplementationClass.setComponent(Object)

setComponent

public void setComponent(java.lang.Object graphicsComponent)
Set the component the methods this implementation class implements have to work with.
The methods are declared by the configuration file for supported components.

Parameters:
graphicsComponent - the component from the AUT
Notice: Every changes made to control affects the AUT.

getText

protected java.lang.String getText()
Description copied from class: AbstractSwingImplClass
Get a String representation of the "text" of the component. This String is used in all compare actions and all other places where a simple "as text" view is needed. This has to be replaced either with simple getText() calls on the components or by calls to the cell (or other) renderers of the component using getRenderedText()

Specified by:
getText in class AbstractSwingImplClass
Returns:
JTextComponent.getText() value
See Also:
AbstractSwingImplClass.getText()

gdReadValue

public java.lang.String gdReadValue(java.lang.String variable)
Action to read the value of a JTextComponent to store it in a variable in the Client

Parameters:
variable - the name of the variable
Returns:
the text value.

gdVerifyText

public void gdVerifyText(java.lang.String text,
                         java.lang.String operator)
Verifies if the textfield shows the passed text.

Parameters:
text - The text to verify.
operator - The operator used to verify

gdVerifyText

public void gdVerifyText(java.lang.String text)
Verifies if the textfield shows the passed text.

Parameters:
text - The text to verify.

gdReplaceText

public void gdReplaceText(java.lang.String text)
Types text into the component. This replaces the shown content.

Parameters:
text - the text to type in

gdInputText

public void gdInputText(java.lang.String text)
Types text into the component.

Parameters:
text - the text to type in

gdInsertText

public void gdInsertText(java.lang.String text,
                         int index)
Inserts text at the position index.

Parameters:
text - The text to insert
index - The position for insertion

gdInsertText

public void gdInsertText(java.lang.String text,
                         java.lang.String pattern,
                         java.lang.String operator,
                         boolean after)
                  throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Inserts text before or after the first appearance of pattern.

Parameters:
text - The text to insert
pattern - The pattern to find the position for insertion
operator - Operator to select Matching Algorithm
after - If true, the text will be inserted after the pattern, otherwise before the pattern.
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If the pattern is invalid or cannot be found

gdVerifyEditable

public void gdVerifyEditable(boolean editable)
Verifies the editable property.

Parameters:
editable - The editable property to verify.

gdSelect

public void gdSelect()
select the whole text of the textfield by pressing ctrl + A; in case this won't work the whole text is selected programmatically


getSelectionText

protected java.lang.String getSelectionText()
Returns:
the selectes text

gdSelect

public void gdSelect(java.lang.String pattern,
                     java.lang.String operator)
              throws org.eclipse.jubula.rc.common.exception.StepExecutionException
Selects the first (not)appearance of pattern in the text component's content.

Parameters:
pattern - The pattern to select
operator - operator
Throws:
org.eclipse.jubula.rc.common.exception.StepExecutionException - If the pattern is invalid or cannot be found

gdClick

public void gdClick(int count)
performs a count -click with the left button on the textfield. The click will be performed at the first caret position.

Parameters:
count - the number of clicks

gdClick

public void gdClick(int count,
                    int button)
performs a count -click on the textfield. The click will be performed at the left beginning of the textfield plus 3 pixels to be sure that the click is really within the component.

Overrides:
gdClick in class AbstractSwingImplClass
Parameters:
count - the number of clicks
button - the button that was clicked

getTextArrayFromComponent

public java.lang.String[] getTextArrayFromComponent()
Returns a descriptive text array that represents the given gui component.
Descriptive texts can be received for example from buttons, labels and table headers. If text is obviously data (for example in text input components) then it is not considered a descriptive text.
If the component has no descriptive text then null, an empty array or an array with length one and null or an empty string as content has to be returned.

Returns:
array containing none, one or many texts representing the
gui component or null