Package org.cytoscape.application.swing
Class ActionEnableSupport
java.lang.Object
org.cytoscape.application.swing.ActionEnableSupport
A class that allows the enabled state of an Action of JMenuItem to managed in
a consistent way.
Recognized values for the "enableFor" description string are:
Recognized values for the "enableFor" description string are:
- network
- networkWithoutView
- networkAndView
- selectedNodesOrEdges
- selectedNodes
- selectedEdges
- table
- always
Cytoscape Backwards Compatibility (Final Class): This class is final and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
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>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Enable always.static final String
Enable when at least one network exists.static final String
Enable when at least one network WITH view exists.static final String
Enable when at least one network with NO view exists.static final String
Enable when edges have been selected in a network.static final String
Enable when nodes have been selected in a network.static final String
Enable when either nodes or edges have been selected in a network.static final String
Enable when only one network is selected.static final String
Enable when at least one network exists. -
Constructor Summary
ConstructorDescriptionActionEnableSupport
(Action action, String enableFor, CyApplicationManager applicationManager, CyNetworkViewManager networkViewManager) Constructor.ActionEnableSupport
(JMenuItem menuItem, String enableFor, CyApplicationManager applicationManager, CyNetworkViewManager networkViewManager) Constructor.ActionEnableSupport
(DynamicSubmenuListener submenuListener, String enableFor, CyApplicationManager applicationManager, CyNetworkViewManager networkViewManager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Returns true if the action/menuListener/menuItem is enabled, false otherwise.protected void
setEnabled
(boolean b) void
Updates the enable state for the specified action/menuListener/menuItem for the specified enableFor description and the state of the system.
-
Field Details
-
ENABLE_FOR_NETWORK
Enable when at least one network exists.- See Also:
-
ENABLE_FOR_SINGLE_NETWORK
Enable when only one network is selected.- See Also:
-
ENABLE_FOR_NETWORK_WITHOUT_VIEW
Enable when at least one network with NO view exists.- See Also:
-
ENABLE_FOR_NETWORK_AND_VIEW
Enable when at least one network WITH view exists.- See Also:
-
ENABLE_FOR_SELECTED_NODES_OR_EDGES
Enable when either nodes or edges have been selected in a network.- See Also:
-
ENABLE_FOR_SELECTED_NODES
Enable when nodes have been selected in a network.- See Also:
-
ENABLE_FOR_SELECTED_EDGES
Enable when edges have been selected in a network.- See Also:
-
ENABLE_FOR_TABLE
Enable when at least one network exists.- See Also:
-
ENABLE_FOR_ALWAYS
Enable always.- See Also:
-
-
Constructor Details
-
ActionEnableSupport
public ActionEnableSupport(Action action, String enableFor, CyApplicationManager applicationManager, CyNetworkViewManager networkViewManager) Constructor.- Parameters:
action
- The action whose enabled state will be updated.enableFor
- The description of how the action should be enabled. See class documentation above for allowable values for this string.applicationManager
- The application manager.
-
ActionEnableSupport
public ActionEnableSupport(JMenuItem menuItem, String enableFor, CyApplicationManager applicationManager, CyNetworkViewManager networkViewManager) Constructor.- Parameters:
menuItem
- The menuItem whose enabled state will be updated.enableFor
- The description of how the menuItem should be enabled. See class documentation above for allowable values for this string.applicationManager
- The application manager.
-
Method Details
-
updateEnableState
public void updateEnableState()Updates the enable state for the specified action/menuListener/menuItem for the specified enableFor description and the state of the system. -
setEnabled
protected void setEnabled(boolean b) -
isCurrentlyEnabled
public final boolean isCurrentlyEnabled()Returns true if the action/menuListener/menuItem is enabled, false otherwise.- Returns:
- true if the action/menuListener/menuItem is enabled, false otherwise.
-