Package com.nomagic.actions
Class SetFontAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.nomagic.actions.NMAction
-
- com.nomagic.actions.ActionsCategory
-
- com.nomagic.actions.SetFontAction
-
- All Implemented Interfaces:
com.nomagic.actions.ShortcutsNotCustomizable,com.nomagic.actions.StandaloneAction,DiagramAction,java.awt.event.ActionListener,java.beans.PropertyChangeListener,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,java.util.EventListener,javax.swing.Action
@OpenApiAll public abstract class SetFontAction extends ActionsCategory implements java.beans.PropertyChangeListener, DiagramAction, com.nomagic.actions.StandaloneAction, com.nomagic.actions.ShortcutsNotCustomizable
Action for choosing font(size and font face).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ref.WeakReference<DiagramPresentationElement>mDiagramThe diagram for this action.private SetFontFaceActionmSetFontFaceActionThe action for choosing font face.private SetFontSizeActionmSetFontSizeActionThe action for choosing font size.-
Fields inherited from class com.nomagic.actions.ActionsCategory
ACTIONS_PROPERTY, ADDED_ACTION_PROPERTY, CHANGE_ACTIONS_PROPERTY, DISABLE_IF_EMPTY, MAX_CATEGORY_ACTIONS, REMOVE_IF_EMPTY, REMOVED_ACTION_PROPERTY, USE_AS_SEPARATOR_IN_UI
-
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 SetFontAction(java.lang.String id, java.lang.String name, javax.swing.KeyStroke stroke, java.lang.String group)Constructs new font action with given id, name, stroke and group.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidchangeFontFace(java.lang.String newFontFace)This method is called then inner action for font face name changes its value.abstract voidchangeFontSize(int newSize)This method is called then inner action for font size changes its value.SetFontActionclone()Clones the category.DiagramPresentationElementgetDiagram()Returns diagram of this action.SetFontFaceActiongetSetFontFaceAction()Returns inner font face action.SetFontSizeActiongetSetFontSizeAction()Returns inner font size action.voidpropertyChange(java.beans.PropertyChangeEvent e)Listens for property changes in child actions(font face and font size).voidsetDiagram(DiagramPresentationElement diagram)Sets diagram for this action.voidsetEnabled(boolean val)Enables or disables this action.voidsetSetFontFaceAction(SetFontFaceAction fontFaceAction)Sets new font face inner action.voidsetSetFontSizeAction(SetFontSizeAction fontSizeAction)Sets new font size inner action.-
Methods inherited from class com.nomagic.actions.ActionsCategory
accept, actionPerformed, addAction, addAction, addActionNearTheGiven, addActions, breakActions, breakActions, breakActions, breakeActions, createSeparatorCategory, forEach, forEachIncludingSelf, getAction, getActions, getActionsRecursively, getCategories, isDisplayHeader, isEmpty, isNested, isUseActionForDisable, removeAction, removeIf, setActions, setDisplayHeader, setNested, setUseActionForDisable, shallowClone, size, sort
-
Methods inherited from class com.nomagic.actions.NMAction
addPropertyChangeListener, addShortcut, addShotcut, addWeakPropertyChangeListener, compareTo, createMenuItem, equals, firePropertyChange, getCommandKey, getDescription, getGroup, getIcon, getID, getLargeIcon, getLargeOrSmallIcon, getMenuShortcutMaskAsString, getMnemonicKey, getName, getPropertyChangeListeners, getShortcuts, getSmallIcon, getSmallOrLargeIcon, getTinyIcon, hashCode, hasMenuShortcutMask, isIDGenerated, removePropertyChangeListener, removeShortcut, removeWeakPropertyChangeListener, setDescription, setGroup, setIcon, setLargeIcon, setMnemonicKey, setName, setShortcuts, setSmallIcon, setTinyIcon, toString, updateState
-
-
-
-
Field Detail
-
mDiagram
private java.lang.ref.WeakReference<DiagramPresentationElement> mDiagram
The diagram for this action.
-
mSetFontSizeAction
private SetFontSizeAction mSetFontSizeAction
The action for choosing font size.
-
mSetFontFaceAction
private SetFontFaceAction mSetFontFaceAction
The action for choosing font face.
-
-
Constructor Detail
-
SetFontAction
public SetFontAction(java.lang.String id, java.lang.String name, @CheckForNull javax.swing.KeyStroke stroke, @CheckForNull java.lang.String group)Constructs new font action with given id, name, stroke and group.- Parameters:
id- the id of action.name- the name of action.stroke- the key stroke of action.group- the name of relative actions group.
-
-
Method Detail
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Listens for property changes in child actions(font face and font size). If child action changes value, the methodchangeFontFace()orchangeFontSize()is called.- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- Parameters:
e- the property change event.
-
changeFontSize
public abstract void changeFontSize(int newSize)
This method is called then inner action for font size changes its value.- Parameters:
newSize- the new font size.
-
changeFontFace
public abstract void changeFontFace(java.lang.String newFontFace)
This method is called then inner action for font face name changes its value.- Parameters:
newFontFace- the name of new font face.
-
setSetFontFaceAction
public void setSetFontFaceAction(SetFontFaceAction fontFaceAction)
Sets new font face inner action. Old font face action will be removed.- Parameters:
fontFaceAction- the new font face action.
-
getSetFontFaceAction
public SetFontFaceAction getSetFontFaceAction()
Returns inner font face action.- Returns:
- inner font face action.
-
setSetFontSizeAction
public void setSetFontSizeAction(SetFontSizeAction fontSizeAction)
Sets new font size inner action. Old font size action will be removed.- Parameters:
fontSizeAction- the new font size action.
-
getSetFontSizeAction
public SetFontSizeAction getSetFontSizeAction()
Returns inner font size action.- Returns:
- inner font size action.
-
setEnabled
public void setEnabled(boolean val)
Enables or disables this action. Inner font size and font face actions also will be enabled or disabled.- Specified by:
setEnabledin interfacejavax.swing.Action- Overrides:
setEnabledin classjavax.swing.AbstractAction- Parameters:
val- the new enable flag.
-
setDiagram
public void setDiagram(DiagramPresentationElement diagram)
Sets diagram for this action.- Specified by:
setDiagramin interfaceDiagramAction- Parameters:
diagram- the given diagram.
-
getDiagram
@CheckForNull public DiagramPresentationElement getDiagram()
Returns diagram of this action. MagicDraw framework guarantee that diagram will set if this method is called from updateState() or actionPerformed(ActionEvent) methods.
-
clone
public SetFontAction clone()
Clones the category. During clone does not fires any property change events. Does deep clone.- Overrides:
clonein classActionsCategory- Returns:
- deep clone of category.
-
-