Package com.nomagic.actions
Class NMStateAction
- java.lang.Object
 - 
- javax.swing.AbstractAction
 - 
- com.nomagic.actions.NMAction
 - 
- com.nomagic.actions.BaseNMStateAction
 - 
- com.nomagic.actions.NMStateAction
 
 
 
 
 
- 
- All Implemented Interfaces:
 java.awt.event.ActionListener,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,java.util.EventListener,javax.swing.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:
 - Serialized Form
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDISTINGUISHProperty which means that state is not strict.static java.lang.StringSTATEThe state property.- 
Fields inherited from class com.nomagic.actions.BaseNMStateAction
GROUPED 
- 
Fields inherited from class com.nomagic.actions.NMAction
ACTION_SHORTCUTS, BELONGS_TO_SEPARATE_GROUP_IN_UI, DO_NO_SHOW_ACTION_NAME_IN_UI, DO_NOT_REGISTER_ACTION_TO_COMPONENTS, GENERATED_ID_PREFIX, GROUP, ID, LARGE_ICON, MENU_SHORTCUT_MASK, TINY_ICON 
 - 
 
- 
Constructor Summary
Constructors Constructor Description NMStateAction(java.lang.String id, java.lang.String name, int mnemonic)Constructs the action with given id, name, mnemonic key.NMStateAction(java.lang.String id, java.lang.String name, int mnemonic, java.lang.String group)Constructs the action with given id, name, mnemonic key.NMStateAction(java.lang.String id, java.lang.String name, javax.swing.KeyStroke stroke)Creates action with given id, name, key stroke.NMStateAction(java.lang.String id, java.lang.String name, javax.swing.KeyStroke stroke, java.lang.String group)Creates action with given id, name, key stroke. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(ActionsVisitor visitor)Accepts ActionsVisitor using Visitor design pattern.voidactionPerformed(java.awt.event.ActionEvent e)Executes given action.booleangetState()Returns boolean state of this action.booleanisDistinguish()Return distinguish property.static booleanisStateEvent(java.beans.PropertyChangeEvent event)voidsetDistinguish(boolean dist)Sets new distinguish property.voidsetState(boolean state)Sets action boolean state.- 
Methods inherited from class com.nomagic.actions.BaseNMStateAction
isGrouped, setGrouped 
- 
Methods inherited from class com.nomagic.actions.NMAction
addAction, addPropertyChangeListener, addShortcut, addShotcut, addWeakPropertyChangeListener, clone, compareTo, createMenuItem, equals, firePropertyChange, forEach, forEachIncludingSelf, getActions, getCommandKey, getDescription, getGroup, getIcon, getID, getLargeIcon, getLargeOrSmallIcon, getMenuShortcutMaskAsString, getMnemonicKey, getName, getPropertyChangeListeners, getShortcuts, getSmallIcon, getSmallOrLargeIcon, getTinyIcon, hashCode, hasMenuShortcutMask, isIDGenerated, removeAction, removeIf, removePropertyChangeListener, removeShortcut, removeWeakPropertyChangeListener, setActions, setDescription, setGroup, setIcon, setLargeIcon, setMnemonicKey, setName, setShortcuts, setSmallIcon, setTinyIcon, shallowClone, toString, updateState 
- 
Methods inherited from class javax.swing.AbstractAction
getKeys, getValue, isEnabled, putValue, setEnabled 
 - 
 
 - 
 
- 
- 
Field Detail
- 
STATE
public static final java.lang.String STATE
The state property. Value of this property is Boolean.- See Also:
 - Constant Field Values
 
 
- 
DISTINGUISH
public static final java.lang.String DISTINGUISH
Property which means that state is not strict.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Constructor Detail
- 
NMStateAction
public NMStateAction(@CheckForNull java.lang.String id, @CheckForNull java.lang.String name, @CheckForNull javax.swing.KeyStroke stroke, @CheckForNull java.lang.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 actiongroup- the name of the related commands group.
 
- 
NMStateAction
public NMStateAction(@CheckForNull java.lang.String id, @CheckForNull java.lang.String name, int mnemonic, @CheckForNull java.lang.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 actiongroup- the name of the related commands group.
 
- 
NMStateAction
public NMStateAction(@CheckForNull java.lang.String id, @CheckForNull java.lang.String name, @CheckForNull javax.swing.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 java.lang.String id, @CheckForNull java.lang.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 Detail
- 
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. 
- 
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Executes given action.- Specified by:
 actionPerformedin interfacejava.awt.event.ActionListener- Specified by:
 actionPerformedin classNMAction- 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 java.beans.PropertyChangeEvent event)- Parameters:
 event- instance ofPropertyChangeEvent- Returns:
 truewhen passed event property name equals toSTATE, otherwise -false
 
 - 
 
 -