Package com.nomagic.actions
Class ActionsMenuCreator.MutableActionListener
- java.lang.Object
-
- com.nomagic.actions.ActionsMenuCreator.MutableActionListener
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
- Enclosing class:
- ActionsMenuCreator
public class ActionsMenuCreator.MutableActionListener extends java.lang.Object implements java.beans.PropertyChangeListener
Class for handling ActionsCategory changes.
-
-
Field Summary
Fields Modifier and Type Field Description private ActionsCategory
category
ActionsCategory which changes should be handled.private java.util.WeakHashMap<NMAction,java.lang.ref.WeakReference<?>>
created
index where first menu item of mCategory should be created.private java.lang.ref.WeakReference
menuRef
Menu of current ActionsCategory.
-
Constructor Summary
Constructors Constructor Description MutableActionListener(java.awt.Container menu, ActionsCategory category, java.util.WeakHashMap<NMAction,java.lang.ref.WeakReference<?>> created)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.Object
getCreatedOfCategory()
private int
getIndexOfCategory(java.lang.Object items)
void
propertyChange(java.beans.PropertyChangeEvent e)
Handles ActionsCategory.CHANGE_ACTIONS_PROPERTY and recreates Menu items.private void
removeActions(java.util.Collection<NMAction> oldActions, java.util.WeakHashMap<NMAction,java.lang.ref.WeakReference<?>> created)
private void
removeItems(java.lang.Object items)
private void
removeMenuItems(java.util.Collection<NMAction> oldActions, java.awt.Container menu)
-
-
-
Field Detail
-
menuRef
private final java.lang.ref.WeakReference menuRef
Menu of current ActionsCategory.
-
category
private final ActionsCategory category
ActionsCategory which changes should be handled.
-
created
private java.util.WeakHashMap<NMAction,java.lang.ref.WeakReference<?>> created
index where first menu item of mCategory should be created.
-
-
Constructor Detail
-
MutableActionListener
MutableActionListener(java.awt.Container menu, ActionsCategory category, java.util.WeakHashMap<NMAction,java.lang.ref.WeakReference<?>> created)
- Parameters:
menu
- menu where new actions will be appended, old will be removed.category
- parent of actions will be removed/added.created
- a list of created items from given category
-
-
Method Detail
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Handles ActionsCategory.CHANGE_ACTIONS_PROPERTY and recreates Menu items.- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
removeMenuItems
private void removeMenuItems(java.util.Collection<NMAction> oldActions, java.awt.Container menu)
-
getCreatedOfCategory
@CheckForNull private java.lang.Object getCreatedOfCategory()
-
getIndexOfCategory
private int getIndexOfCategory(@CheckForNull java.lang.Object items)
-
removeItems
private void removeItems(java.lang.Object items)
-
-