org.netbeans.modules.jellytools.platform/3 3.13

org.netbeans.jellytools.actions
Class Action

java.lang.Object
  extended by org.netbeans.jellytools.actions.Action
Direct Known Subclasses:
ActionNoBlock, AttachWindowAction, CloneViewAction, CloseAction, CloseAllDocumentsAction, CloseViewAction, CopyAction, CutAction, DockWindowAction, EditAction, ExploreFromHereAction, FavoritesAction, HelpAction, MaximizeWindowAction, OpenAction, OptionsViewAction, OutputWindowViewAction, PasteAction, PropertiesAction, ReplaceAction, RestoreWindowAction, SaveAction, SaveAllAction, ShowDescriptionAreaAction, SortByCategoryAction, SortByNameAction, UndockWindowAction, ViewAction

public class Action
extends Object

Ancestor class for all blocking actions.

It handles performing action through main menu (MENU_MODE), popup menu (POPUP_MODE), IDE SystemAction API call (API_MODE) or through keyboard shortcut (SHORTCUT_MODE).

Action can be performed in exact mode by calling performMenu(...), performPopup(...), performAPI(...) or performShortcut(...).

If exact mode is not supported by the action it throws UnsupportedOperationException.

Current implementation supports MENU_MODE when menuPath is defined, POPUP_MODE when popupPath is defined, API_MODE when systemActionClass is defined and SHORTCUT_MODE when shortcut is defined (see Action constructors).

Action also can be performed using runtime default mode by calling perform(...).

When default mode is not support by the action other modes are tried till supported mode found and action is performed.
Timeouts used:
Action.WaitAfterShortcutTimeout - time to sleep between shortcuts in sequence (default 0)


Nested Class Summary
static class Action.Shortcut
          Deprecated. Use KeyStroke instead.
 
Field Summary
protected static long AFTER_ACTION_WAIT_TIME
          sleep time after action execution
static int API_MODE
          through API action performing mode
protected  KeyStroke[] keystrokes
          Array of key strokes or null when SHORTCUT_MODE is not supported.
protected  String layerInstancePath
          Path to action instance FileObject in layer or null when API_MODE is not supported or systemActionClass is used.
static int MENU_MODE
          through menu action performing mode
protected  String menuPath
          menu path of current action or null when MENU_MODE is not supported
static int POPUP_MODE
          through popup menu action performing mode
protected  String popupPath
          popup menu path of current action or null when POPUP_MODE is not supported
protected static long SELECTION_WAIT_TIME
          sleep time between nodes selection and action execution
static int SHORTCUT_MODE
          through shortcut action performing mode
protected  Class systemActionClass
          SystemAction class of current action or null when API_MODE is not supported
protected static long WAIT_AFTER_SHORTCUT_TIMEOUT
          sleep time between sequence of shortcuts
 
Constructor Summary
Action(String menuPath, String popupPath)
          creates new Action instance without API_MODE and SHORTCUT_MODE support
Action(String menuPath, String popupPath, Action.Shortcut shortcut)
          Deprecated. Use Action(String menuPath, String popupPath, KeyStroke keystroke) instead.
Action(String menuPath, String popupPath, Action.Shortcut[] shortcuts)
          Deprecated. Use Action(String menuPath, String popupPath, KeyStroke[] keystrokes) instead.
Action(String menuPath, String popupPath, KeyStroke keystroke)
          Creates new Action instance without API_MODE support.
Action(String menuPath, String popupPath, KeyStroke[] keystrokes)
          Creates new Action instance without API_MODE support.
Action(String menuPath, String popupPath, String systemActionClass)
          creates new Action instance without SHORTCUT_MODE support
Action(String menuPath, String popupPath, String systemActionClass, Action.Shortcut shortcut)
          Deprecated. Use Action(String menuPath, String popupPath, String systemActionClass, KeyStroke keystroke) instead.
Action(String menuPath, String popupPath, String systemActionClass, Action.Shortcut[] shortcuts)
          Deprecated. Use Action(String menuPath, String popupPath, String systemActionClass, KeyStroke[] keystrokes) instead.
Action(String menuPath, String popupPath, String systemActionClass, KeyStroke keystroke)
          Creates new Action instance.
Action(String menuPath, String popupPath, String systemActionClass, KeyStroke[] keystrokes)
          Creates new Action instance.
 
Method Summary
 org.netbeans.jemmy.operators.Operator.StringComparator getComparator()
          Gets comparator set for this action instance.
 int getDefaultMode()
          Returns default mode in which actions are performed.
 KeyStroke[] getKeyStrokes()
          Returns an array of KeyStroke objects.
 String getMenuPath()
          getter for main menu path
 String getPopupPath()
          getter for popup menu path
 Class getSystemActionClass()
          getter for system action class
 boolean isEnabled()
          Checks whether this action is enabled.
 boolean isEnabled(org.netbeans.jemmy.operators.ComponentOperator componentOperator)
          Checks whether this action is enabled for given ComponentOperator.
 boolean isEnabled(Node node)
          Checks whether this action on given node is enabled.
 boolean isEnabled(Node[] nodes)
          Checks whether this action on given nodes is enabled.
 void perform()
          performs action depending on default mode,
calls performPopup(), performMenu() or performAPI(),
when default mode is not supported, others are tried
 void perform(org.netbeans.jemmy.operators.ComponentOperator component)
          performs action depending on default mode,
calls performPopup(), performMenu() or performAPI(),
when default mode is not supported, others are tried
 void perform(Node node)
          performs action depending on default mode,
calls performPopup(), performMenu() or performAPI(),
when default mode is not supported, others are tried
 void perform(Node[] nodes)
          performs action depending on default mode,
calls performPopup(), performMenu() or performAPI(),
when default mode is not supported, others are tried
 void perform(OutlineNode node)
          performs action depending on default mode,
calls performPopup(), performMenu(), performShortcut or performAPI(),
when default mode is not supported, others are tried
 void performAPI()
          performs action through API
 void performAPI(org.netbeans.jemmy.operators.ComponentOperator component)
          performs action through API
 void performAPI(Node node)
          performs action through API
 void performAPI(Node[] nodes)
          performs action through API
 void performAPI(OutlineNode node)
          performs action through API
 void performMenu()
          performs action through main menu
 void performMenu(org.netbeans.jemmy.operators.ComponentOperator component)
          performs action through main menu
 void performMenu(Node node)
          performs action through main menu
 void performMenu(Node[] nodes)
          performs action through main menu
 void performMenu(OutlineNode node)
           
 void performPopup()
          performs action through popup menu
 void performPopup(org.netbeans.jemmy.operators.ComponentOperator component)
          performs action through popup menu
 void performPopup(Node node)
          performs action through popup menu
 void performPopup(Node[] nodes)
          performs action through popup menu
 void performPopup(OutlineNode node)
          Performs action on an OutlineNode through popup menu.
 void performShortcut()
          performs action through shortcut
 void performShortcut(org.netbeans.jemmy.operators.ComponentOperator component)
          performs action through shortcut
 void performShortcut(Node node)
          performs action through shortcut
 void performShortcut(Node[] nodes)
          performs action through shortcut
 void performShortcut(OutlineNode node)
          performs action through shortcut
 void setComparator(org.netbeans.jemmy.operators.Operator.StringComparator comparator)
          Sets comparator fot this action.
 int setDefaultMode(int mode)
          Sets default mode in which actions are performed.
protected  void testNodes(Node[] nodes)
          tests if nodes are all from the same tree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MENU_MODE

public static final int MENU_MODE
through menu action performing mode

See Also:
Constant Field Values

POPUP_MODE

public static final int POPUP_MODE
through popup menu action performing mode

See Also:
Constant Field Values

API_MODE

public static final int API_MODE
through API action performing mode

See Also:
Constant Field Values

SHORTCUT_MODE

public static final int SHORTCUT_MODE
through shortcut action performing mode

See Also:
Constant Field Values

SELECTION_WAIT_TIME

protected static final long SELECTION_WAIT_TIME
sleep time between nodes selection and action execution

See Also:
Constant Field Values

AFTER_ACTION_WAIT_TIME

protected static final long AFTER_ACTION_WAIT_TIME
sleep time after action execution

See Also:
Constant Field Values

WAIT_AFTER_SHORTCUT_TIMEOUT

protected static final long WAIT_AFTER_SHORTCUT_TIMEOUT
sleep time between sequence of shortcuts

See Also:
Constant Field Values

menuPath

protected String menuPath
menu path of current action or null when MENU_MODE is not supported


popupPath

protected String popupPath
popup menu path of current action or null when POPUP_MODE is not supported


systemActionClass

protected Class systemActionClass
SystemAction class of current action or null when API_MODE is not supported


layerInstancePath

protected String layerInstancePath
Path to action instance FileObject in layer or null when API_MODE is not supported or systemActionClass is used.


keystrokes

protected KeyStroke[] keystrokes
Array of key strokes or null when SHORTCUT_MODE is not supported.

Constructor Detail

Action

public Action(String menuPath,
              String popupPath)
creates new Action instance without API_MODE and SHORTCUT_MODE support

Parameters:
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode shell is not supported)

Action

public Action(String menuPath,
              String popupPath,
              String systemActionClass)
creates new Action instance without SHORTCUT_MODE support

Parameters:
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode is not supported)
systemActionClass - String class name of SystemAction (use null value if API mode is not supported)

Action

public Action(String menuPath,
              String popupPath,
              Action.Shortcut[] shortcuts)
Deprecated. Use Action(String menuPath, String popupPath, KeyStroke[] keystrokes) instead.

creates new Action instance without API_MODE support

Parameters:
shortcuts - array of Shortcut instances (use null value if shorcut mode is not supported)
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode shell is not supported)

Action

public Action(String menuPath,
              String popupPath,
              Action.Shortcut shortcut)
Deprecated. Use Action(String menuPath, String popupPath, KeyStroke keystroke) instead.

creates new Action instance without API_MODE support

Parameters:
shortcut - Shortcut (use null value if menu mode is not supported)
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode shell is not supported)

Action

public Action(String menuPath,
              String popupPath,
              String systemActionClass,
              Action.Shortcut[] shortcuts)
Deprecated. Use Action(String menuPath, String popupPath, String systemActionClass, KeyStroke[] keystrokes) instead.

creates new Action instance

Parameters:
shortcuts - array of Shortcut instances (use null value if shortcut mode is not supported)
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode is not supported)
systemActionClass - String class name of SystemAction (use null value if API mode is not supported)

Action

public Action(String menuPath,
              String popupPath,
              String systemActionClass,
              Action.Shortcut shortcut)
Deprecated. Use Action(String menuPath, String popupPath, String systemActionClass, KeyStroke keystroke) instead.

creates new Action instance

Parameters:
shortcut - Shortcut String (use null value if menu mode is not supported)
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode is not supported)
systemActionClass - String class name of SystemAction (use null value if API mode is not supported)

Action

public Action(String menuPath,
              String popupPath,
              KeyStroke keystroke)
Creates new Action instance without API_MODE support.

Parameters:
keystroke - KeyStroke instance (use null value if shorcut mode is not supported)
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode shell is not supported)

Action

public Action(String menuPath,
              String popupPath,
              KeyStroke[] keystrokes)
Creates new Action instance without API_MODE support.

Parameters:
keystrokes - array of KeyStroke instances (use null value if shorcut mode is not supported)
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode shell is not supported)

Action

public Action(String menuPath,
              String popupPath,
              String systemActionClass,
              KeyStroke keystroke)
Creates new Action instance.

Parameters:
keystroke - KeyStroke instance (use null value if shorcut mode is not supported)
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode is not supported)
systemActionClass - String class name of SystemAction (use null value if API mode is not supported)

Action

public Action(String menuPath,
              String popupPath,
              String systemActionClass,
              KeyStroke[] keystrokes)
Creates new Action instance.

Parameters:
keystrokes - array of KeyStroke instances (use null value if shorcut mode is not supported)
menuPath - action path in main menu (use null value if menu mode is not supported)
popupPath - action path in popup menu (use null value if popup mode is not supported)
systemActionClass - String class name of SystemAction (use null value if API mode is not supported)
Method Detail

perform

public void perform()
performs action depending on default mode,
calls performPopup(), performMenu() or performAPI(),
when default mode is not supported, others are tried


perform

public void perform(Node node)
performs action depending on default mode,
calls performPopup(), performMenu() or performAPI(),
when default mode is not supported, others are tried

Parameters:
node - node to be action performed on

perform

public void perform(Node[] nodes)
performs action depending on default mode,
calls performPopup(), performMenu() or performAPI(),
when default mode is not supported, others are tried

Parameters:
nodes - nodes to be action performed on

perform

public void perform(OutlineNode node)
performs action depending on default mode,
calls performPopup(), performMenu(), performShortcut or performAPI(),
when default mode is not supported, others are tried

Parameters:
node - node to be action performed on

perform

public void perform(org.netbeans.jemmy.operators.ComponentOperator component)
performs action depending on default mode,
calls performPopup(), performMenu() or performAPI(),
when default mode is not supported, others are tried

Parameters:
component - component to be action performed on

performMenu

public void performMenu()
performs action through main menu

Throws:
UnsupportedOperationException - when action does not support menu mode

performMenu

public void performMenu(Node node)
performs action through main menu

Parameters:
node - node to be action performed on
Throws:
UnsupportedOperationException - when action does not support menu mode

performMenu

public void performMenu(Node[] nodes)
performs action through main menu

Parameters:
nodes - nodes to be action performed on
Throws:
UnsupportedOperationException - when action does not support menu mode

performMenu

public void performMenu(OutlineNode node)

performMenu

public void performMenu(org.netbeans.jemmy.operators.ComponentOperator component)
performs action through main menu

Parameters:
component - component to be action performed on
Throws:
UnsupportedOperationException - when action does not support menu mode

performPopup

public void performPopup()
performs action through popup menu

Throws:
UnsupportedOperationException

performPopup

public void performPopup(Node node)
performs action through popup menu

Parameters:
node - node to be action performed on
Throws:
UnsupportedOperationException - when action does not support popup mode

performPopup

public void performPopup(Node[] nodes)
performs action through popup menu

Parameters:
nodes - nodes to be action performed on
Throws:
UnsupportedOperationException - when action does not support popup mode

performPopup

public void performPopup(OutlineNode node)
Performs action on an OutlineNode through popup menu.

Parameters:
node - node to be performed on

performPopup

public void performPopup(org.netbeans.jemmy.operators.ComponentOperator component)
performs action through popup menu

Parameters:
component - component to be action performed on
Throws:
UnsupportedOperationException - when action does not support popup mode

performAPI

public void performAPI()
performs action through API

Throws:
UnsupportedOperationException - when action does not support API mode

performAPI

public void performAPI(Node node)
performs action through API

Parameters:
node - node to be action performed on
Throws:
UnsupportedOperationException - when action does not support API mode

performAPI

public void performAPI(Node[] nodes)
performs action through API

Parameters:
nodes - nodes to be action performed on
Throws:
UnsupportedOperationException - when action does not support API mode

performAPI

public void performAPI(OutlineNode node)
performs action through API

Parameters:
node - node to be action performed on
Throws:
UnsupportedOperationException - when action does not support API mode

performAPI

public void performAPI(org.netbeans.jemmy.operators.ComponentOperator component)
performs action through API

Parameters:
component - component to be action performed on
Throws:
UnsupportedOperationException - when action does not support API mode

performShortcut

public void performShortcut()
performs action through shortcut

Throws:
UnsupportedOperationException - if no shortcut is defined

performShortcut

public void performShortcut(Node node)
performs action through shortcut

Parameters:
node - node to be action performed on
Throws:
UnsupportedOperationException - when action does not support shortcut mode

performShortcut

public void performShortcut(Node[] nodes)
performs action through shortcut

Parameters:
nodes - nodes to be action performed on
Throws:
UnsupportedOperationException - when action does not support shortcut mode

performShortcut

public void performShortcut(OutlineNode node)
performs action through shortcut

Parameters:
node - node to be action performed on
Throws:
UnsupportedOperationException - when action does not support shortcut mode

performShortcut

public void performShortcut(org.netbeans.jemmy.operators.ComponentOperator component)
performs action through shortcut

Parameters:
component - component to be action performed on
Throws:
UnsupportedOperationException - when action does not support shortcut mode

testNodes

protected void testNodes(Node[] nodes)
tests if nodes are all from the same tree

Parameters:
nodes - nodes
Throws:
IllegalArgumentException - when given nodes does not pass

getDefaultMode

public int getDefaultMode()
Returns default mode in which actions are performed.

Returns:
default mode in which actions are performed
See Also:
POPUP_MODE, MENU_MODE, API_MODE, SHORTCUT_MODE

setDefaultMode

public int setDefaultMode(int mode)
Sets default mode in which actions are performed. If given mode value is not valid, it sets POPUP_MODE as default.

Parameters:
mode - mode to be set
Returns:
previous value
See Also:
POPUP_MODE, MENU_MODE, API_MODE, SHORTCUT_MODE

setComparator

public void setComparator(org.netbeans.jemmy.operators.Operator.StringComparator comparator)
Sets comparator fot this action. Comparator is used for all actions after this method is called.

Parameters:
comparator - new comparator to be set (e.g. new Operator.DefaultStringComparator(true, true); to search string item exactly and case sensitive)

getComparator

public org.netbeans.jemmy.operators.Operator.StringComparator getComparator()
Gets comparator set for this action instance.

Returns:
comparator set for this action instance.

getPopupPath

public String getPopupPath()
getter for popup menu path

Returns:
String popup menu path (or null if not suported)

getMenuPath

public String getMenuPath()
getter for main menu path

Returns:
String main menu path (or null if not suported)

getSystemActionClass

public Class getSystemActionClass()
getter for system action class

Returns:
Class of system action (or null if not suported)

getKeyStrokes

public KeyStroke[] getKeyStrokes()
Returns an array of KeyStroke objects.

Returns:
an array of KeyStroke objects or null if not defined.

isEnabled

public boolean isEnabled()
Checks whether this action is enabled. If IDE system action class is defined, it calls its isEnabled() method else if main menu path is defined, it checks menu item is enabled. Otherwise it throws UnsupportedOperationException.

Returns:
true if this action is enabled; false otherwise

isEnabled

public boolean isEnabled(Node[] nodes)
Checks whether this action on given nodes is enabled. If IDE system action class is defined, it calls its isEnabled() method. Nodes are selected first. Else if popup menu path is defined, it checks menu item is enabled. Otherwise it throws UnsupportedOperationException.

Parameters:
nodes - array of nodes to be selected before a check
Returns:
true if this action is enabled; false otherwise

isEnabled

public boolean isEnabled(Node node)
Checks whether this action on given node is enabled. If IDE system action class is defined, it calls its isEnabled() method. Node is selected first. Else if popup menu path is defined, it checks menu item is enabled. Otherwise it throws UnsupportedOperationException.

Parameters:
node - node to be selected before a check
Returns:
true if this action is enabled; false otherwise

isEnabled

public boolean isEnabled(org.netbeans.jemmy.operators.ComponentOperator componentOperator)
Checks whether this action is enabled for given ComponentOperator. First it makes component visible and focused. If IDE system action class is defined, it calls its isEnabled() method. Else if main menu path is defined, it checks menu item is enabled. Otherwise it throws UnsupportedOperationException.

Parameters:
componentOperator - instance of ComponentOperator
Returns:
true if this action is enabled; false otherwise

org.netbeans.modules.jellytools.platform/3 3.13

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.