public class Dispatcher extends Object
CancellableEvent.setCancelled(boolean)
.DispatcherListener
Modifier and Type | Field and Description |
---|---|
static GwtEvent.Type<DispatcherListener> |
AfterDispatch
Fires after an event has been dispatched.
|
static GwtEvent.Type<DispatcherListener> |
BeforeDispatch
Fires before an event is dispatched.
|
Modifier and Type | Method and Description |
---|---|
void |
addController(Controller controller)
Adds a controller.
|
void |
addDispatcherListener(DispatcherListener listener)
Adds a listener to receive dispatch events.
|
void |
dispatch(AppEvent event)
The dispatcher will query its controllers and pass the application event to
any controllers that can handle the particular event type.
|
void |
dispatch(GwtEvent.Type<?> type)
The dispatcher will query its controllers and pass the application event to
controllers that can handle the particular event type.
|
void |
dispatch(GwtEvent.Type<?> type,
Object data)
The dispatcher will query its controllers and pass the application event to
controllers that can handle the particular event type.
|
static void |
forwardEvent(AppEvent event)
Forwards an application event to the dispatcher.
|
static void |
forwardEvent(GwtEvent.Type<?> eventType)
Creates and forwards an application event to the dispatcher.
|
static void |
forwardEvent(GwtEvent.Type<?> eventType,
Object data)
Creates and forwards an application event to the dispatcher.
|
static void |
forwardEvent(GwtEvent.Type<?> eventType,
Object data,
boolean historyEvent)
Creates and forwards an application event to the dispatcher.
|
static Dispatcher |
get()
Returns the singleton instance.
|
List<Controller> |
getControllers()
Returns all controllers.
|
Map<String,AppEvent> |
getHistory()
Returns the dispatcher's history cache.
|
void |
removeController(Controller controller)
Removes a controller.
|
void |
removeDispatcherListener(DispatcherListener listener)
Removes a previously added listener.
|
public static final GwtEvent.Type<DispatcherListener> BeforeDispatch
public static final GwtEvent.Type<DispatcherListener> AfterDispatch
public static void forwardEvent(AppEvent event)
event
- the application eventpublic static void forwardEvent(GwtEvent.Type<?> eventType)
eventType
- the application event typepublic static void forwardEvent(GwtEvent.Type<?> eventType, Object data)
eventType
- the application event typedata
- the event datapublic static void forwardEvent(GwtEvent.Type<?> eventType, Object data, boolean historyEvent)
eventType
- the application event typedata
- the event datahistoryEvent
- true to mark event as a history eventpublic static Dispatcher get()
public void addController(Controller controller)
controller
- the controller to be addedpublic void addDispatcherListener(DispatcherListener listener)
listener
- the listener to addpublic void dispatch(AppEvent event)
event
- the application eventpublic void dispatch(GwtEvent.Type<?> type)
type
- the event typepublic void dispatch(GwtEvent.Type<?> type, Object data)
type
- the event typedata
- the app event datapublic List<Controller> getControllers()
public Map<String,AppEvent> getHistory()
public void removeController(Controller controller)
controller
- the controller to be removedpublic void removeDispatcherListener(DispatcherListener listener)
listener
- the listener to be removedCopyright © 2015. All rights reserved.