Class TextComponentOperator
java.lang.Object
org.netbeans.jemmy.operators.Operator
org.netbeans.jemmy.operators.ComponentOperator
org.netbeans.jemmy.operators.TextComponentOperator
- All Implemented Interfaces:
Outputable, Timeoutable
- Direct Known Subclasses:
TextAreaOperator, TextFieldOperator
This operator type covers java.awt.TextArea component.
- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAllows to find component by text.static classChecks component type.Nested classes/interfaces inherited from class Operator
Operator.ComponentVisualizer, Operator.DefaultPathParser, Operator.DefaultStringComparator, Operator.Finder, Operator.MapAction, Operator.MapBooleanAction, Operator.MapByteAction, Operator.MapCharacterAction, Operator.MapDoubleAction, Operator.MapFloatAction, Operator.MapIntegerAction, Operator.MapLongAction, Operator.MapVoidAction, Operator.NoBlockingAction, Operator.PathParser, Operator.StringComparator -
Field Summary
FieldsFields inherited from class ComponentOperator
HEIGHT_DPROP, IS_SHOWING_DPROP, IS_VISIBLE_DPROP, NAME_DPROP, WIDTH_DPROP, X_DPROP, Y_DPROPFields inherited from class Operator
CLASS_DPROP, TO_STRING_DPROP -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor.TextComponentOperator(ContainerOperator cont, int index) Constructor.TextComponentOperator(ContainerOperator cont, String text) Constructor.TextComponentOperator(ContainerOperator cont, String text, int index) Constructor.TextComponentOperator(ContainerOperator cont, ComponentChooser chooser) Constructs a TextComponentOperator object.TextComponentOperator(ContainerOperator cont, ComponentChooser chooser, int index) Constructs a TextComponentOperator object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTextListener(TextListener textListener) MapsTextComponent.addTextListener(TextListener)through queuevoidchangeCaretPosition(int position) Changes caret position.voidClears text.voidcopyEnvironment(Operator anotherOperator) Copies all environment (output, timeouts, visualizer) from another operator.voidRequests a focus, clears text, types new one and pushes Enter.static TextComponentfindTextComponent(Container cont, String text, boolean ce, boolean ccs) Searches TextComponent by text.static TextComponentfindTextComponent(Container cont, String text, boolean ce, boolean ccs, int index) Searches TextComponent by text.static TextComponentfindTextComponent(Container cont, ComponentChooser chooser) Searches for the first TextComponent in a container.static TextComponentfindTextComponent(Container cont, ComponentChooser chooser, int index) Searches TextComponent in a container.intMapsTextComponent.getCaretPosition()through queuegetDump()Returns information about component.Returns print output streams or writers.intgetPositionByText(String text) Finds start text position.intgetPositionByText(String text, int index) Finds start text position.MapsTextComponent.getSelectedText()through queueintMapsTextComponent.getSelectionEnd()through queueintMapsTextComponent.getSelectionStart()through queuegetText()MapsTextComponent.getText()through queueprotected TextDriverReturn a TextDriver used by this component.Return current timeouts.booleanMapsTextComponent.isEditable()through queuevoidremoveTextListener(TextListener textListener) MapsTextComponent.removeTextListener(TextListener)through queuevoidselect(int i, int i1) MapsTextComponent.select(int, int)through queuevoidMapsTextComponent.selectAll()through queuevoidselectText(int startPosition, int finalPosition) Selects a part of text.voidsetCaretPosition(int i) MapsTextComponent.setCaretPosition(int)through queuevoidsetEditable(boolean b) MapsTextComponent.setEditable(boolean)through queuevoid/////////////////////////////////////////////////////voidsetSelectionEnd(int i) MapsTextComponent.setSelectionEnd(int)through queuevoidsetSelectionStart(int i) MapsTextComponent.setSelectionStart(int)through queuevoidMapsTextComponent.setText(String)through queuevoidsetTimeouts(Timeouts timeouts) Defines current timeouts.voidTypes text starting from known position.voidTypes text starting from known position.static TextComponentwaitTextComponent(Container cont, String text, boolean ce, boolean ccs) Waits TextComponent by text.static TextComponentwaitTextComponent(Container cont, String text, boolean ce, boolean ccs, int index) Waits TextComponent by text.static TextComponentwaitTextComponent(Container cont, ComponentChooser chooser) Waits 0'th TextComponent in container.static TextComponentwaitTextComponent(Container cont, ComponentChooser chooser, int index) Waits TextComponent in container.Methods inherited from class ComponentOperator
activateWindow, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, checkImage, checkImage, clickForPopup, clickForPopup, clickForPopup, clickForPopup, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, contains, contains, createImage, createImage, dispatchEvent, doLayout, dragMouse, dragMouse, dragMouse, dragNDrop, dragNDrop, dragNDrop, enableInputMethods, enterMouse, exitMouse, findComponent, findComponent, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getCenterX, getCenterXForClick, getCenterY, getCenterYForClick, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getContainer, getContainers, getCursor, getDropTarget, getEventDispatcher, getFocus, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getSize, getSource, getToolkit, getTreeLock, getWidth, getWindow, getX, getY, hasFocus, imageUpdate, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, list, list, list, list, list, makeComponentVisible, moveMouse, paint, paintAll, prepareImage, prepareImage, pressKey, pressKey, pressMouse, pressMouse, print, printAll, pushKey, pushKey, releaseKey, releaseKey, releaseMouse, releaseMouse, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, transferFocus, typeKey, typeKey, typeKey, update, validate, waitComponent, waitComponent, waitComponent, waitComponent, waitComponentEnabled, waitComponentShowing, waitComponentVisible, waitHasFocus, wtComponentEnabledMethods inherited from class Operator
addOperatorPackage, addToDump, addToDump, createOperator, getCharBindingMap, getCharKey, getCharModifiers, getCharsKeys, getCharsKeys, getCharsModifiers, getCharsModifiers, getComparator, getDefaultComponentVisualizer, getDefaultMouseButton, getDefaultPathParser, getDefaultStringComparator, getDefaultVerification, getEnvironmentOperator, getParentPath, getParentPath, getPathParser, getPopupMouseButton, getProperties, getQueueTool, getVerification, getVisualizer, isCaptionEqual, isCaptionEqual, isCaptionEqual, lockQueue, parseString, parseString, printDump, produceNoBlocking, produceNoBlocking, produceTimeRestricted, produceTimeRestricted, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, setCharBindingMap, setComparator, setDefaultComponentVisualizer, setDefaultPathParser, setDefaultStringComparator, setDefaultVerification, setPathParser, setProperties, setVerification, setVisualizer, toStringSource, unlockAndThrow, unlockQueue, waitState
-
Field Details
-
TEXT_DPROP
-
-
Constructor Details
-
TextComponentOperator
Constructor.- Parameters:
b- Thejava.awt.TextComponentmanaged by this instance.
-
TextComponentOperator
Constructs a TextComponentOperator object.- Parameters:
cont- a containerchooser- a component chooser specifying searching criteria.index- an index between appropriate ones.
-
TextComponentOperator
Constructs a TextComponentOperator object.- Parameters:
cont- a containerchooser- a component chooser specifying searching criteria.
-
TextComponentOperator
Constructor. Waits for a component in a container to show. The component is identified as theindex+1'thjava.awt.TextComponentthat 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 hasindex0.- See Also:
-
TextComponentOperator
Constructor. Waits for a component in a container to show. The component is identified as the firstjava.awt.TextComponentthat 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:
-
TextComponentOperator
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:
-
TextComponentOperator
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.- See Also:
-
-
Method Details
-
findTextComponent
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 firstindexis 0.- Returns:
- TextComponent instance or null if component was not found.
-
findTextComponent
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:
-
findTextComponent
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:
-
waitTextComponent
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
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:
-
waitTextComponent
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:
-
setTimeouts
Description copied from interface:TimeoutableDefines current timeouts.- Specified by:
setTimeoutsin interfaceTimeoutable- Overrides:
setTimeoutsin classComponentOperator- Parameters:
timeouts- A collection of timeout assignments.- See Also:
-
getTimeouts
Description copied from interface:TimeoutableReturn current timeouts.- Specified by:
getTimeoutsin interfaceTimeoutable- Overrides:
getTimeoutsin classComponentOperator- Returns:
- the collection of current timeout assignments.
- See Also:
-
setOutput
Description copied from class:ComponentOperator/////////////////////////////////////////////////////- Specified by:
setOutputin interfaceOutputable- Overrides:
setOutputin classComponentOperator- Parameters:
out- Identify the streams or writers used for print output.- See Also:
-
getOutput
Description copied from interface:OutputableReturns print output streams or writers.- Specified by:
getOutputin interfaceOutputable- Overrides:
getOutputin classComponentOperator- Returns:
- an object that contains references to objects for printing to output and err streams.
- See Also:
-
copyEnvironment
Description copied from class:OperatorCopies all environment (output, timeouts, visualizer) from another operator.- Overrides:
copyEnvironmentin classComponentOperator- 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 positionfinalPosition- Final caret position
-
getPositionByText
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
Finds start text position.- Parameters:
text- Text to be searched.- Returns:
- Caret position correspondent to text start.
-
clearText
public void clearText()Clears text. -
typeText
Types text starting from known position.- Parameters:
text- Text to be typed.caretPosition- Position to start type text
-
typeText
Types text starting from known position.- Parameters:
text- Text to be typed.
-
enterText
Requests a focus, clears text, types new one and pushes Enter.- Parameters:
text- New text value. Shouln't include final '\n'.
-
getDump
Description copied from class:ComponentOperatorReturns information about component.- Overrides:
getDumpin classComponentOperator- Returns:
- a Hashtable containing name-value pairs.
-
addTextListener
MapsTextComponent.addTextListener(TextListener)through queue -
getCaretPosition
public int getCaretPosition()MapsTextComponent.getCaretPosition()through queue -
getSelectedText
MapsTextComponent.getSelectedText()through queue -
getSelectionEnd
public int getSelectionEnd()MapsTextComponent.getSelectionEnd()through queue -
getSelectionStart
public int getSelectionStart()MapsTextComponent.getSelectionStart()through queue -
getText
MapsTextComponent.getText()through queue -
isEditable
public boolean isEditable()MapsTextComponent.isEditable()through queue -
removeTextListener
MapsTextComponent.removeTextListener(TextListener)through queue -
select
public void select(int i, int i1) MapsTextComponent.select(int, int)through queue -
selectAll
public void selectAll()MapsTextComponent.selectAll()through queue -
setCaretPosition
public void setCaretPosition(int i) MapsTextComponent.setCaretPosition(int)through queue -
setEditable
public void setEditable(boolean b) MapsTextComponent.setEditable(boolean)through queue -
setSelectionEnd
public void setSelectionEnd(int i) MapsTextComponent.setSelectionEnd(int)through queue -
setSelectionStart
public void setSelectionStart(int i) MapsTextComponent.setSelectionStart(int)through queue -
setText
MapsTextComponent.setText(String)through queue -
getTextDriver
Return a TextDriver used by this component.- Returns:
- a driver got by the operator during creation.
-