Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.event.shared
Class HandlerManager

    java.lang.Object
      com.google.gwt.event.shared.HandlerManager

    public class HandlerManager

extends java.lang.Object

Manager responsible for adding handlers to event sources and firing those handlers on passed in events.

Constructor Summary
`HandlerManager(java.lang.Object source)` Creates a handler manager with the given source.
`HandlerManager(java.lang.Object source, boolean fireInReverseOrder)` Creates a handler manager with the given source, specifying the order in which handlers are fired.

Method Summary
`
`<H extends EventHandler> HandlerRegistration`
` | `addHandler(GwtEvent.Type<H> type, H handler)` Adds a handle.
`void` | `fireEvent(GwtEvent<?> event)` Fires the given event to the handlers listening to the event's type.
`
`<H extends EventHandler> H`
` | `getHandler(GwtEvent.Type<H> type, int index)` Gets the handler at the given index.
`int` | `getHandlerCount(GwtEvent.Type<?> type)` Gets the number of handlers listening to the event type.
`boolean` | `isEventHandled(GwtEvent.Type<?> e)` Does this handler manager handle the given event type?
`
`<H extends EventHandler> void`
` | `removeHandler(GwtEvent.Type<H> type, H handler)` Deprecated. This method is likely to be removed along with "listener" interfaces in a future release. If you have a reason it should be retained beyond that time, please add your comments to GWT issue 3102

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HandlerManager

    public HandlerManager(java.lang.Object source)

  Creates a handler manager with the given source. Handlers will be fired in the order that they are added.

  Parameters:
    `source` - the event source

### HandlerManager

    public HandlerManager(java.lang.Object source,
                          boolean fireInReverseOrder)

  Creates a handler manager with the given source, specifying the order in which handlers are fired.

  Parameters:
    `source` - the event source
    `fireInReverseOrder` - true to fire handlers in reverse order

Method Detail

### addHandler

    public <H extends EventHandler> HandlerRegistration addHandler(GwtEvent.Type<H> type,
                                                                   H handler)

  Adds a handle.

  Type Parameters:
    `H` - The type of handler
  Parameters:
    `type` - the event type associated with this handler
    `handler` - the handler
  Returns:
    the handler registration, can be stored in order to remove the handler later

### fireEvent

    public void fireEvent(GwtEvent<?> event)

  Fires the given event to the handlers listening to the event's type. Note, any subclass should be very careful about overriding this method, as adds/removes of handlers will not be safe except within this implementation.

  Parameters:
    `event` - the event

### getHandler

    public <H extends EventHandler> H getHandler(GwtEvent.Type<H> type,
                                                 int index)

  Gets the handler at the given index.

  Type Parameters:
    `H` - the event handler type
  Parameters:
    `index` - the index
    `type` - the handler's event type
  Returns:
    the given handler

### getHandlerCount

    public int getHandlerCount(GwtEvent.Type<?> type)

  Gets the number of handlers listening to the event type.

  Parameters:
    `type` - the event type
  Returns:
    the number of registered handlers

### isEventHandled

    public boolean isEventHandled(GwtEvent.Type<?> e)

  Does this handler manager handle the given event type?

  Parameters:
    `e` - the event type
  Returns:
    whether the given event type is handled

### removeHandler

    @Deprecated
    public <H extends EventHandler> void removeHandler(GwtEvent.Type<H> type,
                                                                  H handler)

  Deprecated. This method is likely to be removed along with "listener" interfaces in a future release. If you have a reason it should be retained beyond that time, please add your comments to GWT issue 3102

  Removes the given handler from the specified event type. Normally, applications should call `HandlerRegistration.removeHandler()` instead.

  Type Parameters:
    `H` - handler type
  Parameters:
    `type` - the event type
    `handler` - the handler

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD