Package com.nomagic.magicdraw.ui.actions
Class DiagramContextToolbarAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.nomagic.actions.NMAction
-
- com.nomagic.magicdraw.actions.MDAction
-
- com.nomagic.magicdraw.ui.actions.DefaultDiagramAction
-
- com.nomagic.magicdraw.ui.actions.DiagramContextToolbarAction
-
- All Implemented Interfaces:
DiagramAction,com.nomagic.magicdraw.actions.ShortcutSchemaAction,java.awt.event.ActionListener,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,java.util.EventListener,javax.swing.Action
@OpenApiAll public class DiagramContextToolbarAction extends DefaultDiagramAction
Diagram context toolbar action- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private booleanextendedActionprivate booleanfakeMouseEventsprivate booleanreuseIconFromInnerActionIndicates if icon should be reused from inner action.-
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 DiagramContextToolbarAction(java.lang.String actionID, java.lang.String name, javax.swing.Icon icon)DiagramContextToolbarAction(java.lang.String actionID, javax.swing.Icon icon)DiagramContextToolbarAction(java.lang.String actionID, javax.swing.Icon icon, boolean isExtendedAction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)Executes action.protected voidcloseContextToolbar()javax.swing.IcongetLargeIcon()Returns the large icon of the action.javax.swing.IcongetSmallIcon()Returns the small icon of the action.private NMActiongetWrappedAction()booleanisExtendedAction()booleanisFakeMouseEvents()Return fake mouse event flag - does this action fakes mouse pressed and mouse released event on action event.booleanisReuseIconFromInnerAction()Gets reuse icon from inner action flag value.voidsetExtendedAction(boolean isExtended)voidsetFakeMouseEvents(boolean fakeMouseEvents)Sets fake mouse event flag - does this action fakes mouse pressed and mouse released event on action event.voidsetReuseIconFromInnerAction(boolean reuseIconFromInnerAction)Sets reuse icon from inner action flag value.protected voidshowContextToolbarIfCanvasFocused(com.nomagic.magicdraw.ui.DiagramWindowPanel panel)private voidupdateByWrappedActionState()private booleanupdateByWrappedDrawActionState()voidupdateState()If action has assigned relative group, takes enable flag value from this group and sets to itself.-
Methods inherited from class com.nomagic.magicdraw.ui.actions.DefaultDiagramAction
getDiagram, getFirstSelected, getSelected, setDiagram
-
Methods inherited from class com.nomagic.magicdraw.actions.MDAction
isUseShortcutSchema
-
Methods inherited from class com.nomagic.actions.NMAction
accept, addAction, addPropertyChangeListener, addShortcut, addShotcut, addWeakPropertyChangeListener, clone, compareTo, createMenuItem, equals, firePropertyChange, forEach, forEachIncludingSelf, getActions, getCommandKey, getDescription, getGroup, getIcon, getID, getLargeOrSmallIcon, getMenuShortcutMaskAsString, getMnemonicKey, getName, getPropertyChangeListeners, getShortcuts, 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
-
-
-
-
Constructor Detail
-
DiagramContextToolbarAction
public DiagramContextToolbarAction(java.lang.String actionID, @CheckForNull javax.swing.Icon icon)
-
DiagramContextToolbarAction
public DiagramContextToolbarAction(java.lang.String actionID, @CheckForNull java.lang.String name, @CheckForNull javax.swing.Icon icon)
-
DiagramContextToolbarAction
public DiagramContextToolbarAction(java.lang.String actionID, @CheckForNull javax.swing.Icon icon, boolean isExtendedAction)
-
-
Method Detail
-
updateState
public void updateState()
Description copied from class:MDActionIf action has assigned relative group, takes enable flag value from this group and sets to itself.- Overrides:
updateStatein classMDAction
-
updateByWrappedActionState
private void updateByWrappedActionState()
-
updateByWrappedDrawActionState
private boolean updateByWrappedDrawActionState()
-
getSmallIcon
public javax.swing.Icon getSmallIcon()
Description copied from class:NMActionReturns the small icon of the action.- Overrides:
getSmallIconin classNMAction- Returns:
- the small icon of the action.
-
getLargeIcon
public javax.swing.Icon getLargeIcon()
Description copied from class:NMActionReturns the large icon of the action.- Overrides:
getLargeIconin classNMAction- Returns:
- the large icon of the action.
-
getWrappedAction
@CheckForNull private NMAction getWrappedAction()
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Description copied from class:MDActionExecutes action.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Overrides:
actionPerformedin classMDAction- Parameters:
e- event caused execution.
-
showContextToolbarIfCanvasFocused
protected void showContextToolbarIfCanvasFocused(com.nomagic.magicdraw.ui.DiagramWindowPanel panel)
-
closeContextToolbar
protected void closeContextToolbar()
-
setExtendedAction
public void setExtendedAction(boolean isExtended)
-
isExtendedAction
public boolean isExtendedAction()
-
isFakeMouseEvents
public boolean isFakeMouseEvents()
Return fake mouse event flag - does this action fakes mouse pressed and mouse released event on action event.- Returns:
- true if fake mouse event should be generated
-
setFakeMouseEvents
public void setFakeMouseEvents(boolean fakeMouseEvents)
Sets fake mouse event flag - does this action fakes mouse pressed and mouse released event on action event.- Parameters:
fakeMouseEvents- true if generate fake mouse events
-
setReuseIconFromInnerAction
public void setReuseIconFromInnerAction(boolean reuseIconFromInnerAction)
Sets reuse icon from inner action flag value.- Parameters:
reuseIconFromInnerAction- reuse icon from inner action flag value.
-
isReuseIconFromInnerAction
public boolean isReuseIconFromInnerAction()
Gets reuse icon from inner action flag value.- Returns:
- reuse icon from inner action flag value.
-
-