public abstract class AbstractCyAction extends AbstractAction implements CyAction
TaskFactory
/Task
pair. Doing so will
allow your action to be used outside of a Swing specific application (which
the CyAction interface binds you to)!Module: swing-application-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>swing-application-api</artifactId> </dependency>
Modifier and Type | Field and Description |
---|---|
protected KeyStroke |
acceleratorKeyStroke
The accelerator keystroke, if set.
|
protected boolean |
acceleratorSet
Indicates whether accelerator keys have been set for the action.
|
protected Map<String,String> |
configurationProperties
The configuration properties.
|
protected boolean |
inMenuBar
Indicates whether the action is in a menu.
|
protected boolean |
insertSeparatorAfter
Indicates whether a separator should be inserted after this item
|
protected boolean |
insertSeparatorBefore
Indicates whether a separator should be inserted before this item
|
protected boolean |
inToolBar
Indicates whether the action is in the toolbar.
|
protected float |
menuGravity
The float value placing the action within the menu.
|
protected String |
name
The name of the action.
|
protected String |
preferredMenu
The name describing the preferred menu for the action.
|
protected float |
toolbarGravity
The float value placing the action within the toolbar.
|
protected boolean |
useCheckBoxMenuItem
Indicates whether to use a checkbox menu item.
|
changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
AbstractCyAction(Map<String,String> configProps,
CyApplicationManager applicationManager,
CyNetworkViewManager networkViewManager)
Creates a new AbstractCyAction object.
|
AbstractCyAction(Map<String,String> configProps,
CyApplicationManager applicationManager,
CyNetworkViewManager networkViewManager,
TaskFactory factory)
Creates a new AbstractCyAction object.
|
AbstractCyAction(Map<String,String> configProps,
TaskFactory predicate)
Creates a new AbstractCyAction object.
|
AbstractCyAction(String name)
Creates a new AbstractCyAction object that is
always enabled.
|
AbstractCyAction(String name,
CyApplicationManager applicationManager,
String enableFor,
CyNetworkViewManager networkViewManager)
Creates a new AbstractCyAction object that is enabled for the
specific "enableFor" state.
|
Modifier and Type | Method and Description |
---|---|
KeyStroke |
getAcceleratorKeyStroke()
Returns the accelerator KeyStroke defined for this action.
|
float |
getMenuGravity()
Returns the gravity used to place the menu item for this action.
|
String |
getName()
Returns the name of the action.
|
String |
getPreferredMenu()
This method returns a Menu specification string.
|
Map<String,String> |
getProperties()
Return the config props.
|
float |
getToolbarGravity()
Returns the gravity used to place this action in the toolbar.
|
boolean |
insertSeparatorAfter()
Insert a separator after this menu item.
|
boolean |
insertSeparatorBefore()
Insert a separator before this menu item.
|
boolean |
isInMenuBar()
By default all CytoscapeActions wish to be included in the menu bar at
the 'preferredMenuName' location is specified and the 'Tools' menu not.
|
boolean |
isInToolBar()
By default no CytoscapeActions will be included in the toolbar.
|
void |
menuCanceled(MenuEvent e)
This method can be used at your discretion, but otherwise does nothing.
|
void |
menuDeselected(MenuEvent e)
This method can be used at your discretion, but otherwise does nothing.
|
void |
menuSelected(MenuEvent e)
This method can be overridden by individual actions to set the state of
menu items based on whatever unique circumstances that menu option cares
about.
|
void |
popupMenuCanceled(PopupMenuEvent e)
This method can be used at your discretion, but otherwise does nothing.
|
void |
popupMenuWillBecomeInvisible(PopupMenuEvent e)
This method can be used at your discretion, but otherwise does nothing.
|
void |
popupMenuWillBecomeVisible(PopupMenuEvent e)
This method can be overridden by individual actions to set the state of
menu items based on whatever unique circumstances that menu option cares
about.
|
void |
setAcceleratorKeyStroke(KeyStroke ks)
Sets the accelerator KeyStroke for this action.
|
void |
setMenuGravity(float gravity)
Sets the gravity used to order this action in the menu bar.
|
void |
setName(String name)
Sets the name of the action.
|
void |
setPreferredMenu(String newPreferredMenu)
Sets the preferredMenuString.
|
void |
setToolbarGravity(float gravity)
Sets the gravity used to order this action in the toolbar.
|
void |
updateEnableState()
Triggers the enable state of the action to be updated based
on the enableFor state of the action and the state of the
system.
|
boolean |
useCheckBoxMenuItem()
Returns whether or not a checkbox menu item should be used.
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
actionPerformed
protected String preferredMenu
protected float menuGravity
protected float toolbarGravity
protected boolean acceleratorSet
protected KeyStroke acceleratorKeyStroke
protected boolean useCheckBoxMenuItem
protected boolean inToolBar
protected boolean inMenuBar
protected boolean insertSeparatorBefore
protected boolean insertSeparatorAfter
protected String name
public AbstractCyAction(String name)
name
- The name of the action.public AbstractCyAction(String name, CyApplicationManager applicationManager, String enableFor, CyNetworkViewManager networkViewManager)
name
- The name of the action.applicationManager
- The application manager providing context for this action.enableFor
- A string declaring which states this action should be enabled for.networkViewManager
- The network view manager that provides context for this action.public AbstractCyAction(Map<String,String> configProps, CyApplicationManager applicationManager, CyNetworkViewManager networkViewManager)
configProps
- A String-String Map of configuration metadata. This will
usually be the Map provided by the OSGi service
configuration. Available configuration keys include:
ActionEnableSupport
for more detail.)applicationManager
- The application manager providing context for this action.public AbstractCyAction(Map<String,String> configProps, TaskFactory predicate)
configProps
- A String-String Map of configuration metadata. This will
usually be the Map provided by the OSGi service
configuration. Available configuration keys include:
predicate
- The task factory predicate that indicates whether or not this
action should be enabled.public AbstractCyAction(Map<String,String> configProps, CyApplicationManager applicationManager, CyNetworkViewManager networkViewManager, TaskFactory factory)
configProps
- A String-String Map of configuration metadata. This will
usually be the Map provided by the OSGi service
configuration. Available configuration keys include:
ActionEnableSupport
for more detail.)applicationManager
- The application manager providing context for this action.factory
- The task factory that may or may not be a TaskFactoryPredicate. If it is a predicate,
it will be used to indicate whether or not this action should be enabled. This
TaskFactory is not used by the AbstractCyAction in any other way. Any execution of tasks
from this TaskFactory must be handled by a subclass.public void setName(String name)
name
- The name of the action.public String getName()
public boolean isInMenuBar()
isInMenuBar
in interface CyAction
public boolean isInToolBar()
isInToolBar
in interface CyAction
public boolean insertSeparatorBefore()
insertSeparatorBefore
in interface CyAction
public boolean insertSeparatorAfter()
insertSeparatorAfter
in interface CyAction
public void setMenuGravity(float gravity)
gravity
- The gravity for ordering menu bar actions.public float getMenuGravity()
getMenuGravity
in interface CyAction
public void setToolbarGravity(float gravity)
gravity
- The gravity for ordering toolbar actions.public float getToolbarGravity()
getToolbarGravity
in interface CyAction
public void setAcceleratorKeyStroke(KeyStroke ks)
ks
- The KeyStroke to be used as an accelerator for this action.
This parameter may be null, in which case no accelerator is
defined.public KeyStroke getAcceleratorKeyStroke()
getAcceleratorKeyStroke
in interface CyAction
public String getPreferredMenu()
getPreferredMenu
in interface CyAction
public void setPreferredMenu(String newPreferredMenu)
getPreferredMenu()
description for formatting description.newPreferredMenu
- The string describing the preferred menu name.public boolean useCheckBoxMenuItem()
useCheckBoxMenuItem
in interface CyAction
public void menuCanceled(MenuEvent e)
menuCanceled
in interface MenuListener
e
- The triggering event.public void menuDeselected(MenuEvent e)
menuDeselected
in interface MenuListener
e
- The triggering event.public void menuSelected(MenuEvent e)
menuSelected
in interface MenuListener
e
- The triggering event.public void popupMenuWillBecomeVisible(PopupMenuEvent e)
popupMenuWillBecomeVisible
in interface PopupMenuListener
e
- The triggering event.public void popupMenuWillBecomeInvisible(PopupMenuEvent e)
popupMenuWillBecomeInvisible
in interface PopupMenuListener
e
- The triggering event.public void popupMenuCanceled(PopupMenuEvent e)
popupMenuCanceled
in interface PopupMenuListener
e
- The triggering event.public void updateEnableState()
updateEnableState
in interface CyAction
public Map<String,String> getProperties()
getProperties
in interface CyAction
Copyright 2011-2015 Cytoscape Consortium. All rights reserved.