|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<java.lang.Object,javax.swing.Action>
de.tkuhn.swing.actions.ActionManager
public class ActionManager
This class can be used for assistance with javax.swing.Actions
to create Actions that forward all incoming ActionEvents to one single or
multiple ActionListeners. It also can be used as a general container for
Actions and will also enable forwarding for any ForwardingAction
that is added
Action
,
ActionListener
,
ForwardingAction
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
ActionManager()
Creates a new instance of ActionManager |
|
ActionManager(java.awt.event.ActionListener listener)
Creates a new instance of ActionManager and registers the ActionListener |
Method Summary | |
---|---|
void |
addActionListener(java.awt.event.ActionListener listener)
Registers an ActionListener with this ActionManager |
void |
clear()
Removes all mapped Actions from this Manager |
javax.swing.Action |
getAction(java.lang.Object key)
Get the Action associated with the given key |
java.util.Collection<javax.swing.Action> |
getActions()
Get a Collection containing all Actions associated with this ActionManager |
javax.swing.Action |
newAction(java.lang.Object key)
Create an new Action and associate it with the given object. |
javax.swing.Action |
newAction(java.lang.String command)
Create an new Action and associate it with the given key. |
javax.swing.Action |
put(java.lang.Object key,
javax.swing.Action value)
Implementation of put(key,value) in interface
java.util>Map . |
javax.swing.Action |
putAction(javax.swing.Action action)
Allows users to put their own Action s in this
ActionManager . |
javax.swing.Action |
putAction(java.lang.Object key,
javax.swing.Action action)
Allows users to put their own Action s in this
ActionManager . |
void |
putAll(java.util.Map<?,? extends javax.swing.Action> map)
This method can be used to put all Action s in the given Map
into this |
javax.swing.Action |
remove(java.lang.Object key)
Implementation of remove() in java.util.Map |
javax.swing.Action |
removeAction(java.lang.Object key)
Remove the Action associated with the given key. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Unregister an ActionListener registered with this ActionManager |
Methods inherited from class java.util.HashMap |
---|
clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, size, values |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, values |
Constructor Detail |
---|
public ActionManager()
public ActionManager(java.awt.event.ActionListener listener)
listener
- the ActionListener to be registered with the newly created
ActionManagerMethod Detail |
---|
public void addActionListener(java.awt.event.ActionListener listener)
listener
- the ActionListener to be registered with this ActionManagerpublic void removeActionListener(java.awt.event.ActionListener listener)
listener
- the ActionListener to be unregisteredpublic javax.swing.Action newAction(java.lang.Object key)
key
- the key to create an Action for.
public javax.swing.Action newAction(java.lang.String command)
command
- the key to create an Action for.
public javax.swing.Action getAction(java.lang.Object key)
key
- the key to retrieve the Action for
public javax.swing.Action removeAction(java.lang.Object key)
key
- the key the Action is associated with
public javax.swing.Action remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.Object,javax.swing.Action>
remove
in class java.util.HashMap<java.lang.Object,javax.swing.Action>
key
- the key of the Action you want to remove.
public java.util.Collection<javax.swing.Action> getActions()
public javax.swing.Action putAction(javax.swing.Action action) throws java.lang.IllegalArgumentException
Action
s in this
ActionManager
. Caution: If an Action
fires,
that was not created by this ActionManager
listeners of this
manager are not notified of the event! The Action
to be
put will be mapped with it's command String as key.
action
- the Action
to be mapped.
java.lang.IllegalArgumentException
- if the command String of the action or the action itself is
null
public javax.swing.Action putAction(java.lang.Object key, javax.swing.Action action) throws java.lang.IllegalArgumentException
Action
s in this
ActionManager
. Caution: If an Action
fires,
that was not created by this ActionManager
listeners of this
manager are not notified of the event! The Action
to be
put will be mapped with the given key.
action
- the Action
to be mapped.key
- the key to map the Action with.
java.lang.IllegalArgumentException
- if the command String of the action is null
public javax.swing.Action put(java.lang.Object key, javax.swing.Action value) throws java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException
put(key,value)
in interface
java.util>Map
. Overrides put(key,value)
in
java.util.HashMap
to deny the putting of non
Action
objects.
put
in interface java.util.Map<java.lang.Object,javax.swing.Action>
put
in class java.util.HashMap<java.lang.Object,javax.swing.Action>
value
- an Action
to be mapped in this
ActionManager
key
- the key the Action
should be mapped with
java.lang.UnsupportedOperationException
- if the value given was not an instance of Action
java.lang.IllegalArgumentException
- if an Object other than Action
was given as
value parameter.public void putAll(java.util.Map<?,? extends javax.swing.Action> map)
Action
s in the given Map
into this Action
objects are
ignored as are any Action
s that are associated with a
null
key. Caution: If an Action
fires, that
was not created by this ActionManager
listeners of this
manager are not notified of the event!
putAll
in interface java.util.Map<java.lang.Object,javax.swing.Action>
putAll
in class java.util.HashMap<java.lang.Object,javax.swing.Action>
map
- a map containing actionspublic void clear()
clear
in interface java.util.Map<java.lang.Object,javax.swing.Action>
clear
in class java.util.HashMap<java.lang.Object,javax.swing.Action>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |