Class HandlerManager
- java.lang.Object
-
- org.pepstock.charba.client.events.HandlerManager
-
- Direct Known Subclasses:
AbstractChart
public abstract class HandlerManager extends Object
Manager to add, remove event handlers and firing events to registered handlers.
This is currently implemented by all charts.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
HandlerManager()
Creates an empty handler manager
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description HandlerRegistration
addHandler(EventHandler handler, EventType type)
Adds a event handler.void
fireEvent(Event event)
Fires the event to the handlers.int
getHandlerCount(EventType type)
Returns the amount of handlers for a specific event type.protected abstract IsChart
getSource()
Returns a chart instance as source for all events.boolean
isEventHandled(EventType type)
Returnstrue
if there is any event handler for event type passed as argument.
-
-
-
Method Detail
-
getSource
protected abstract IsChart getSource()
Returns a chart instance as source for all events.- Returns:
- a chart instance as source for all events
-
addHandler
public HandlerRegistration addHandler(EventHandler handler, EventType type)
Adds a event handler.- Parameters:
handler
- handler instance to addtype
- the event type associated with handler- Returns:
- the handler registration in order to remove the handler later
-
fireEvent
public void fireEvent(Event event)
Fires the event to the handlers.- Parameters:
event
- the event to fire
-
getHandlerCount
public final int getHandlerCount(EventType type)
Returns the amount of handlers for a specific event type.- Parameters:
type
- event type to use to get the amount of handlers- Returns:
- the amount of handlers for a specific event type
-
isEventHandled
public final boolean isEventHandled(EventType type)
Returnstrue
if there is any event handler for event type passed as argument.- Parameters:
type
- event type to check- Returns:
true
if there is any event handler for event type passed as argument
-
-