|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.event.shared.GwtEvent<H>
org.eesgmbh.gimv.client.event.FilteredDispatchGwtEvent<H>
H - handler typepublic abstract class FilteredDispatchGwtEvent<H extends EventHandler>
Subclasses can optionally specify EventHandler instances, that should not be invoked when an event
is dispatched, although these handlers are registered in the HandlerManager class for the particular event.
Usage: subclasss override onDispatch(EventHandler) instead of dispatch(EventHandler), which is final in this class.
Usually a subclass constructor specifies only a single EventHandler. If no handler is specified no filter will be applied and the event will
be dispatched to all handlers. A handler will be identified by its equals method.
Purpose: Gimv applications usually have only a single HandlerManager / event bus. In certain modules e.g. in the presenter
CalendarPresenter it is necessary to fire the very same event the presenter is listening to. Without any filtering this will
eventually lead to the presenter invoking its own event handling method by firing the respective event. This might not break anything but it
is nevertheless a kind of behavior that ist hard to debug and error prone.
Limitation: this will only work if the event handlers which must not be called are known/accessible during event construction. On the other hand the object firing the event in Gimv is usually also the one which must not be notified of the very same event.
The filtering mechanism can't be accomplished using the GwtEvent.getSource() as this field
can only be set by the HandlerManager. As there is only a single HandlerManager (an application event bus) with a single source,
event sources cannot differ in a GwtEvent in an application that uses only one event bus.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.gwt.event.shared.GwtEvent |
|---|
GwtEvent.Type<H> |
| Constructor Summary | |
|---|---|
protected |
FilteredDispatchGwtEvent(H... blockedHandlers)
Constructor. |
| Method Summary | |
|---|---|
protected void |
dispatch(H handler)
|
protected List<H> |
getBlockedHandlers()
|
protected boolean |
isBlockedHandler(H handler)
|
protected abstract void |
onDispatch(H handler)
Invoked when a handler is contained in the blockedHandlers list |
| Methods inherited from class com.google.gwt.event.shared.GwtEvent |
|---|
assertLive, getAssociatedType, getSource, isLive, kill, revive, toDebugString, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected FilteredDispatchGwtEvent(H... blockedHandlers)
blockedHandlers - Any number (0-n) of EventHandler instances that should no be invoked. An element must not null.| Method Detail |
|---|
protected final void dispatch(H handler)
dispatch in class GwtEvent<H extends EventHandler>protected abstract void onDispatch(H handler)
handler - protected boolean isBlockedHandler(H handler)
protected List<H> getBlockedHandlers()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||