Class EventHandlerMap

java.lang.Object
org.zkoss.zk.ui.metainfo.EventHandlerMap
All Implemented Interfaces:
Serializable, Cloneable

public class EventHandlerMap extends Object implements Cloneable, Serializable
A map of instances of 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.

Author:
tomyeh
See Also:
  • Constructor Details

    • EventHandlerMap

      public EventHandlerMap()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns whether no event handler at all.
    • get

      public EventHandler get(Component comp, String evtnm)
      Returns the first effective event handler of the specified event name, or null if not available.

      It checks whether an event handler is effective by calling Condition.isEffective(Component).

      Parameters:
      comp - the component used to evaluate whether an event handler is effective.
      Since:
      3.0.0
      See Also:
    • getEventNames

      public Set<String> getEventNames()
      Returns a readonly collection of event names (String), or an empty collection if no event name is registered.
      Since:
      3.0.2
    • getAll

      public List<EventHandler> getAll(String evtnm)
      Returns a readonly list of all event handlers associated with the specified event name, or null if no handler is associated with.

      Unlike get(Component,String), it returns all event handlers no matter whether they are effective.

      Since:
      3.0.0
    • add

      public void add(String evtnm, EventHandler evthd)
      Adds the event handler for the specified event name.

      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).

      Since:
      3.0.0
      See Also:
    • addAll

      public void addAll(EventHandlerMap src)
      Adds all event handlers of the specified map to this map.
    • clone

      public Object clone()
      Clones this event handler map.
      Overrides:
      clone in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object