public class

PlaceChangeRequestEvent

extends GwtEvent<H extends EventHandler>
java.lang.Object
   ↳ com.google.gwt.event.shared.GwtEvent<H extends com.google.gwt.event.shared.EventHandler>
     ↳ com.google.gwt.place.shared.PlaceChangeRequestEvent

Class Overview

Event thrown when the user may go to a new place in the app, or tries to leave it. Receivers can call setWarning(String) request that the user be prompted to confirm the change.

Summary

Nested Classes
interface PlaceChangeRequestEvent.Handler Implemented by handlers of PlaceChangeRequestEvent. 
Fields
public static final Type<PlaceChangeRequestEvent.Handler> TYPE A singleton instance of Type<Handler>.
Public Constructors
PlaceChangeRequestEvent(Place newPlace)
Constructs a PlaceChangeRequestEvent for the given Place.
Public Methods
Type<PlaceChangeRequestEvent.Handler> getAssociatedType()
Returns the type used to register this event.
Place getNewPlace()
Returns the place we may navigate to, or null on window close.
String getWarning()
Returns the warning message to show the user before allowing the place change, or null if none has been set.
void setWarning(String warning)
Set a message to warn the user that it might be unwise to navigate away from the current place, e.g.
Protected Methods
void dispatch(PlaceChangeRequestEvent.Handler handler)
Should only be called by HandlerManager.
[Expand]
Inherited Methods
From class com.google.gwt.event.shared.GwtEvent
From class java.lang.Object

Fields

public static final Type<PlaceChangeRequestEvent.Handler> TYPE

A singleton instance of Type<Handler>.

Public Constructors

public PlaceChangeRequestEvent (Place newPlace)

Constructs a PlaceChangeRequestEvent for the given Place.

Parameters
newPlace a Place instance

Public Methods

public Type<PlaceChangeRequestEvent.Handler> getAssociatedType ()

Returns the type used to register this event. Used by handler manager to dispatch events to the correct handlers.

Returns
  • the type

public Place getNewPlace ()

Returns the place we may navigate to, or null on window close.

Returns

public String getWarning ()

Returns the warning message to show the user before allowing the place change, or null if none has been set.

Returns
  • the warning message as a String

public void setWarning (String warning)

Set a message to warn the user that it might be unwise to navigate away from the current place, e.g. due to unsaved changes. If the user clicks okay to that message, navigation will be canceled.

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.

Parameters
warning the warning message as a String
See Also

Protected Methods

protected void dispatch (PlaceChangeRequestEvent.Handler handler)

Should only be called by HandlerManager. In other words, do not use or call.

Parameters
handler handler