Package org.netbeans.jemmy.operators
Class ChoiceOperator
- java.lang.Object
-
- org.netbeans.jemmy.operators.Operator
-
- org.netbeans.jemmy.operators.ComponentOperator
-
- org.netbeans.jemmy.operators.ChoiceOperator
-
- All Implemented Interfaces:
Outputable
,Timeoutable
public class ChoiceOperator extends ComponentOperator implements Outputable
Timeouts used:
ButtonOperator.PushButtonTimeout - time between choice pressing and releasing
ComponentOperator.WaitComponentTimeout - time to wait choice displayed
ComponentOperator.WaitComponentEnabledTimeout - time to wait choice enabled
.- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
Timeouts
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChoiceOperator.ChoiceBySelectedItemFinder
Allows to find component by label.static class
ChoiceOperator.ChoiceFinder
Checks component type.-
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
Fields Modifier and Type Field Description static String
ITEM_PREFIX_DPROP
Identifier for a items properties.static String
SELECTED_ITEM_DPROP
Identifier for a selected item property.-
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
Constructors Constructor Description ChoiceOperator(Choice b)
Constructor.ChoiceOperator(ContainerOperator cont)
Constructor.ChoiceOperator(ContainerOperator cont, int index)
Constructor.ChoiceOperator(ContainerOperator cont, String text)
Constructor.ChoiceOperator(ContainerOperator cont, String text, int index)
Constructor.ChoiceOperator(ContainerOperator cont, ComponentChooser chooser)
Constructs a ChoiceOperator object.ChoiceOperator(ContainerOperator cont, ComponentChooser chooser, int index)
Constructs a ChoiceOperator object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(String item)
MapsChoice.add(String)
through queuevoid
addItemListener(ItemListener itemListener)
MapsChoice.addItemListener(ItemListener)
through queuevoid
addNotify()
MapsChoice.addNotify()
through queuevoid
copyEnvironment(Operator anotherOperator)
Copies all environment (output, timeouts, visualizer) from another operator.static Choice
findChoice(Container cont, String text, boolean ce, boolean ccs)
Searches Choice by text.static Choice
findChoice(Container cont, String text, boolean ce, boolean ccs, int index)
Searches Choice by text.static Choice
findChoice(Container cont, ComponentChooser chooser)
Searches 0'th Choice in container.static Choice
findChoice(Container cont, ComponentChooser chooser, int index)
Searches Choice in container.int
findItemIndex(String item)
Finds an item between choice items.int
findItemIndex(String item, int index)
Finds an item between choice items.Hashtable
getDump()
Returns information about component.String
getItem(int index)
MapsChoice.getItem(int)
through queueint
getItemCount()
MapsChoice.getItemCount()
through queueTestOut
getOutput()
Returns print output streams or writers.int
getSelectedIndex()
MapsChoice.getSelectedIndex()
through queueString
getSelectedItem()
MapsChoice.getSelectedItem()
through queuevoid
insert(String item, int index)
MapsChoice.insert(String)
through queuevoid
remove(int position)
MapsChoice.remove(int)
through queuevoid
remove(String item)
MapsChoice.remove(String)
through queuevoid
removeAll()
MapsChoice.removeAll()
through queuevoid
removeItemListener(ItemListener itemListener)
MapsChoice.removeItemListener(ItemListener)
through queuevoid
select(int pos)
MapsChoice.select(int)
through queuevoid
selectItem(int index)
Selects an item by index.void
selectItem(String item)
Selects an item by text.void
selectItem(String item, int index)
Selects an item by text.void
setOutput(TestOut out)
Defines print output streams or writers.void
setState(String str)
MapsChoice.select(String)
through queuestatic Choice
waitChoice(Container cont, String text, boolean ce, boolean ccs)
Waits Choice by text.static Choice
waitChoice(Container cont, String text, boolean ce, boolean ccs, int index)
Waits Choice by text.static Choice
waitChoice(Container cont, ComponentChooser chooser)
Waits 0'th Choice in container.static Choice
waitChoice(Container cont, ComponentChooser chooser, int index)
Waits Choice in container.void
waitItemSelected(int index)
Waits for item to be selected.-
Methods inherited from class org.netbeans.jemmy.operators.ComponentOperator
activateWindow, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, 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, getTimeouts, 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, setTimeouts, setVisible, transferFocus, typeKey, typeKey, typeKey, update, validate, waitComponent, waitComponent, waitComponent, waitComponent, waitComponentEnabled, waitComponentShowing, waitComponentVisible, waitHasFocus, wtComponentEnabled
-
Methods inherited from class org.netbeans.jemmy.operators.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 Detail
-
SELECTED_ITEM_DPROP
public static final String SELECTED_ITEM_DPROP
Identifier for a selected item property.- See Also:
getDump()
, Constant Field Values
-
ITEM_PREFIX_DPROP
public static final String ITEM_PREFIX_DPROP
Identifier for a items properties.- See Also:
getDump()
, Constant Field Values
-
-
Constructor Detail
-
ChoiceOperator
public ChoiceOperator(Choice b)
Constructor.- Parameters:
b
- a component
-
ChoiceOperator
public ChoiceOperator(ContainerOperator cont, ComponentChooser chooser, int index)
Constructs a ChoiceOperator object.- Parameters:
cont
- containerchooser
- a component chooser specifying searching criteria.index
- an index between appropriate ones.
-
ChoiceOperator
public ChoiceOperator(ContainerOperator cont, ComponentChooser chooser)
Constructs a ChoiceOperator object.- Parameters:
cont
- containerchooser
- a component chooser specifying searching criteria.
-
ChoiceOperator
public ChoiceOperator(ContainerOperator cont, String text, int index)
Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.- Parameters:
cont
- containertext
- Choice text.index
- Ordinal component index.- Throws:
TimeoutExpiredException
- See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)
-
ChoiceOperator
public ChoiceOperator(ContainerOperator cont, String text)
Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.- Parameters:
cont
- containertext
- Choice text.- Throws:
TimeoutExpiredException
- See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)
-
ChoiceOperator
public ChoiceOperator(ContainerOperator cont, int index)
Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.- Parameters:
cont
- containerindex
- Ordinal component index.- Throws:
TimeoutExpiredException
-
ChoiceOperator
public ChoiceOperator(ContainerOperator cont)
Constructor. Waits component in container first. Uses cont's timeout and output for waiting and to init operator.- Parameters:
cont
- container- Throws:
TimeoutExpiredException
-
-
Method Detail
-
findChoice
public static Choice findChoice(Container cont, ComponentChooser chooser, int index)
Searches Choice in container.- Parameters:
cont
- Container to search component in.chooser
- org.netbeans.jemmy.ComponentChooser implementation.index
- Ordinal component index.- Returns:
- Choice instance or null if component was not found.
-
findChoice
public static Choice findChoice(Container cont, ComponentChooser chooser)
Searches 0'th Choice in container.- Parameters:
cont
- Container to search component in.chooser
- org.netbeans.jemmy.ComponentChooser implementation.- Returns:
- Choice instance or null if component was not found.
-
findChoice
public static Choice findChoice(Container cont, String text, boolean ce, boolean ccs, int index)
Searches Choice by text.- Parameters:
cont
- Container to search component in.text
- Choice text. If null, contents is not checked.ce
- Compare text exactly.ccs
- Compare text case sensitively.index
- Ordinal component index.- Returns:
- Choice instance or null if component was not found.
- See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)
-
findChoice
public static Choice findChoice(Container cont, String text, boolean ce, boolean ccs)
Searches Choice by text.- Parameters:
cont
- Container to search component in.text
- Choice text. If null, contents is not checked.ce
- Compare text exactly.ccs
- Compare text case sensitively.- Returns:
- Choice instance or null if component was not found.
- See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)
-
waitChoice
public static Choice waitChoice(Container cont, ComponentChooser chooser, int index)
Waits Choice in container.- Parameters:
cont
- Container to search component in.chooser
- org.netbeans.jemmy.ComponentChooser implementation.index
- Ordinal component index.- Returns:
- Choice instance.
- Throws:
TimeoutExpiredException
-
waitChoice
public static Choice waitChoice(Container cont, ComponentChooser chooser)
Waits 0'th Choice in container.- Parameters:
cont
- Container to search component in.chooser
- org.netbeans.jemmy.ComponentChooser implementation.- Returns:
- Choice instance.
- Throws:
TimeoutExpiredException
-
waitChoice
public static Choice waitChoice(Container cont, String text, boolean ce, boolean ccs, int index)
Waits Choice by text.- Parameters:
cont
- Container to search component in.text
- Choice text. If null, contents is not checked.ce
- Compare text exactly.ccs
- Compare text case sensitively.index
- Ordinal component index.- Returns:
- Choice instance.
- Throws:
TimeoutExpiredException
- See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)
-
waitChoice
public static Choice waitChoice(Container cont, String text, boolean ce, boolean ccs)
Waits Choice by text.- Parameters:
cont
- Container to search component in.text
- Choice text. If null, contents is not checked.ce
- Compare text exactly.ccs
- Compare text case sensitively.- Returns:
- Choice instance.
- Throws:
TimeoutExpiredException
- See Also:
Operator.isCaptionEqual(String, String, boolean, boolean)
-
setOutput
public void setOutput(TestOut out)
Description copied from interface:Outputable
Defines print output streams or writers.- Specified by:
setOutput
in interfaceOutputable
- Overrides:
setOutput
in classComponentOperator
- Parameters:
out
- Identify the streams or writers used for print output.- See Also:
Outputable.getOutput()
-
getOutput
public TestOut getOutput()
Description copied from interface:Outputable
Returns print output streams or writers.- Specified by:
getOutput
in interfaceOutputable
- Overrides:
getOutput
in classComponentOperator
- Returns:
- an object that contains references to objects for printing to output and err streams.
- See Also:
Outputable.setOutput(org.netbeans.jemmy.TestOut)
-
copyEnvironment
public void copyEnvironment(Operator anotherOperator)
Description copied from class:Operator
Copies all environment (output, timeouts, visualizer) from another operator.- Overrides:
copyEnvironment
in classComponentOperator
- Parameters:
anotherOperator
- an operator to copy the environment to.
-
findItemIndex
public int findItemIndex(String item, int index)
Finds an item between choice items.- Parameters:
item
- a text pattern.index
- an ordinal index between appropriate items.- Returns:
- an item index.
-
findItemIndex
public int findItemIndex(String item)
Finds an item between choice items.- Parameters:
item
- a text pattern.- Returns:
- an item index.
-
selectItem
public void selectItem(String item, int index)
Selects an item by text.- Parameters:
item
- a text pattern.index
- an ordinal index between appropriate items.
-
selectItem
public void selectItem(String item)
Selects an item by text.- Parameters:
item
- a text pattern.
-
selectItem
public void selectItem(int index)
Selects an item by index.- Parameters:
index
- an item index.
-
waitItemSelected
public void waitItemSelected(int index)
Waits for item to be selected.- Parameters:
index
- Item index.
-
getDump
public Hashtable getDump()
Returns information about component.- Overrides:
getDump
in classComponentOperator
- Returns:
- a Hashtable containing name-value pairs.
-
add
public void add(String item)
MapsChoice.add(String)
through queue
-
addItemListener
public void addItemListener(ItemListener itemListener)
MapsChoice.addItemListener(ItemListener)
through queue
-
addNotify
public void addNotify()
MapsChoice.addNotify()
through queue- Overrides:
addNotify
in classComponentOperator
-
getItem
public String getItem(int index)
MapsChoice.getItem(int)
through queue
-
getItemCount
public int getItemCount()
MapsChoice.getItemCount()
through queue
-
getSelectedIndex
public int getSelectedIndex()
MapsChoice.getSelectedIndex()
through queue
-
getSelectedItem
public String getSelectedItem()
MapsChoice.getSelectedItem()
through queue
-
insert
public void insert(String item, int index)
MapsChoice.insert(String)
through queue
-
remove
public void remove(int position)
MapsChoice.remove(int)
through queue
-
remove
public void remove(String item)
MapsChoice.remove(String)
through queue
-
removeAll
public void removeAll()
MapsChoice.removeAll()
through queue
-
removeItemListener
public void removeItemListener(ItemListener itemListener)
MapsChoice.removeItemListener(ItemListener)
through queue
-
select
public void select(int pos)
MapsChoice.select(int)
through queue
-
setState
public void setState(String str)
MapsChoice.select(String)
through queue
-
-