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

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 Details

    • 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 Details

    • 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 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.