/** * Request a change to a new place. It is not a given that we'll actually get * there. First a {@link PlaceChangeRequestEvent} will be posted to the event * bus. If any receivers post a warning message to that event, it will be * presented to the user via {@link Delegate#confirm(String)} (which is * typically a call to {@link Window#confirm(String)}). If she cancels, the * current location will not change. Otherwise, the location changes and a * {@link PlaceChangeEvent} is posted announcing the new place. * * @param newPlace a {@link Place} instance */ public void goTo(Place newPlace) { log().fine("goTo: " + newPlace); if (getWhere().equals(newPlace)) { log().fine("Asked to return to the same place: " + newPlace); return; } String warning = maybeGoTo(newPlace); if (warning == null || delegate.confirm(warning)) { where = newPlace; eventBus.fireEvent(new PlaceChangeEvent(newPlace)); } }
/** * Request a change to a new place. It is not a given that we'll actually get * there. First a {@link PlaceChangeRequestEvent} will be posted to the event * bus. If any receivers post a warning message to that event, it will be * presented to the user via {@link Delegate#confirm(String)} (which is * typically a call to {@link Window#confirm(String)}). If she cancels, the * current location will not change. Otherwise, the location changes and a * {@link PlaceChangeEvent} is posted announcing the new place. * * @param newPlace a {@link Place} instance */ public void goTo(Place newPlace) { log().fine("goTo: " + newPlace); if (getWhere().equals(newPlace)) { log().fine("Asked to return to the same place: " + newPlace); return; } String warning = maybeGoTo(newPlace); if (warning == null || delegate.confirm(warning)) { where = newPlace; eventBus.fireEvent(new PlaceChangeEvent(newPlace)); } }
/** * Request a change to a new place. It is not a given that we'll actually get * there. First a {@link PlaceChangeRequestEvent} will be posted to the event * bus. If any receivers post a warning message to that event, it will be * presented to the user via {@link Delegate#confirm(String)} (which is * typically a call to {@link Window#confirm(String)}). If she cancels, the * current location will not change. Otherwise, the location changes and a * {@link PlaceChangeEvent} is posted announcing the new place. * * @param newPlace a {@link Place} instance */ public void goTo(Place newPlace) { log().fine("goTo: " + newPlace); if (getWhere().equals(newPlace)) { log().fine("Asked to return to the same place: " + newPlace); return; } String warning = maybeGoTo(newPlace); if (warning == null || delegate.confirm(warning)) { where = newPlace; eventBus.fireEvent(new PlaceChangeEvent(newPlace)); } }
/** * Create a new PlaceController. * * @param eventBus the {@link EventBus} * @param delegate the {@link Delegate} in charge of Window-related events */ public PlaceController(EventBus eventBus, Delegate delegate) { this.eventBus = eventBus; this.delegate = delegate; delegate.addWindowClosingHandler(new ClosingHandler() { public void onWindowClosing(ClosingEvent event) { String warning = maybeGoTo(Place.NOWHERE); if (warning != null) { event.setMessage(warning); } } }); }
/** * Create a new PlaceController. * * @param eventBus the {@link EventBus} * @param delegate the {@link Delegate} in charge of Window-related events */ public PlaceController(EventBus eventBus, Delegate delegate) { this.eventBus = eventBus; this.delegate = delegate; delegate.addWindowClosingHandler(new ClosingHandler() { public void onWindowClosing(ClosingEvent event) { String warning = maybeGoTo(Place.NOWHERE); if (warning != null) { event.setMessage(warning); } } }); }
/** * Create a new PlaceController. * * @param eventBus the {@link EventBus} * @param delegate the {@link Delegate} in charge of Window-related events */ public PlaceController(EventBus eventBus, Delegate delegate) { this.eventBus = eventBus; this.delegate = delegate; delegate.addWindowClosingHandler(new ClosingHandler() { public void onWindowClosing(ClosingEvent event) { String warning = maybeGoTo(Place.NOWHERE); if (warning != null) { event.setMessage(warning); } } }); }