Class NMStateAction

All Implemented Interfaces:
ActionListener, Serializable, Cloneable, Comparable, EventListener, Action
Direct Known Subclasses:
MDStateAction, SelectionItem, SelectionStateItem

@OpenApiAll public abstract class NMStateAction extends BaseNMStateAction
The class describes the action with some boolean state. The action has additional properties: state, grouped.
See Also:
  • Field Details

  • Constructor Details

    • NMStateAction

      public NMStateAction(@CheckForNull String id, @CheckForNull String name, @CheckForNull KeyStroke stroke, @CheckForNull String group)
      Creates action with given id, name, key stroke.
      Parameters:
      id - the id of the action.
      name - the name of the action.
      stroke - the key stroke of the action
      group - the name of the related commands group.
    • NMStateAction

      public NMStateAction(@CheckForNull String id, @CheckForNull String name, int mnemonic, @CheckForNull String group)
      Constructs the action with given id, name, mnemonic key.
      Parameters:
      id - the id of the action.
      name - the name of the action.
      mnemonic - the mnemonic key of the action
      group - the name of the related commands group.
    • NMStateAction

      public NMStateAction(@CheckForNull String id, @CheckForNull String name, @CheckForNull KeyStroke stroke)
      Creates action with given id, name, key stroke.
      Parameters:
      id - the id of the action.
      name - the name of the action.
      stroke - the key stroke of the action
    • NMStateAction

      public NMStateAction(@CheckForNull String id, @CheckForNull String name, int mnemonic)
      Constructs the action with given id, name, mnemonic key.
      Parameters:
      id - the id of the action.
      name - the name of the action.
      mnemonic - the mnemonic key of the action
  • Method Details

    • setState

      public void setState(boolean state)
      Sets action boolean state.
      Parameters:
      state - new state of action.
    • getState

      public boolean getState()
      Returns boolean state of this action.
      Returns:
      boolean state of this action.
    • accept

      public void accept(ActionsVisitor visitor)
      Accepts ActionsVisitor using Visitor design pattern.
      Overrides:
      accept in class NMAction
      Parameters:
      visitor - visitor to accept.
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Executes given action.
      Specified by:
      actionPerformed in interface ActionListener
      Specified by:
      actionPerformed in class NMAction
      Parameters:
      e - event caused execution.
    • isDistinguish

      public boolean isDistinguish()
      Return distinguish property.
      Returns:
      true if this action state is not strict.
    • setDistinguish

      public void setDistinguish(boolean dist)
      Sets new distinguish property.
      Parameters:
      dist - new value which specifies if state is strict or not.
    • isStateEvent

      public static boolean isStateEvent(@CheckForNull PropertyChangeEvent event)
      Parameters:
      event - instance of PropertyChangeEvent
      Returns:
      true when passed event property name equals to STATE, otherwise - false