Package org.cytoscape.application.swing
Interface CyAction
-
- All Superinterfaces:
Action
,ActionListener
,EventListener
,MenuListener
,PopupMenuListener
- All Known Implementing Classes:
AbstractCyAction
public interface CyAction extends Action, MenuListener, PopupMenuListener
An interface that describes how an action should be placed within the menus and/or toolbars of the Swing application.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>
Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified for major version updates.
-
-
Field Summary
-
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method 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()
Returns the configuration properties that were passed to the CyAction when it was created.float
getToolbarGravity()
Returns the gravity used to place this action in the toolbar.default URL
getToolTipImage()
Optional image to be displayed in the target component's tool tip.boolean
insertSeparatorAfter()
Insert a separator after this menu item.boolean
insertSeparatorBefore()
Insert a separator before this menu item.boolean
isInMenuBar()
Returns whether the action should be in the menu bar.boolean
isInToolBar()
Returns whether the action should be in the tool bar.void
setAcceleratorKeyStroke(KeyStroke ks)
Was defined in AbstractCyAction, but not in this interfacevoid
setIsInMenuBar(boolean b)
To support configurable menus and tools, setIsInMenuBar added for 3.6void
setIsInToolBar(boolean b)
To support configurable menus and tools, setIsInToolBar added for 3.6void
setMenuGravity(float f)
To support configurable menus and tools, setMenuGravity added for 3.6void
setPreferredMenu(String menu)
To support configurable menus and tools, setPreferredMenu added for 3.6void
setToolbarGravity(float f)
To support configurable menus and tools, setToolbarGravity added for 3.6void
updateEnableState()
Forces the action to update its enable state based on the criteria defined for the action.boolean
useCheckBoxMenuItem()
Returns whether or not a checkbox menu item should be used.default boolean
useToggleButton()
Returns whether or not a toggle button should be used in the tool bar.-
Methods inherited from interface javax.swing.Action
accept, addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
-
Methods inherited from interface javax.swing.event.MenuListener
menuCanceled, menuDeselected, menuSelected
-
Methods inherited from interface javax.swing.event.PopupMenuListener
popupMenuCanceled, popupMenuWillBecomeInvisible, popupMenuWillBecomeVisible
-
-
-
-
Method Detail
-
getName
String getName()
Returns the name of the action.- Returns:
- the name of the action.
-
isInMenuBar
boolean isInMenuBar()
Returns whether the action should be in the menu bar.- Returns:
- whether the action should be in the menu bar.
-
isInToolBar
boolean isInToolBar()
Returns whether the action should be in the tool bar.- Returns:
- whether the action should be in the tool bar.
-
insertSeparatorBefore
boolean insertSeparatorBefore()
Insert a separator before this menu item.- Returns:
- true if this Action should have a separator before it
-
insertSeparatorAfter
boolean insertSeparatorAfter()
Insert a separator after this menu item.- Returns:
- true if this Action should have a separator after it
-
getMenuGravity
float getMenuGravity()
Returns the gravity used to place the menu item for this action. Gravity is a numeric value associated with each menu item. MenuItems in the same menu pull-down are sorted in ascending order based on their gravity values.- Returns:
- The gravity used to place the menu item for this action.
-
getToolbarGravity
float getToolbarGravity()
Returns the gravity used to place this action in the toolbar. Gravity is a numeric value associated with each menu item. MenuItems in the same menu pull-down are sorted in ascending order based on their gravity values.- Returns:
- The gravity used to place this action in the toolbar.
-
getAcceleratorKeyStroke
KeyStroke getAcceleratorKeyStroke()
Returns the accelerator KeyStroke defined for this action. Will return null if no accelerator is set.- Returns:
- the accelerator KeyStroke defined for this action. Will return null if no accelerator is set.
-
getPreferredMenu
String getPreferredMenu()
This method returns a Menu specification string. Submenus are preceded by dots in this string, so the result "File.Import" specifies the submenu "Import" of the menu "File". If the result is null, the menu will be placed in a default location.- Returns:
- the string identifying the preferred menu.
-
useCheckBoxMenuItem
boolean useCheckBoxMenuItem()
Returns whether or not a checkbox menu item should be used. UseAction.putValue(String, Object)
to set the value ofAction.SELECTED_KEY
to true in order to have the menu item checked.- Returns:
- whether or not a checkbox menu item should be used.
-
useToggleButton
default boolean useToggleButton()
Returns whether or not a toggle button should be used in the tool bar. Only valid whensetIsInToolBar(boolean)
is also set to true. UseAction.putValue(String, Object)
to set the value ofAction.SELECTED_KEY
to true in order to have the toggle button selected.- Returns:
- true toggle button should be used.
-
updateEnableState
void updateEnableState()
Forces the action to update its enable state based on the criteria defined for the action.
-
getProperties
Map<String,String> getProperties()
Returns the configuration properties that were passed to the CyAction when it was created.
-
setIsInMenuBar
void setIsInMenuBar(boolean b)
To support configurable menus and tools, setIsInMenuBar added for 3.6
-
setIsInToolBar
void setIsInToolBar(boolean b)
To support configurable menus and tools, setIsInToolBar added for 3.6
-
setPreferredMenu
void setPreferredMenu(String menu)
To support configurable menus and tools, setPreferredMenu added for 3.6
-
setToolbarGravity
void setToolbarGravity(float f)
To support configurable menus and tools, setToolbarGravity added for 3.6
-
setMenuGravity
void setMenuGravity(float f)
To support configurable menus and tools, setMenuGravity added for 3.6
-
setAcceleratorKeyStroke
void setAcceleratorKeyStroke(KeyStroke ks)
Was defined in AbstractCyAction, but not in this interface
-
getToolTipImage
default URL getToolTipImage()
Optional image to be displayed in the target component's tool tip.
-
-