Example usage for com.google.gwt.place.shared PlaceChangeRequestEvent getWarning

List of usage examples for com.google.gwt.place.shared PlaceChangeRequestEvent getWarning

Introduction

In this page you can find the example usage for com.google.gwt.place.shared PlaceChangeRequestEvent getWarning.

Prototype

public String getWarning() 

Source Link

Document

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

Usage

From source file:com.sfeir.common.gwt.client.mvp.PlaceController.java

License:Apache License

/**
 * //from w  ww.  ja v a2s .  c o  m
 * @param newPlace The new place you want to goto
 * @return null if there are no problems to go to the new Place or the message instead
 */
public String maybeGoTo(Place newPlace) {
    PlaceChangeRequestEvent willChange = new PlaceChangeRequestEvent(newPlace);
    eventBus.fireEvent(willChange);
    String warning = willChange.getWarning();
    return warning;
}

From source file:com.tasktop.c2c.server.profile.web.ui.client.place.AppPlaceController.java

License:Open Source License

private boolean maybeGoTo(Place newPlace) {
    if (goingTo != null && goingTo == newPlace) {
        return true;
    }//from w  w w  . ja v  a  2 s .c o  m

    PlaceChangeRequestEvent willChange = new PlaceChangeRequestEvent(newPlace);
    eventBus.fireEvent(willChange);
    String warning = willChange.getWarning();

    if (warning == null || delegate.confirm(warning)) {
        return true;
    } else {
        // Keep url in sync when cancled
        History.newItem(placeHistoryMapper.getToken(getWhere()), false);
        return false;
    }
}

From source file:fr.putnami.pwt.core.mvp.client.MvpController.java

License:Open Source License

@Override
public void goTo(final Place newPlace) {

    if (this.getWhere().equals(newPlace)) {
        return;// ww w .  j  a v  a2  s . com
    }

    PlaceChangeRequestEvent willChange = new PlaceChangeRequestEvent(newPlace);
    EventBus.get().fireEvent(willChange);
    String warning = willChange.getWarning();
    if (warning == null || Window.confirm(warning)) {
        this.doGo(newPlace);
    } else {
        this.goTo(this.getWhere());
    }
}