@OpenApiAll public class ActionsCategory extends NMAction
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACTIONS_PROPERTY
Property Change event name fired when actions of this category were changed.
|
static java.lang.String |
ADDED_ACTION_PROPERTY
Property Change event name fired when new action is added.
|
static java.lang.String |
CHANGE_ACTIONS_PROPERTY
Deprecated.
|
static int |
MAX_CATEGORY_ACTIONS
Default value limiting maximum action count in one category
|
static java.lang.String |
REMOVED_ACTION_PROPERTY
Property Change event name fired when new action is removed.
|
static java.lang.String |
USE_AS_SEPARATOR_IN_UI
A name of property to use this category as separator in UI even if it does not have inner actions
|
ACTION_SHORTCUTS, BELONGS_TO_SEPARATE_GROUP_IN_UI, DO_NO_SHOW_ACTION_NAME_IN_UI, GENERATED_ID_PREFIX, GROUP, ID, LARGE_ICON, MENU_SHORTCUT_MASK
Constructor and Description |
---|
ActionsCategory(java.lang.String id,
java.lang.String name)
Creates actions category with given name and id.
|
ActionsCategory(java.lang.String id,
java.lang.String name,
int keyCode)
Creates actions category with given id, name, and key code.
|
ActionsCategory(java.lang.String id,
java.lang.String name,
int keyCode,
java.lang.String group)
Creates actions category with given id, name, and key code.
|
ActionsCategory(java.lang.String id,
java.lang.String name,
javax.swing.KeyStroke stroke)
Creates actions category with given id, name, and key stroke.
|
ActionsCategory(java.lang.String id,
java.lang.String name,
javax.swing.KeyStroke stroke,
java.lang.String group)
Creates actions category with given id, name, key stroke and assigned
group.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(ActionsVisitor visitor)
Accepts visitor and calls visit method of visitor.
|
void |
actionPerformed(java.awt.event.ActionEvent e)
Empty implementation.
|
void |
addAction(NMAction action)
Adds the given action to the category.
|
void |
addAction(NMAction action,
int position)
Adds the given action at the specified position to the category.
|
void |
addActions(java.util.List<? extends NMAction> actions)
Adds given actions to the category.
|
static void |
breakActions(ActionsCategory category,
java.util.List<? extends NMAction> actions,
int maxCategorySize,
java.lang.String categoryName,
boolean nested)
Breaks given actions into subcategories of given category if the actions number exceeds maxCategorySize.
|
static void |
breakActions(ActionsCategory category,
java.util.List<? extends NMAction> actions,
int maxCategorySize,
java.lang.String categoryName,
boolean nested,
int innerCategorySize)
Breaks category into sub categories, but it has ability to specify inner category size separately
|
static void |
breakActions(ActionsCategory category,
java.util.List<NMAction> actions)
Breaks given actions into subcategories of given category if the actions number exceeds predefined number.
|
static void |
breakeActions(ActionsCategory category,
java.util.List<? extends NMAction> actions,
int maxCategorySize,
java.lang.String categoryName,
boolean nested)
|
java.lang.Object |
clone()
Clones the category.
|
NMAction |
getAction(java.lang.String actionID)
Find direct action with given ID
|
java.util.List<NMAction> |
getActions()
Returns the list of the owned actions.
|
java.util.List<NMAction> |
getActionsRecursively(boolean includeCategories)
Returns all simple actions (not ActionsCategory) recursively.
|
java.util.List<ActionsCategory> |
getCategories()
Gets inner action categories.
|
boolean |
isDisplayHeader() |
boolean |
isEmpty() |
boolean |
isNested()
Returns value of nested flag.
|
boolean |
isUseActionForDisable()
Returns value of nested flag.
|
void |
removeAction(NMAction action)
Removes the given action from the category.
|
void |
setActions(java.util.List<? extends NMAction> actions)
Sets the list of the new actions overriding old actions.
|
void |
setDisplayHeader(boolean displayHeader)
Display category name as header of category.
|
void |
setNested(boolean nested)
Sets new value of nested flag.
|
void |
setUseActionForDisable(boolean use) |
java.lang.Object |
shallowClone()
Clones the category.
|
int |
size()
Size of category - number of inner actions.
|
void |
sort() |
addPropertyChangeListener, addShortcut, addShotcut, addWeakPropertyChangeListener, compareTo, createMenuItem, equals, firePropertyChange, getCommandKey, getDescription, getGroup, getIcon, getID, getLargeIcon, getLargeOrSmallIcon, getMnemonicKey, getName, getPropertyChangeListeners, getShortcuts, getSmallIcon, getSmallOrLargeIcon, hashCode, isIDGenerated, removePropertyChangeListener, removeShortcut, removeWeakPropertyChangeListener, setDescription, setGroup, setLargeIcon, setMnemonicKey, setName, setShortcuts, setSmallIcon, toString, updateState
public static final java.lang.String USE_AS_SEPARATOR_IN_UI
public static final int MAX_CATEGORY_ACTIONS
public static final java.lang.String ADDED_ACTION_PROPERTY
public static final java.lang.String REMOVED_ACTION_PROPERTY
removeAction(NMAction)
,
Constant Field Valuespublic static final java.lang.String ACTIONS_PROPERTY
setActions(List)
,
Constant Field Values@Deprecated public static final java.lang.String CHANGE_ACTIONS_PROPERTY
ACTIONS_PROPERTY
, ADDED_ACTION_PROPERTY
, REMOVED_ACTION_PROPERTY
public ActionsCategory(@CheckForNull java.lang.String id, @CheckForNull java.lang.String name)
id
- the id of the category.name
- the name of the category.public ActionsCategory(@CheckForNull java.lang.String id, @CheckForNull java.lang.String name, @CheckForNull javax.swing.KeyStroke stroke)
id
- the id of the category.name
- the name of the category.stroke
- key stroke used for invoking action category.public ActionsCategory(@CheckForNull java.lang.String id, @CheckForNull java.lang.String name, @CheckForNull javax.swing.KeyStroke stroke, @CheckForNull java.lang.String group)
id
- the id of the category.name
- the name of the category.stroke
- key stroke used for invoking action category.group
- the name of the related commands group.public ActionsCategory(@CheckForNull java.lang.String id, @CheckForNull java.lang.String name, int keyCode)
id
- the id of the category.name
- the name of the category.keyCode
- key stroke used for invoking action category.public ActionsCategory(@CheckForNull java.lang.String id, @CheckForNull java.lang.String name, int keyCode, @CheckForNull java.lang.String group)
id
- the id of the category.name
- the name of the category.keyCode
- key stroke used for invoking action category.group
- the name of the related commands group.public void addAction(@CheckForNull NMAction action)
ADDED_ACTION_PROPERTY
property change event, where new value is added action.
Fires CHANGE_ACTIONS_PROPERTY
(for backward compatibility) property change event, where old value is old actions list, new value is new actions list.public void addActions(java.util.List<? extends NMAction> actions)
ACTIONS_PROPERTY
(and CHANGE_ACTIONS_PROPERTY
for backward compatibility) property change event,
where old value is old actions list, new value is new actions list.actions
- the given actions to add, parameter can be null.public void addAction(@CheckForNull NMAction action, int position)
ADDED_ACTION_PROPERTY
property change event, where new value is added action.
Fires CHANGE_ACTIONS_PROPERTY
(for backward compatibility) property change event, where old value is old actions list, new value is new actions list.action
- the given action to add, parameter can be null.position
- the given position to be added.public void removeAction(@CheckForNull NMAction action)
REMOVED_ACTION_PROPERTY
property change event, where old value is removed action.
Fires CHANGE_ACTIONS_PROPERTY
(for backward compatibility) property change event, where old value is old actions list, new value is new actions list.removeAction
in class NMAction
action
- the given action to remove, parameter can be null.public java.util.List<NMAction> getActions()
getActions
in class NMAction
public java.util.List<ActionsCategory> getCategories()
public java.util.List<NMAction> getActionsRecursively(boolean includeCategories)
includeCategories
- If true, then ActionsCategories will be included in the listpublic void setActions(java.util.List<? extends NMAction> actions)
ACTIONS_PROPERTY
(and CHANGE_ACTIONS_PROPERTY
for backward compatibility) property change event,
where old value is old actions list, new value is new actions list.setActions
in class NMAction
actions
- the new list of the actions.public java.lang.Object clone()
public java.lang.Object shallowClone()
shallowClone
in class NMAction
public void setNested(boolean nested)
nested
- new value of nested flag.public boolean isNested()
setNested(boolean)
public void accept(ActionsVisitor visitor)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class NMAction
e
- event caused this action execution.public void setUseActionForDisable(boolean use)
use
- if true, menus created from this category will be disabled if all children are disabled.mUseActionForDisable
public boolean isUseActionForDisable()
(boolean)
public static void breakActions(ActionsCategory category, java.util.List<NMAction> actions)
category
- category to add created inner categoriesactions
- actions to break into categories@Deprecated public static void breakeActions(ActionsCategory category, java.util.List<? extends NMAction> actions, int maxCategorySize, java.lang.String categoryName, boolean nested)
public static void breakActions(ActionsCategory category, java.util.List<? extends NMAction> actions, int maxCategorySize, java.lang.String categoryName, boolean nested)
category
- category to add created inner categoriesactions
- actions to break into categoriesmaxCategorySize
- max size of inner categorycategoryName
- subcategory namenested
- make nested subcategoriespublic static void breakActions(ActionsCategory category, java.util.List<? extends NMAction> actions, int maxCategorySize, java.lang.String categoryName, boolean nested, int innerCategorySize)
category
- category to add created inner categoriesactions
- actions to break into categoriesmaxCategorySize
- max size of inner categorycategoryName
- subcategory namenested
- make nested subcategoriesinnerCategorySize
- maximum size of inner categorypublic void sort()
@CheckForNull public NMAction getAction(java.lang.String actionID)
actionID
- action IDpublic boolean isEmpty()
public boolean isDisplayHeader()
public void setDisplayHeader(boolean displayHeader)
displayHeader
- display header of not nested menupublic int size()