List of usage examples for com.google.gwt.user.client Window addWindowClosingHandler
public static HandlerRegistration addWindowClosingHandler(final ClosingHandler handler)
From source file:stroom.app.client.App.java
License:Apache License
/** * This is the entry point method./*from w w w . j av a2 s . c om*/ */ public void onModuleLoad() { Window.addWindowClosingHandler(event -> event.setMessage("Are you sure you want to leave Stroom?")); // This is required for Gwt-Platform proxy's generator. DelayedBindRegistry.bind(ginjector); // Register all plugins that will respond to // Start the login manager. This will attempt to auto login with PKI and // will therefore start the rest of the application. ginjector.getLoginManager().autoLogin(); // Remember how places were used in case we want to use URLs and history // at some point. // ginjector.getPlaceManager().revealCurrentPlace(); }
From source file:stroom.core.client.LocationManager.java
License:Apache License
@Inject public LocationManager() { Window.addWindowClosingHandler(event -> { if (!ignoreClose) { event.setMessage("Are you sure you want to leave Stroom?"); } else {//w w w. jav a 2 s. co m ignoreClose = false; } }); }
From source file:stroom.dashboard.client.main.DashboardAppPresenter.java
License:Apache License
@Inject public DashboardAppPresenter(final EventBus eventBus, final DashboardAppView view, final DashboardAppProxy proxy, final ClientSecurityContext securityContext, final ClientDispatchAsync dispatcher, final DashboardPresenter dashboardPresenter) { super(eventBus, view, proxy); this.securityContext = securityContext; this.dashboardPresenter = dashboardPresenter; eventBus.addHandler(CurrentUserChangedEvent.getType(), event -> { RootLayoutPanel.get().clear();/* ww w. ja v a 2 s.co m*/ RootPanel.get().clear(); final String type = Window.Location.getParameter("type"); final String uuid = Window.Location.getParameter("uuid"); params = Window.Location.getParameter("params"); if (type == null || uuid == null) { AlertEvent.fireError(this, "No dashboard uuid has been specified", null); } else { final DocRef docRef = new DocRef(type, uuid); dispatcher.execute(new EntityServiceLoadAction<>(docRef, null), new AsyncCallbackAdaptor<Dashboard>() { @Override public void onSuccess(final Dashboard dashboard) { onLoadSuccess(dashboard); } @Override public void onFailure(final Throwable throwable) { onLoadFailure(throwable); } }); } }); dashboardPresenter.addDirtyHandler(event -> { if (dashboard != null) { if (event.isDirty()) { Window.setTitle("* " + dashboard.getName()); } else { Window.setTitle(dashboard.getName()); } } }); Window.addWindowClosingHandler(event -> { if (dashboardPresenter.isDirty()) { String name = ""; if (dashboard != null) { name = "'" + dashboard.getName() + "'"; } event.setMessage("Dashboard " + name + " has unsaved changes. Are you sure you want to close it?"); } }); }
From source file:tv.dyndns.kishibe.qmaclone.client.game.SceneGame.java
License:Open Source License
@Override protected void onLoad() { super.onLoad(); updater.start();/*from www . ja v a 2 s . com*/ if (sessionData.isAddPenalty()) { handlerRegistrationCloseHandler = Window.addCloseHandler(this); handlerRegistrationClosingHandler = Window.addWindowClosingHandler(this); } }