info.magnolia.ui.api.location
Class LocationChangeRequestedEvent

java.lang.Object
  extended by info.magnolia.ui.api.location.LocationChangeRequestedEvent
All Implemented Interfaces:
info.magnolia.event.Event<LocationChangeRequestedEvent.Handler>

public class LocationChangeRequestedEvent
extends Object
implements info.magnolia.event.Event<LocationChangeRequestedEvent.Handler>

Event fired when a location change is about to happen usually in response to user interaction. Handlers can call setWarning(String) to request that the user be prompted to confirm the change.


Nested Class Summary
static interface LocationChangeRequestedEvent.Handler
          Handler interface for LocationChangeRequestedEvent.
 
Constructor Summary
LocationChangeRequestedEvent(Location newLocation)
           
 
Method Summary
 void dispatch(LocationChangeRequestedEvent.Handler handler)
           
 Location getNewLocation()
          Returns the location we may navigate to, or null on window close.
 String getWarning()
          Returns the warning message to show the user before allowing the location 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 location, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationChangeRequestedEvent

public LocationChangeRequestedEvent(Location newLocation)
Method Detail

getNewLocation

public Location getNewLocation()
Returns the location we may navigate to, or null on window close.


getWarning

public String getWarning()
Returns the warning message to show the user before allowing the location change, or null if none has been set.


setWarning

public void setWarning(String warning)
Set a message to warn the user that it might be unwise to navigate away from the current location, i.e. due to unsaved changes. If the user clicks okay to that message, navigation will proceed to the requested location.

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.


dispatch

public void dispatch(LocationChangeRequestedEvent.Handler handler)
Specified by:
dispatch in interface info.magnolia.event.Event<LocationChangeRequestedEvent.Handler>


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.