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 classChoiceOperator.ChoiceBySelectedItemFinderAllows to find component by label.static classChoiceOperator.ChoiceFinderChecks 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 java.lang.StringITEM_PREFIX_DPROPIdentifier for a items properties.static java.lang.StringSELECTED_ITEM_DPROPIdentifier 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(java.awt.Choice b)Constructor.ChoiceOperator(ContainerOperator cont)Constructor.ChoiceOperator(ContainerOperator cont, int index)Constructor.ChoiceOperator(ContainerOperator cont, java.lang.String text)Constructor.ChoiceOperator(ContainerOperator cont, java.lang.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 voidadd(java.lang.String item)MapsChoice.add(String)through queuevoidaddItemListener(java.awt.event.ItemListener itemListener)MapsChoice.addItemListener(ItemListener)through queuevoidaddNotify()MapsChoice.addNotify()through queuevoidcopyEnvironment(Operator anotherOperator)Copies all environment (output, timeouts, visualizer) from another operator.static java.awt.ChoicefindChoice(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs)Searches Choice by text.static java.awt.ChoicefindChoice(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs, int index)Searches Choice by text.static java.awt.ChoicefindChoice(java.awt.Container cont, ComponentChooser chooser)Searches 0'th Choice in container.static java.awt.ChoicefindChoice(java.awt.Container cont, ComponentChooser chooser, int index)Searches Choice in container.intfindItemIndex(java.lang.String item)Finds an item between choice items.intfindItemIndex(java.lang.String item, int index)Finds an item between choice items.java.util.HashtablegetDump()Returns information about component.java.lang.StringgetItem(int index)MapsChoice.getItem(int)through queueintgetItemCount()MapsChoice.getItemCount()through queueTestOutgetOutput()Returns print output streams or writers.intgetSelectedIndex()MapsChoice.getSelectedIndex()through queuejava.lang.StringgetSelectedItem()MapsChoice.getSelectedItem()through queuevoidinsert(java.lang.String item, int index)MapsChoice.insert(String)through queuevoidremove(int position)MapsChoice.remove(int)through queuevoidremove(java.lang.String item)MapsChoice.remove(String)through queuevoidremoveAll()MapsChoice.removeAll()through queuevoidremoveItemListener(java.awt.event.ItemListener itemListener)MapsChoice.removeItemListener(ItemListener)through queuevoidselect(int pos)MapsChoice.select(int)through queuevoidselectItem(int index)Selects an item by index.voidselectItem(java.lang.String item)Selects an item by text.voidselectItem(java.lang.String item, int index)Selects an item by text.voidsetOutput(TestOut out)Defines print output streams or writers.voidsetState(java.lang.String str)MapsChoice.select(String)through queuestatic java.awt.ChoicewaitChoice(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs)Waits Choice by text.static java.awt.ChoicewaitChoice(java.awt.Container cont, java.lang.String text, boolean ce, boolean ccs, int index)Waits Choice by text.static java.awt.ChoicewaitChoice(java.awt.Container cont, ComponentChooser chooser)Waits 0'th Choice in container.static java.awt.ChoicewaitChoice(java.awt.Container cont, ComponentChooser chooser, int index)Waits Choice in container.voidwaitItemSelected(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 java.lang.String SELECTED_ITEM_DPROP
Identifier for a selected item property.- See Also:
getDump(), Constant Field Values
-
ITEM_PREFIX_DPROP
public static final java.lang.String ITEM_PREFIX_DPROP
Identifier for a items properties.- See Also:
getDump(), Constant Field Values
-
-
Constructor Detail
-
ChoiceOperator
public ChoiceOperator(java.awt.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, java.lang.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, java.lang.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 java.awt.Choice findChoice(java.awt.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 java.awt.Choice findChoice(java.awt.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 java.awt.Choice findChoice(java.awt.Container cont, java.lang.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 java.awt.Choice findChoice(java.awt.Container cont, java.lang.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 java.awt.Choice waitChoice(java.awt.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 java.awt.Choice waitChoice(java.awt.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 java.awt.Choice waitChoice(java.awt.Container cont, java.lang.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 java.awt.Choice waitChoice(java.awt.Container cont, java.lang.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:OutputableDefines print output streams or writers.- Specified by:
setOutputin interfaceOutputable- Overrides:
setOutputin classComponentOperator- Parameters:
out- Identify the streams or writers used for print output.- See Also:
Outputable.getOutput()
-
getOutput
public TestOut 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:
Outputable.setOutput(org.netbeans.jemmy.TestOut)
-
copyEnvironment
public void copyEnvironment(Operator anotherOperator)
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.
-
findItemIndex
public int findItemIndex(java.lang.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(java.lang.String item)
Finds an item between choice items.- Parameters:
item- a text pattern.- Returns:
- an item index.
-
selectItem
public void selectItem(java.lang.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(java.lang.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 java.util.Hashtable getDump()
Returns information about component.- Overrides:
getDumpin classComponentOperator- Returns:
- a Hashtable containing name-value pairs.
-
add
public void add(java.lang.String item)
MapsChoice.add(String)through queue
-
addItemListener
public void addItemListener(java.awt.event.ItemListener itemListener)
MapsChoice.addItemListener(ItemListener)through queue
-
addNotify
public void addNotify()
MapsChoice.addNotify()through queue- Overrides:
addNotifyin classComponentOperator
-
getItem
public java.lang.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 java.lang.String getSelectedItem()
MapsChoice.getSelectedItem()through queue
-
insert
public void insert(java.lang.String item, int index)MapsChoice.insert(String)through queue
-
remove
public void remove(int position)
MapsChoice.remove(int)through queue
-
remove
public void remove(java.lang.String item)
MapsChoice.remove(String)through queue
-
removeAll
public void removeAll()
MapsChoice.removeAll()through queue
-
removeItemListener
public void removeItemListener(java.awt.event.ItemListener itemListener)
MapsChoice.removeItemListener(ItemListener)through queue
-
select
public void select(int pos)
MapsChoice.select(int)through queue
-
setState
public void setState(java.lang.String str)
MapsChoice.select(String)through queue
-
-