Package org.cytoscape.application.swing
Class ActionEnableSupport
- java.lang.Object
-
- org.cytoscape.application.swing.ActionEnableSupport
-
public final class ActionEnableSupport extends Object
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:- network
- networkWithoutView
- networkAndView
- selectedNodesOrEdges
- selectedNodes
- selectedEdges
- table
- always
Module:
swing-application-apiTo 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 (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.
-
-
Field Summary
Fields Modifier and Type Field Description static StringENABLE_FOR_ALWAYSEnable always.static StringENABLE_FOR_NETWORKEnable when at least one network exists.static StringENABLE_FOR_NETWORK_AND_VIEWEnable when at least one network WITH view exists.static StringENABLE_FOR_NETWORK_WITHOUT_VIEWEnable when at least one network with NO view exists.static StringENABLE_FOR_SELECTED_EDGESEnable when edges have been selected in a network.static StringENABLE_FOR_SELECTED_NODESEnable when nodes have been selected in a network.static StringENABLE_FOR_SELECTED_NODES_OR_EDGESEnable when either nodes or edges have been selected in a network.static StringENABLE_FOR_SINGLE_NETWORKEnable when only one network is selected.static StringENABLE_FOR_TABLEEnable when at least one network exists.
-
Constructor Summary
Constructors Constructor Description ActionEnableSupport(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisCurrentlyEnabled()Returns true if the action/menuListener/menuItem is enabled, false otherwise.protected voidsetEnabled(boolean b)voidupdateEnableState()Updates the enable state for the specified action/menuListener/menuItem for the specified enableFor description and the state of the system.
-
-
-
Field Detail
-
ENABLE_FOR_NETWORK
public static final String ENABLE_FOR_NETWORK
Enable when at least one network exists.- See Also:
- Constant Field Values
-
ENABLE_FOR_SINGLE_NETWORK
public static final String ENABLE_FOR_SINGLE_NETWORK
Enable when only one network is selected.- See Also:
- Constant Field Values
-
ENABLE_FOR_NETWORK_WITHOUT_VIEW
public static final String ENABLE_FOR_NETWORK_WITHOUT_VIEW
Enable when at least one network with NO view exists.- See Also:
- Constant Field Values
-
ENABLE_FOR_NETWORK_AND_VIEW
public static final String ENABLE_FOR_NETWORK_AND_VIEW
Enable when at least one network WITH view exists.- See Also:
- Constant Field Values
-
ENABLE_FOR_SELECTED_NODES_OR_EDGES
public static final String ENABLE_FOR_SELECTED_NODES_OR_EDGES
Enable when either nodes or edges have been selected in a network.- See Also:
- Constant Field Values
-
ENABLE_FOR_SELECTED_NODES
public static final String ENABLE_FOR_SELECTED_NODES
Enable when nodes have been selected in a network.- See Also:
- Constant Field Values
-
ENABLE_FOR_SELECTED_EDGES
public static final String ENABLE_FOR_SELECTED_EDGES
Enable when edges have been selected in a network.- See Also:
- Constant Field Values
-
ENABLE_FOR_TABLE
public static final String ENABLE_FOR_TABLE
Enable when at least one network exists.- See Also:
- Constant Field Values
-
ENABLE_FOR_ALWAYS
public static final String ENABLE_FOR_ALWAYS
Enable always.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ActionEnableSupport
public ActionEnableSupport(DynamicSubmenuListener submenuListener, String enableFor, CyApplicationManager applicationManager, CyNetworkViewManager networkViewManager)
Constructor.- Parameters:
submenuListener- The submenu listener whose enabled state will be updated.enableFor- The description of how the submenu should be enabled. See class documentation above for allowable values for this string.applicationManager- The application manager.
-
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 Detail
-
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.
-
-