Package com.nomagic.actions
Class ActionsMenuCreator
java.lang.Object
com.nomagic.actions.ActionsMenuCreator
Class for creating GUI menu items from actions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classstatic classclassClass for handling ActionsCategory changes. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCleanupParticipant(Runnable participant) protected voidaddJMenuItem(Component item, NMAction action) Adds menu item, according to index item will be added to end when index less than 0, or to specified by index position.final voidappendMenuItems(Container container, ActionsManager manager) Appends menu items to given container.final voidappendMenuItems(JPopupMenu popup, ActionsManager manager) Appends menu items to the given pop up menu.final voidappendMenuItems(JPopupMenu popup, ActionsManager manager, boolean addSeparator) Appends menu items to given popup.protected ActionsVisitorfinal JPopupMenucreatePopupMenu(ActionsManager manager) Creates popup menu for given actions managerfinal JPopupMenucreatePopupMenu(ActionsManager manager, Supplier<JPopupMenu> factory) Creates popup menu for given actions managercom.nomagic.actions.MenuComponentFactoryReturn menu component factoryprotected voidinternalAppendMenuItems(Container container, ActionsManager manager) protected voidinternalAppendMenuItems(JPopupMenu popup, ActionsManager manager, boolean addSeparator) static booleanisSeparatorComponent(Component component) voidsetFactory(com.nomagic.actions.MenuComponentFactory factory) Set menu component factorystatic voidsetPropertiesToMenuItem(JMenuItem item, NMAction action) Sets properties to given JMenuItem from given action.voidsetUseMenuListener(boolean useMenuListener) Do we need to useMenuListeneron category? This flag should be set to true only if software is running on mac and using -Dapple.laf.useScreenMenuBar=true system property.
-
Field Details
-
HIDDEN_ALWAYS
- See Also:
-
ACTION
- See Also:
-
CATEGORY_HEADER
- See Also:
-
POPUP_HEADER_ITEM_NAME
- See Also:
-
-
Constructor Details
-
ActionsMenuCreator
public ActionsMenuCreator()
-
-
Method Details
-
createPopupMenu
Creates popup menu for given actions manager- Parameters:
manager- manager- Returns:
- popup menu
-
createPopupMenu
Creates popup menu for given actions manager- Parameters:
manager- managerfactory- new popup menu factory- Returns:
- popup menu
-
appendMenuItems
Appends menu items to the given pop up menu. Adds separator before new items if given pop up is not empty.- Parameters:
popup- where items will be appendedmanager- manager from which actions menu items will be created
-
appendMenuItems
Appends menu items to given popup.- Parameters:
popup- where items will be appendedmanager- manager from which actions menu items will be createdaddSeparator- add separator after last item in the given popup or not
-
internalAppendMenuItems
protected void internalAppendMenuItems(JPopupMenu popup, ActionsManager manager, boolean addSeparator) -
appendMenuItems
Appends menu items to given container.- Parameters:
container- container where items will be appendedmanager- manager from which actions items will be created
-
createActionsVisitor
-
internalAppendMenuItems
-
addJMenuItem
Adds menu item, according to index item will be added to end when index less than 0, or to specified by index position.- Parameters:
item- item to add.action- action
-
setPropertiesToMenuItem
Sets properties to given JMenuItem from given action.- Parameters:
item- item to set properties.action- for getting properties.
-
setUseMenuListener
public void setUseMenuListener(boolean useMenuListener) Do we need to useMenuListeneron category? This flag should be set to true only if software is running on mac and using -Dapple.laf.useScreenMenuBar=true system property.- Parameters:
useMenuListener- true if need to use.
-
getFactory
public com.nomagic.actions.MenuComponentFactory getFactory()Return menu component factory- Returns:
- factory
-
setFactory
public void setFactory(com.nomagic.actions.MenuComponentFactory factory) Set menu component factory- Parameters:
factory- factory
-
isSeparatorComponent
-
addCleanupParticipant
-