|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.jemmy.operators.Operator
org.netbeans.jemmy.operators.ComponentOperator
org.netbeans.jemmy.operators.ContainerOperator
org.netbeans.jemmy.operators.JComponentOperator
org.netbeans.jemmy.operators.JTextComponentOperator
public class JTextComponentOperator
Class provides basic functions to operate with JTextComponent
(selection, typing, deleting)
Timeouts used:
JTextComponentOperator.PushKeyTimeout - time between key pressing and releasing during text typing
JTextComponentOperator.BetweenKeysTimeout - time to sleep between two chars typing
JTextComponentOperator.ChangeCaretPositionTimeout - maximum time to chenge caret position
JTextComponentOperator.TypeTextTimeout - maximum time to type text
ComponentOperator.WaitComponentTimeout - time to wait component displayed
ComponentOperator.WaitFocusTimeout - time to wait component focus
ComponentOperator.WaitStateTimeout - time to wait for text
JScrollBarOperator.OneScrollClickTimeout - time for one scroll click
JScrollBarOperator.WholeScrollTimeout - time for the whole scrolling
.
Timeouts
Nested Class Summary | |
---|---|
static class |
JTextComponentOperator.JTextComponentByTextFinder
Allows to find component by text. |
static class |
JTextComponentOperator.JTextComponentFinder
Checks component type. |
class |
JTextComponentOperator.NoSuchTextException
Can be throught during a text operation if text has not been found in the component. |
static interface |
JTextComponentOperator.TextChooser
Interface defining additional text cearch criteria. |
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.JComponentOperator |
---|
JComponentOperator.JComponentByTipFinder, JComponentOperator.JComponentFinder |
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.ContainerOperator |
---|
ContainerOperator.ContainerFinder |
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.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 | |
---|---|
static String |
IS_EDITABLE_DPROP
Identifier for a "editable" property. |
protected int |
modifiersPressed
Deprecated. All text operations are performed by TextDriver regitered for this operator type. |
static String |
SELECTED_TEXT_DPROP
Identifier for a "selected text" property. |
static String |
TEXT_DPROP
Identifier for a "text" property. |
Fields inherited from class org.netbeans.jemmy.operators.JComponentOperator |
---|
A11Y_DATA, A11Y_DESCRIPTION_DPROP, A11Y_NAME_DPROP, TOOLTIP_TEXT_DPROP |
Fields inherited from class org.netbeans.jemmy.operators.ComponentOperator |
---|
HEIGHT_DPROP, IS_SHOWING_DPROP, IS_VISIBLE_DPROP, NAME_DPROP, WIDTH_DPROP, X_DPROP, Y_DPROP |
Fields inherited from class org.netbeans.jemmy.operators.Operator |
---|
CLASS_DPROP, TO_STRING_DPROP |
Constructor Summary | |
---|---|
JTextComponentOperator(ContainerOperator cont)
Constructor. |
|
JTextComponentOperator(ContainerOperator cont,
ComponentChooser chooser)
Constructs a JTextComponentOperator object. |
|
JTextComponentOperator(ContainerOperator cont,
ComponentChooser chooser,
int index)
Constructs a JTextComponentOperator object. |
|
JTextComponentOperator(ContainerOperator cont,
int index)
Constructor. |
|
JTextComponentOperator(ContainerOperator cont,
String text)
Constructor. |
|
JTextComponentOperator(ContainerOperator cont,
String text,
int index)
Constructor. |
|
JTextComponentOperator(JTextComponent b)
Constructor. |
Method Summary | |
---|---|
void |
addCaretListener(CaretListener caretListener)
Maps JTextComponent.addCaretListener(CaretListener) through queue |
void |
changeCaretPosition(int position)
Changes caret position. |
void |
changeCaretPosition(String text,
boolean before)
Puts caret before or after text. |
void |
changeCaretPosition(String text,
int index,
boolean before)
Puts caret before or after text. |
void |
clearText()
Clears text. |
void |
copy()
Maps JTextComponent.copy() through queue |
void |
copyEnvironment(Operator anotherOperator)
Copies all environment (output, timeouts, visualizer) from another operator. |
void |
cut()
Maps JTextComponent.cut() through queue |
void |
enterText(String text)
Requests a focus, clears text, types new one and pushes Enter. |
static JTextComponent |
findJTextComponent(Container cont,
ComponentChooser chooser)
Searches JTextComponent in container. |
static JTextComponent |
findJTextComponent(Container cont,
ComponentChooser chooser,
int index)
Searches JTextComponent in container. |
static JTextComponent |
findJTextComponent(Container cont,
String text,
boolean ce,
boolean ccs)
Searches JTextComponent by text. |
static JTextComponent |
findJTextComponent(Container cont,
String text,
boolean ce,
boolean ccs,
int index)
Searches JTextComponent by text. |
Action[] |
getActions()
Maps JTextComponent.getActions() through queue |
Caret |
getCaret()
Maps JTextComponent.getCaret() through queue |
Color |
getCaretColor()
Maps JTextComponent.getCaretColor() through queue |
int |
getCaretPosition()
Maps JTextComponent.getCaretPosition() through queue |
Color |
getDisabledTextColor()
Maps JTextComponent.getDisabledTextColor() through queue |
String |
getDisplayedText()
Returns text which is really displayed. |
Document |
getDocument()
Maps JTextComponent.getDocument() through queue |
Hashtable |
getDump()
Returns information about component. |
char |
getFocusAccelerator()
Maps JTextComponent.getFocusAccelerator() through queue |
Highlighter |
getHighlighter()
Maps JTextComponent.getHighlighter() through queue |
Keymap |
getKeymap()
Maps JTextComponent.getKeymap() through queue |
Insets |
getMargin()
Maps JTextComponent.getMargin() through queue |
TestOut |
getOutput()
Returns print output streams or writers. |
int |
getPositionByText(String text)
Finds start text position. |
int |
getPositionByText(String text,
int index)
Finds start text position. |
int |
getPositionByText(String text,
JTextComponentOperator.TextChooser tChooser)
Finds start text position. |
int |
getPositionByText(String text,
JTextComponentOperator.TextChooser tChooser,
int index)
Finds start text position. |
Dimension |
getPreferredScrollableViewportSize()
Maps JTextComponent.getPreferredScrollableViewportSize() through queue |
int |
getScrollableBlockIncrement(Rectangle rectangle,
int i,
int i1)
Maps JTextComponent.getScrollableBlockIncrement(Rectangle, int, int) through queue |
boolean |
getScrollableTracksViewportHeight()
Maps JTextComponent.getScrollableTracksViewportHeight() through queue |
boolean |
getScrollableTracksViewportWidth()
Maps JTextComponent.getScrollableTracksViewportWidth() through queue |
int |
getScrollableUnitIncrement(Rectangle rectangle,
int i,
int i1)
Maps JTextComponent.getScrollableUnitIncrement(Rectangle, int, int) through queue |
String |
getSelectedText()
Maps JTextComponent.getSelectedText() through queue |
Color |
getSelectedTextColor()
Maps JTextComponent.getSelectedTextColor() through queue |
Color |
getSelectionColor()
Maps JTextComponent.getSelectionColor() through queue |
int |
getSelectionEnd()
Maps JTextComponent.getSelectionEnd() through queue |
int |
getSelectionStart()
Maps JTextComponent.getSelectionStart() through queue |
String |
getText()
Maps JTextComponent.getText() through queue |
String |
getText(int i,
int i1)
Maps JTextComponent.getText(int, int) through queue |
Timeouts |
getTimeouts()
Return current timeouts. |
TextUI |
getUI()
Maps JTextComponent.getUI() through queue |
boolean |
isEditable()
Maps JTextComponent.isEditable() through queue |
Rectangle |
modelToView(int i)
Maps JTextComponent.modelToView(int) through queue |
void |
moveCaretPosition(int i)
Maps JTextComponent.moveCaretPosition(int) through queue |
void |
paste()
Maps JTextComponent.paste() through queue |
void |
read(Reader reader,
Object object)
Maps JTextComponent.read(Reader, Object) through queue |
void |
removeCaretListener(CaretListener caretListener)
Maps JTextComponent.removeCaretListener(CaretListener) through queue |
void |
replaceSelection(String string)
Maps JTextComponent.replaceSelection(String) through queue |
void |
scrollToPosition(int position)
Scrolls to a text poistion. |
void |
select(int i,
int i1)
Maps JTextComponent.select(int, int) through queue |
void |
selectAll()
Maps JTextComponent.selectAll() through queue |
void |
selectText(int startPosition,
int finalPosition)
Selects a part of text. |
void |
selectText(String text)
Selects a part of text. |
void |
selectText(String text,
int index)
Selects a part of text. |
void |
setCaret(Caret caret)
Maps JTextComponent.setCaret(Caret) through queue |
void |
setCaretColor(Color color)
Maps JTextComponent.setCaretColor(Color) through queue |
void |
setCaretPosition(int i)
Maps JTextComponent.setCaretPosition(int) through queue |
void |
setDisabledTextColor(Color color)
Maps JTextComponent.setDisabledTextColor(Color) through queue |
void |
setDocument(Document document)
Maps JTextComponent.setDocument(Document) through queue |
void |
setEditable(boolean b)
Maps JTextComponent.setEditable(boolean) through queue |
void |
setFocusAccelerator(char c)
Maps JTextComponent.setFocusAccelerator(char) through queue |
void |
setHighlighter(Highlighter highlighter)
Maps JTextComponent.setHighlighter(Highlighter) through queue |
void |
setKeymap(Keymap keymap)
Maps JTextComponent.setKeymap(Keymap) through queue |
void |
setMargin(Insets insets)
Maps JTextComponent.setMargin(Insets) through queue |
void |
setOutput(TestOut out)
Defines print output streams or writers. |
void |
setSelectedTextColor(Color color)
Maps JTextComponent.setSelectedTextColor(Color) through queue |
void |
setSelectionColor(Color color)
Maps JTextComponent.setSelectionColor(Color) through queue |
void |
setSelectionEnd(int i)
Maps JTextComponent.setSelectionEnd(int) through queue |
void |
setSelectionStart(int i)
Maps JTextComponent.setSelectionStart(int) through queue |
void |
setText(String string)
Maps JTextComponent.setText(String) through queue |
void |
setTimeouts(Timeouts times)
Defines current timeouts. |
void |
setUI(TextUI textUI)
Maps JTextComponent.setUI(TextUI) through queue |
void |
typeText(String text)
Types text starting from the current position. |
void |
typeText(String text,
int caretPosition)
Types text starting from known position. |
int |
viewToModel(Point point)
Maps JTextComponent.viewToModel(Point) through queue |
void |
waitCaretPosition(int position)
Wait for caret to be moved to certain position. |
static JTextComponent |
waitJTextComponent(Container cont,
ComponentChooser chooser)
Waits JTextComponent in container. |
static JTextComponent |
waitJTextComponent(Container cont,
ComponentChooser chooser,
int index)
Waits JTextComponent in container. |
static JTextComponent |
waitJTextComponent(Container cont,
String text,
boolean ce,
boolean ccs)
Waits JTextComponent by text. |
static JTextComponent |
waitJTextComponent(Container cont,
String text,
boolean ce,
boolean ccs,
int index)
Waits JTextComponent by text. |
void |
waitText(String text)
Waits for certain text. |
void |
waitText(String text,
int position)
Wait for text to be displayed starting from certain position. |
void |
write(Writer writer)
Maps JTextComponent.write(Writer) through queue |
Methods inherited from class org.netbeans.jemmy.operators.ContainerOperator |
---|
add, add, add, add, add, addContainerListener, createSubOperator, createSubOperator, findComponentAt, findComponentAt, findContainer, findContainer, findContainer, findContainer, findContainerUnder, findContainerUnder, findSubComponent, findSubComponent, getComponent, getComponentCount, getComponents, getInsets, getLayout, isAncestorOf, paintComponents, printComponents, remove, remove, removeAll, removeContainerListener, setLayout, waitContainer, waitContainer, waitContainer, waitContainer, waitSubComponent, waitSubComponent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TEXT_DPROP
getDump()
,
Constant Field Valuespublic static final String SELECTED_TEXT_DPROP
getDump()
,
Constant Field Valuespublic static final String IS_EDITABLE_DPROP
getDump()
,
Constant Field Valuesprotected int modifiersPressed
Constructor Detail |
---|
public JTextComponentOperator(JTextComponent b)
b
- Component to operate with.public JTextComponentOperator(ContainerOperator cont, ComponentChooser chooser, int index)
cont
- a containerchooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.public JTextComponentOperator(ContainerOperator cont, ComponentChooser chooser)
cont
- a containerchooser
- a component chooser specifying searching criteria.public JTextComponentOperator(ContainerOperator cont, String text, int index)
cont
- a containertext
- Button text.index
- Ordinal component index.
TimeoutExpiredException
Operator.isCaptionEqual(String, String, boolean, boolean)
public JTextComponentOperator(ContainerOperator cont, String text)
cont
- a containertext
- Button text.
TimeoutExpiredException
Operator.isCaptionEqual(String, String, boolean, boolean)
public JTextComponentOperator(ContainerOperator cont, int index)
cont
- a containerindex
- Ordinal component index.
TimeoutExpiredException
public JTextComponentOperator(ContainerOperator cont)
cont
- a container
TimeoutExpiredException
Method Detail |
---|
public static JTextComponent findJTextComponent(Container cont, ComponentChooser chooser, int index)
cont
- Container to search component in.chooser
- a component chooser specifying searching criteria.index
- Ordinal component index.
public static JTextComponent findJTextComponent(Container cont, ComponentChooser chooser)
cont
- Container to search component in.chooser
- a component chooser specifying searching criteria.
public static JTextComponent findJTextComponent(Container cont, String text, boolean ce, boolean ccs, int index)
cont
- Container to search component in.text
- Component text.ce
- Compare text exactly.ccs
- Compare text case sensitively.index
- Ordinal component index.
Operator.isCaptionEqual(String, String, boolean, boolean)
public static JTextComponent findJTextComponent(Container cont, String text, boolean ce, boolean ccs)
cont
- Container to search component in.text
- Component text.ce
- Compare text exactly.ccs
- Compare text case sensitively.
Operator.isCaptionEqual(String, String, boolean, boolean)
public static JTextComponent waitJTextComponent(Container cont, ComponentChooser chooser, int index)
cont
- Container to search component in.chooser
- a component chooser specifying searching criteria.index
- Ordinal component index.
TimeoutExpiredException
public static JTextComponent waitJTextComponent(Container cont, ComponentChooser chooser)
cont
- Container to search component in.chooser
- a component chooser specifying searching criteria.
TimeoutExpiredException
public static JTextComponent waitJTextComponent(Container cont, String text, boolean ce, boolean ccs, int index)
cont
- Container to search component in.text
- Component text.ce
- Compare text exactly.ccs
- Compare text case sensitively.index
- Ordinal component index.
TimeoutExpiredException
Operator.isCaptionEqual(String, String, boolean, boolean)
public static JTextComponent waitJTextComponent(Container cont, String text, boolean ce, boolean ccs)
cont
- Container to search component in.text
- Component text.ce
- Compare text exactly.ccs
- Compare text case sensitively.
TimeoutExpiredException
Operator.isCaptionEqual(String, String, boolean, boolean)
public void setTimeouts(Timeouts times)
Timeoutable
setTimeouts
in interface Timeoutable
setTimeouts
in class JComponentOperator
times
- A collection of timeout assignments.Timeoutable.getTimeouts()
public Timeouts getTimeouts()
Timeoutable
getTimeouts
in interface Timeoutable
getTimeouts
in class JComponentOperator
Timeoutable.setTimeouts(org.netbeans.jemmy.Timeouts)
public void setOutput(TestOut out)
Outputable
setOutput
in interface Outputable
setOutput
in class JComponentOperator
out
- Identify the streams or writers used for print output.Outputable.getOutput()
public TestOut getOutput()
Outputable
getOutput
in interface Outputable
getOutput
in class JComponentOperator
Outputable.setOutput(org.netbeans.jemmy.TestOut)
public void copyEnvironment(Operator anotherOperator)
Operator
copyEnvironment
in class ComponentOperator
anotherOperator
- an operator to copy the environment to.public int getPositionByText(String text, JTextComponentOperator.TextChooser tChooser, int index)
text
- Text to be searched.tChooser
- Additional search criteria.index
- Index of text instance (first instance has index 0)
JTextComponentOperator.TextChooser
public int getPositionByText(String text, JTextComponentOperator.TextChooser tChooser)
text
- Text to be searched.tChooser
- Additional search criteria.
public int getPositionByText(String text, int index)
text
- Text to be searched.index
- Index of text instance (first instance has index 0)
public int getPositionByText(String text)
text
- Text to be searched.
public void enterText(String text)
text
- New text value. Shouln't include final '\n'.
TimeoutExpiredException
public void changeCaretPosition(int position)
position
- Position to move caret to.
TimeoutExpiredException
changeCaretPosition(String, int, boolean)
public void changeCaretPosition(String text, int index, boolean before)
text
- Text to be searched.index
- Index of text instance (first instance has index 0)before
- If true put caret before text, otherwise after.
TimeoutExpiredException
JTextComponentOperator.NoSuchTextException
changeCaretPosition(int)
,
getPositionByText(String, int)
public void changeCaretPosition(String text, boolean before)
text
- Text to be searched.before
- If true put caret before text, otherwise after.
TimeoutExpiredException
JTextComponentOperator.NoSuchTextException
changeCaretPosition(int)
,
getPositionByText(String, int)
public void typeText(String text, int caretPosition)
text
- Text to be typed.caretPosition
- Position to start type text
TimeoutExpiredException
JTextComponentOperator.NoSuchTextException
typeText(String)
public void typeText(String text)
text
- Text to be typed.
TimeoutExpiredException
typeText(String, int)
public void selectText(int startPosition, int finalPosition)
startPosition
- Start caret positionfinalPosition
- Final caret position
TimeoutExpiredException
selectText(String, int)
,
selectText(String)
public void selectText(String text, int index)
text
- Text to be selectedindex
- Index of text instance (first instance has index 0)
TimeoutExpiredException
JTextComponentOperator.NoSuchTextException
selectText(int, int)
,
selectText(String)
,
getPositionByText(String, int)
public void selectText(String text)
text
- Text to be selected
TimeoutExpiredException
JTextComponentOperator.NoSuchTextException
selectText(String, int)
,
selectText(int, int)
public void clearText()
TimeoutExpiredException
public void scrollToPosition(int position)
position
- a position to scroll.
TimeoutExpiredException
public String getDisplayedText()
getText()
and getDisplayedText()
are different if text component is used to display javax.swing.text.StyledDocument
public void waitText(String text, int position)
text
- text to wait.position
- starting text position.public void waitText(String text)
text
- Text to be compared by getComparator() comparator.public void waitCaretPosition(int position)
position
- a position which caret supposed to be moved to.public Hashtable getDump()
ComponentOperator
getDump
in class JComponentOperator
public void addCaretListener(CaretListener caretListener)
JTextComponent.addCaretListener(CaretListener)
through queue
public void copy()
JTextComponent.copy()
through queue
public void cut()
JTextComponent.cut()
through queue
public Action[] getActions()
JTextComponent.getActions()
through queue
public Caret getCaret()
JTextComponent.getCaret()
through queue
public Color getCaretColor()
JTextComponent.getCaretColor()
through queue
public int getCaretPosition()
JTextComponent.getCaretPosition()
through queue
public Color getDisabledTextColor()
JTextComponent.getDisabledTextColor()
through queue
public Document getDocument()
JTextComponent.getDocument()
through queue
public char getFocusAccelerator()
JTextComponent.getFocusAccelerator()
through queue
public Highlighter getHighlighter()
JTextComponent.getHighlighter()
through queue
public Keymap getKeymap()
JTextComponent.getKeymap()
through queue
public Insets getMargin()
JTextComponent.getMargin()
through queue
public Dimension getPreferredScrollableViewportSize()
JTextComponent.getPreferredScrollableViewportSize()
through queue
public int getScrollableBlockIncrement(Rectangle rectangle, int i, int i1)
JTextComponent.getScrollableBlockIncrement(Rectangle, int, int)
through queue
public boolean getScrollableTracksViewportHeight()
JTextComponent.getScrollableTracksViewportHeight()
through queue
public boolean getScrollableTracksViewportWidth()
JTextComponent.getScrollableTracksViewportWidth()
through queue
public int getScrollableUnitIncrement(Rectangle rectangle, int i, int i1)
JTextComponent.getScrollableUnitIncrement(Rectangle, int, int)
through queue
public String getSelectedText()
JTextComponent.getSelectedText()
through queue
public Color getSelectedTextColor()
JTextComponent.getSelectedTextColor()
through queue
public Color getSelectionColor()
JTextComponent.getSelectionColor()
through queue
public int getSelectionEnd()
JTextComponent.getSelectionEnd()
through queue
public int getSelectionStart()
JTextComponent.getSelectionStart()
through queue
public String getText()
JTextComponent.getText()
through queue
public String getText(int i, int i1)
JTextComponent.getText(int, int)
through queue
public TextUI getUI()
JTextComponent.getUI()
through queue
public boolean isEditable()
JTextComponent.isEditable()
through queue
public Rectangle modelToView(int i)
JTextComponent.modelToView(int)
through queue
public void moveCaretPosition(int i)
JTextComponent.moveCaretPosition(int)
through queue
public void paste()
JTextComponent.paste()
through queue
public void read(Reader reader, Object object)
JTextComponent.read(Reader, Object)
through queue
public void removeCaretListener(CaretListener caretListener)
JTextComponent.removeCaretListener(CaretListener)
through queue
public void replaceSelection(String string)
JTextComponent.replaceSelection(String)
through queue
public void select(int i, int i1)
JTextComponent.select(int, int)
through queue
public void selectAll()
JTextComponent.selectAll()
through queue
public void setCaret(Caret caret)
JTextComponent.setCaret(Caret)
through queue
public void setCaretColor(Color color)
JTextComponent.setCaretColor(Color)
through queue
public void setCaretPosition(int i)
JTextComponent.setCaretPosition(int)
through queue
public void setDisabledTextColor(Color color)
JTextComponent.setDisabledTextColor(Color)
through queue
public void setDocument(Document document)
JTextComponent.setDocument(Document)
through queue
public void setEditable(boolean b)
JTextComponent.setEditable(boolean)
through queue
public void setFocusAccelerator(char c)
JTextComponent.setFocusAccelerator(char)
through queue
public void setHighlighter(Highlighter highlighter)
JTextComponent.setHighlighter(Highlighter)
through queue
public void setKeymap(Keymap keymap)
JTextComponent.setKeymap(Keymap)
through queue
public void setMargin(Insets insets)
JTextComponent.setMargin(Insets)
through queue
public void setSelectedTextColor(Color color)
JTextComponent.setSelectedTextColor(Color)
through queue
public void setSelectionColor(Color color)
JTextComponent.setSelectionColor(Color)
through queue
public void setSelectionEnd(int i)
JTextComponent.setSelectionEnd(int)
through queue
public void setSelectionStart(int i)
JTextComponent.setSelectionStart(int)
through queue
public void setText(String string)
JTextComponent.setText(String)
through queue
public void setUI(TextUI textUI)
JTextComponent.setUI(TextUI)
through queue
public int viewToModel(Point point)
JTextComponent.viewToModel(Point)
through queue
public void write(Writer writer)
JTextComponent.write(Writer)
through queue
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |