Java 类com.google.gwt.user.client.Window.ClosingHandler 实例源码

项目:geomajas-project-client-gwt2    文件:GwtCommandDispatcher.java   
private GwtCommandDispatcher() {
    locale = LocaleInfo.getCurrentLocale().getLocaleName();
    if ("default".equals(locale)) {
        locale = null;
    }
    deferreds = new ArrayList<Deferred>();
    service = (GeomajasServiceAsync) GWT.create(GeomajasService.class);
    setServiceEndPointUrl(GWT.getModuleBaseURL() + "geomajasService");
    setUseLazyLoading(true);
    setShowError(true);

    Window.addWindowClosingHandler(new ClosingHandler() {

        public void onWindowClosing(ClosingEvent event) {
            GwtCommandDispatcher.getInstance().setShowError(false);

            // Cancel all outstanding requests:
            for (Deferred deferred : deferreds) {
                deferred.cancel();
            }
        }
    });
}
项目:appformer    文件:LockManagerImpl.java   
private void releaseLockOnClose() {
    closeHandler = Window.addWindowClosingHandler(new ClosingHandler() {
        @Override
        public void onWindowClosing(ClosingEvent event) {
            releaseLock();
        }
    });
}
项目:qafe-platform    文件:EventFactory.java   
public static void createMenuCloseEvent(final String uuid, final WindowPanel sender) {
    sender.addWindowClosingHandler(new ClosingHandler() {
        public void onWindowClosing(ClosingEvent event) {
            if (Window.confirm("Are you sure you want to close the application and all of its windows ?")) {
                MainFactoryActions.remove(uuid);
                ComponentRepository.getInstance().removeAllItemsForWindow(uuid, null);
                // ClientApplicationContext.getInstance().closeAllWindowsForUUID(uuid);
                // return true;
            } else {
                // return false;
            }
            Window.prompt("Are you sure you want to close the application and all of its windows ?", "X");
        }
    });
}
项目:gwtinaction2    文件:BasicProject.java   
/**
 * Set up the History management for the application.
 */
public void setUpHistoryManagement(){
    // Make this class your history manager (see onValueChange method)
    History.addValueChangeHandler(this);
    // Handle any existing history token
    History.fireCurrentHistoryState();
    // Trap user hitting back button too many times.
    Window.addWindowClosingHandler(new ClosingHandler(){
        public void onWindowClosing(ClosingEvent event) {
            event.setMessage("Ran out of history.  Now leaving application, is that OK?");
        }
    });
}
项目:phenotype-portal    文件:Htp.java   
/**
 * Display a confirmation dialog to leave our site when the user refreshes
 * or goes to another URL.
 */
protected void initWindowClosingConfirmationDialog() {
    Window.addWindowClosingHandler(new ClosingHandler() {
        @Override
        public void onWindowClosing(ClosingEvent event) {
            // This message doesn't show, but by adding this close handler,
            // we get the default dialog to display and confirm that the
            // user does want to leave our site.
            event.setMessage("Are you sure you want to leave?");
        }
    });
}