public class PlaceChangeRequestEvent extends GwtEvent<PlaceChangeRequestEvent.Handler>
setWarning(String)
request that the
user be prompted to confirm the change.Modifier and Type | Class and Description |
---|---|
static interface |
PlaceChangeRequestEvent.Handler
Implemented by handlers of PlaceChangeRequestEvent.
|
GwtEvent.Type<H>
Modifier and Type | Field and Description |
---|---|
static GwtEvent.Type<PlaceChangeRequestEvent.Handler> |
TYPE
A singleton instance of Type<Handler>.
|
Constructor and Description |
---|
PlaceChangeRequestEvent(Place newPlace)
Constructs a PlaceChangeRequestEvent for the given
Place . |
Modifier and Type | Method and Description |
---|---|
protected void |
dispatch(PlaceChangeRequestEvent.Handler handler)
Should only be called by
HandlerManager . |
GwtEvent.Type<PlaceChangeRequestEvent.Handler> |
getAssociatedType()
Returns the
Event.Type used to register this event, allowing an
EventBus to find handlers of the appropriate class. |
Place |
getNewPlace()
Returns the place we may navigate to, or null on window close.
|
java.lang.String |
getWarning()
Returns the warning message to show the user before allowing the place
change, or null if none has been set.
|
void |
setWarning(java.lang.String warning)
Set a message to warn the user that it might be unwise to navigate away
from the current place, e.g.
|
assertLive, getSource, isLive, kill, revive
setSource, toDebugString, toString
public static final GwtEvent.Type<PlaceChangeRequestEvent.Handler> TYPE
public GwtEvent.Type<PlaceChangeRequestEvent.Handler> getAssociatedType()
Event
Event.Type
used to register this event, allowing an
EventBus
to find handlers of the appropriate class.getAssociatedType
in class GwtEvent<PlaceChangeRequestEvent.Handler>
public Place getNewPlace()
Place
instancepublic java.lang.String getWarning()
setWarning(String)
public void setWarning(java.lang.String warning)
Calling with a null warning is the same as not calling the method at all -- the user will not be prompted.
Only the first non-null call to setWarning has any effect. That is, once the warning message has been set it cannot be cleared.
warning
- the warning message as a StringgetWarning()
protected void dispatch(PlaceChangeRequestEvent.Handler handler)
GwtEvent
HandlerManager
. In other words, do not use
or call.dispatch
in class GwtEvent<PlaceChangeRequestEvent.Handler>
handler
- handlerEventBus.dispatchEvent(Event, Object)