Package com.nomagic.magicdraw.actions
Class PropertyAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.nomagic.actions.NMAction
-
- com.nomagic.magicdraw.actions.MDAction
-
- com.nomagic.magicdraw.actions.PropertyAction
-
- All Implemented Interfaces:
com.nomagic.magicdraw.actions.ShortcutSchemaAction
,java.awt.event.ActionListener
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,java.util.EventListener
,javax.swing.Action
@OpenApiAll public class PropertyAction extends MDAction implements java.beans.PropertyChangeListener
Action for changing assigned property value.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MANAGER_CHANGED
-
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 PropertyAction(PropertyManager manager, java.lang.String propertyID)
The constructor for action with given property.PropertyAction(java.lang.String actionID, PropertyManager manager, java.lang.String propertyID)
The constructor for action with given property.PropertyAction(java.lang.String actionID, PropertyManager manager, java.lang.String propertyID, boolean useShortcutSchema)
The constructor for action with given property.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(ActionsVisitor visitor)
Accepts ActionsVisitor using Visitor pattern.void
addChangeListener(java.beans.PropertyChangeListener listener)
Add the listener which will be notified about the change of underlying property manager of this actionvoid
addChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
Add the listener which will be notified about the change of underlying property manager of this actionprotected void
changePropertyValue(java.lang.Object newValue)
Change value of a propertyprotected void
fireManagerChanged(PropertyManager oldManager, PropertyManager newManager)
Fires the notification about the property manager changePropertyManager
getManager()
Get the manager.java.lang.Object
getNewValue()
Gets the new property value.Property
getProperty()
Returns the property.java.lang.String
getPropertyID()
Get the property id.void
propertyChange(java.beans.PropertyChangeEvent evt)
void
removeChangeListener(java.beans.PropertyChangeListener listener)
Remove the listener from this actionvoid
removeChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
Remove the listener from this actionvoid
setManager(PropertyManager manager)
Set the manager.void
setNewValue(java.lang.Object newValue)
Sets the new property value.protected void
setPropertyId(java.lang.String id)
Sets property id-
Methods inherited from class com.nomagic.magicdraw.actions.MDAction
actionPerformed, isUseShortcutSchema, updateState
-
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
-
Methods inherited from class javax.swing.AbstractAction
getKeys, getValue, isEnabled, putValue, setEnabled
-
-
-
-
Field Detail
-
MANAGER_CHANGED
public static final java.lang.String MANAGER_CHANGED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PropertyAction
public PropertyAction(PropertyManager manager, java.lang.String propertyID)
The constructor for action with given property.- Parameters:
manager
- property managerpropertyID
- id of the property
-
PropertyAction
public PropertyAction(java.lang.String actionID, PropertyManager manager, java.lang.String propertyID)
The constructor for action with given property.- Parameters:
actionID
- id of the actionmanager
- property managerpropertyID
- id of the property
-
PropertyAction
public PropertyAction(java.lang.String actionID, PropertyManager manager, java.lang.String propertyID, boolean useShortcutSchema)
The constructor for action with given property.- Parameters:
actionID
- id of the actionmanager
- property managerpropertyID
- id of the propertyuseShortcutSchema
- use shortcuts schema for this action
-
-
Method Detail
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
-
setNewValue
public void setNewValue(java.lang.Object newValue)
Sets the new property value.- Parameters:
newValue
- the new property value.
-
getNewValue
public java.lang.Object getNewValue()
Gets the new property value.- Returns:
- the new property value
-
getProperty
public Property getProperty()
Returns the property.- Returns:
- returns an assigned property
-
changePropertyValue
protected void changePropertyValue(java.lang.Object newValue)
Change value of a property- Parameters:
newValue
- new value
-
accept
public void accept(ActionsVisitor visitor)
Description copied from class:NMAction
Accepts ActionsVisitor using Visitor pattern.
-
getManager
public PropertyManager getManager()
Get the manager.- Returns:
- returns the manager
-
setManager
public void setManager(PropertyManager manager)
Set the manager.- Parameters:
manager
- the new manager
-
fireManagerChanged
protected void fireManagerChanged(PropertyManager oldManager, PropertyManager newManager)
Fires the notification about the property manager change- Parameters:
oldManager
- old managernewManager
- new manager
-
getPropertyID
public java.lang.String getPropertyID()
Get the property id.- Returns:
- Returns the id
-
setPropertyId
protected void setPropertyId(java.lang.String id)
Sets property id- Parameters:
id
- property id
-
addChangeListener
public void addChangeListener(java.beans.PropertyChangeListener listener)
Add the listener which will be notified about the change of underlying property manager of this action- Parameters:
listener
- for property change notifications
-
addChangeListener
public void addChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
Add the listener which will be notified about the change of underlying property manager of this action- Parameters:
property
- the listener will be notified only about this property changeslistener
- for property change notifications- See Also:
MANAGER_CHANGED
-
removeChangeListener
public void removeChangeListener(java.beans.PropertyChangeListener listener)
Remove the listener from this action- Parameters:
listener
- to be removed
-
removeChangeListener
public void removeChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
Remove the listener from this action- Parameters:
property
- the name of the propertylistener
- to be removed
-
-