public class EventHandlerMap
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
EventHandler
.
Note: it is not thread safe. Thus, it is better to clone()
and then modifying the cloned instance if you want to change it
concurrently.
Constructor and Description |
---|
EventHandlerMap() |
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String evtnm,
EventHandler evthd)
Adds the event handler for the specified event name.
|
void |
addAll(EventHandlerMap src)
Adds all event handlers of the specified map to this map.
|
java.lang.Object |
clone()
Clones this event handler map.
|
EventHandler |
get(Component comp,
java.lang.String evtnm)
Returns the first effective event handler of the specified event name,
or null if not available.
|
java.util.List<EventHandler> |
getAll(java.lang.String evtnm)
Returns a readonly list of all event handlers associated
with the specified event name, or null if no handler is associated
with.
|
java.util.Set<java.lang.String> |
getEventNames()
Returns a readonly collection of event names (String), or
an empty collection if no event name is registered.
|
boolean |
isEmpty()
Returns whether no event handler at all.
|
java.lang.String |
toString() |
public boolean isEmpty()
public EventHandler get(Component comp, java.lang.String evtnm)
It checks whether an event handler is effective by calling
ConditionValue.isEffective(Component)
.
comp
- the component used to evaluate whether an event handler
is effective.ConditionValue.isEffective(Component)
public java.util.Set<java.lang.String> getEventNames()
public java.util.List<EventHandler> getAll(java.lang.String evtnm)
Unlike get(Component,String)
, it returns all
event handlers no matter whether they are effective.
public void add(java.lang.String evtnm, EventHandler evthd)
Note: the new handler won't overwrite the previous one,
unless ConditionValue.getCondition()
is the same.
Rather, the new handler is appended to the list. You can retreive
list by invoking getAll(java.lang.String)
.
getAll(java.lang.String)
public void addAll(EventHandlerMap src)
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.