com.google.gwt.user.client.Window.addWindowClosingHandler()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中com.google.gwt.user.client.Window.addWindowClosingHandler()方法的一些代码示例,展示了Window.addWindowClosingHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.addWindowClosingHandler()方法的具体详情如下:
包路径:com.google.gwt.user.client.Window
类名称:Window
方法名:addWindowClosingHandler

Window.addWindowClosingHandler介绍

[英]Adds a Window.ClosingEvent handler.
[中]添加一个窗口。关闭事件处理程序。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

public HandlerRegistration addWindowClosingHandler(ClosingHandler handler) {
 return Window.addWindowClosingHandler(handler);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Deprecated
public static void add(WindowCloseListener listener) {
 WrapWindowClose handler = new WrapWindowClose(listener);
 Window.addWindowClosingHandler(handler);
 Window.addCloseHandler(handler);
}

代码示例来源:origin: kiegroup/appformer

private void releaseLockOnClose() {
  closeHandler = Window.addWindowClosingHandler(new ClosingHandler() {
    @Override
    public void onWindowClosing(ClosingEvent event) {
      releaseLock();
    }
  });
}

代码示例来源:origin: net.wetheinter/gwt-user

public HandlerRegistration addWindowClosingHandler(ClosingHandler handler) {
 return Window.addWindowClosingHandler(handler);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

public HandlerRegistration addWindowClosingHandler(ClosingHandler handler) {
 return Window.addWindowClosingHandler(handler);
}

代码示例来源:origin: ArcBees/GWTP

@Override
public void setOnLeaveConfirmation(String question) {
  if (question == null && onLeaveQuestion == null) {
    return;
  }
  if (question != null && onLeaveQuestion == null) {
    windowClosingHandlerRegistration = Window.addWindowClosingHandler(this);
  }
  if (question == null) {
    windowClosingHandlerRegistration.removeHandler();
  }
  onLeaveQuestion = question;
}

代码示例来源:origin: EmiteGWT/emite

@Inject
protected AutoConfigBoot(final XmppConnection connection, final XmppSession session) {
  this.connection = checkNotNull(connection);
  this.session = checkNotNull(session);
  Scheduler.get().scheduleDeferred(this);
  Window.addWindowClosingHandler(this);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Deprecated
public static void add(WindowCloseListener listener) {
 WrapWindowClose handler = new WrapWindowClose(listener);
 Window.addWindowClosingHandler(handler);
 Window.addCloseHandler(handler);
}

代码示例来源:origin: net.wetheinter/gwt-user

@Deprecated
public static void add(WindowCloseListener listener) {
 WrapWindowClose handler = new WrapWindowClose(listener);
 Window.addWindowClosingHandler(handler);
 Window.addCloseHandler(handler);
}

代码示例来源:origin: oVirt/ovirt-engine

/**
   * Ensures that a window closing warning is present when uploads are in progress.
   */
  private void setWindowClosingHandler() {
    Window.addWindowClosingHandler(event -> {
      boolean isAnyPolling = uploadImageHandlers.stream().anyMatch(
          UploadImageHandler::isContinuePolling);

      if (isAnyPolling) {
        // If the window is closed, uploads will time out and pause
        event.setMessage(constants.uploadImageLeaveWindowPopupWarning());
      }
    });
  }
}

代码示例来源:origin: com.intendia.gwt.rxgwt/rxgwt

public static Observable<Window.ClosingEvent> windowClosing() {
  return Observable.create(s -> register(s, Window.addWindowClosingHandler(s::onNext)), uiBackpressureMode());
}

代码示例来源:origin: intendia-oss/rxgwt

public static Observable<Window.ClosingEvent> windowClosing() {
  return Observable.create(s -> register(s, Window.addWindowClosingHandler(s::onNext)));
}

代码示例来源:origin: org.eagle-i/eagle-i-search-gwt

protected SearchApplicationContext(final SearchUIConfig uiConfig) {
  this.uiConfig = uiConfig;
  History.addValueChangeHandler( this );
  SessionContext.INSTANCE.addListener( this );
  Window.addWindowClosingHandler( new ClosingHandler() {
    
    @Override
    public void onWindowClosing(ClosingEvent event) {
      // store the current page params for the results page if they exist
      // as a cookie in case this is a refresh
      final String existingCookie = Cookies.getCookie( PAGE_PARAMS_COOKIE );
      // remove the existing cookie if it exists
      if ( existingCookie != null ) {
        Cookies.removeCookie( PAGE_PARAMS_COOKIE );
      }
      
      if ( currentResultsPageParams != null ) {
        // Set the expire date for 10 minutes from now
        final Date expires = new Date( ( new Date() ).getTime() + PAGE_REFRESH_EXPIRES );
        Cookies.setCookie( PAGE_PARAMS_COOKIE,
            currentResultsPageParams, expires );
      }
    }
  });
}

代码示例来源:origin: com.vaadin.external.atmosphere/atmosphere-gwt-client

@Override
  public void execute() {
    if (!running) {
      running = true;
      if (unloadHandlerReg != null) {
        unloadHandlerReg.removeHandler();
      }
      UnloadHandler handler = new UnloadHandler();
      final HandlerRegistration reg1 = Window.addCloseHandler(handler);
      final HandlerRegistration reg2 = Window.addWindowClosingHandler(handler);
      unloadHandlerReg = new HandlerRegistration() {
        @Override
        public void removeHandler() {
          reg1.removeHandler();
          reg2.removeHandler();
        }
      };
      doConnect();
    }
  }
});

代码示例来源:origin: org.geomajas/geomajas-client-common-gwt-command

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();
      }
    }
  });
}

代码示例来源:origin: org.atmosphere/atmosphere-gwt-client

@Override
  public void execute() {
    if (!running) {
      running = true;
      if (unloadHandlerReg != null) {
        unloadHandlerReg.removeHandler();
      }
      UnloadHandler handler = new UnloadHandler();
      final HandlerRegistration reg1 = Window.addCloseHandler(handler);
      final HandlerRegistration reg2 = Window.addWindowClosingHandler(handler);
      unloadHandlerReg = new HandlerRegistration() {
        @Override
        public void removeHandler() {
          reg1.removeHandler();
          reg2.removeHandler();
        }
      };
      doConnect();
    }
  }
});

代码示例来源:origin: bedatadriven/activityinfo

@Inject
public NavigationHandler(final EventBus eventBus, final @Root Frame root) {
  this.eventBus = eventBus;
  this.root = root;
  eventBus.addListener(NAVIGATION_REQUESTED,
      new Listener<NavigationEvent>() {
        @Override
        public void handleEvent(NavigationEvent be) {
          onNavigationRequested(be);
        }
      });
  Log.debug("PageManager: connected to EventBus and listening.");
  if(GWT.isClient()) {
    Window.addWindowClosingHandler(new Window.ClosingHandler() {
      @Override
      public void onWindowClosing(Window.ClosingEvent event) {
        if (activeNavigation != null && activeNavigation.currentPage != null) {
          event.setMessage(activeNavigation.currentPage.beforeWindowCloses());
        }
      }
    });
  }
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

private Operation<Void> showUI() {
 return aVoid -> {
  standardComponentsInitializerProvider.get().initialize();
  showRootPresenter();
  // Bind browser's window events
  Window.addWindowClosingHandler(event -> eventBus.fireEvent(createWindowClosingEvent(event)));
  Window.addCloseHandler(event -> eventBus.fireEvent(createWindowClosedEvent()));
 };
}

代码示例来源:origin: com.vaadin.external.atmosphere/atmosphere-gwt-extra

com.google.gwt.user.client.Window.addWindowClosingHandler(new ClosingHandler() {
  @Override
  public void onWindowClosing(ClosingEvent event) {

代码示例来源:origin: kiegroup/appformer

Window.addWindowClosingHandler(new ClosingHandler() {

相关文章