Package org.zkoss.zk.ui.metainfo

## Class EventHandlerMap

- java.lang.Object
- - org.zkoss.zk.ui.metainfo.EventHandlerMap

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Cloneable`

      public class EventHandlerMap
      extends java.lang.Object
      implements java.lang.Cloneable, java.io.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:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `EventHandlerMap()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | 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()` |

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### EventHandlerMap

          public EventHandlerMap()

  - ### Method Detail

    - #### isEmpty

          public boolean isEmpty()

      Returns whether no event handler at all.

    - #### get

          public EventHandler get​(Component comp,
                                  java.lang.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:
        `Condition.isEffective(Component)`

    - #### getEventNames

          public 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.
      Since:
        3.0.2

    - #### getAll

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

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

      Since:
        3.0.0

    - #### add

          public void add​(java.lang.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:
        `getAll(java.lang.String)`

    - #### addAll

          public void addAll​(EventHandlerMap src)

      Adds all event handlers of the specified map to this map.

    - #### clone

          public java.lang.Object clone()

      Clones this event handler map.
      Overrides:
        `clone` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`