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

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

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

Window.addCloseHandler介绍

[英]Adds a CloseEvent handler.
[中]添加CloseEvent处理程序。

代码示例

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

private static void hookWindowClosing() {
 // Catch the window closing event.
 Window.addCloseHandler(new CloseHandler<Window>() {
  public void onClose(CloseEvent<Window> closeEvent) {
   detachWidgets();
  }
 });
}

代码示例来源: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: org.jboss.errai/errai-bus

public ClientMessageBusImpl() {
 setBusToInitializableState();
 managementConsole = new ManagementConsole(this);
 clientId = String.valueOf(com.google.gwt.user.client.Random.nextInt(99999)) + "-"
   + (System.currentTimeMillis() % (com.google.gwt.user.client.Random.nextInt(99999) + 1));
 IN_SERVICE_ENTRY_POINT = "in." + getClientId() + ".erraiBus";
 OUT_SERVICE_ENTRY_POINT = "out." + getClientId() + ".erraiBus";
 // when the window is closing, we want to stop the bus without causing any
 // errors (unless the server is unavailable of course) (see ERRAI-225)
 Window.addCloseHandler(new CloseHandler<Window>() {
  @Override
  public void onClose(final CloseEvent<Window> event) {
   if (state != BusState.LOCAL_ONLY) {
    stop(true);
   }
  }
 });
}

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

private static void hookWindowClosing() {
 // Catch the window closing event.
 Window.addCloseHandler(new CloseHandler<Window>() {
  public void onClose(CloseEvent<Window> closeEvent) {
   detachWidgets();
  }
 });
}

代码示例来源:origin: com.allen-sauer.gwt.log/gwt-log

/**
 * Default constructor.
 */
public WindowLogger() {
 Window.addCloseHandler(windowCloseListener);
}

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

private static void hookWindowClosing() {
 // Catch the window closing event.
 Window.addCloseHandler(new CloseHandler<Window>() {
  public void onClose(CloseEvent<Window> closeEvent) {
   detachWidgets();
  }
 });
}

代码示例来源:origin: com.googlecode.gwt-measure/gwt-measure

private void hookWindowCloseHandler() {
  Window.addCloseHandler(this);
}

代码示例来源:origin: sk.seges.acris/acris-recorder-client-core

Window.addCloseHandler(new CloseHandler<Window>() {
  @Override
  public void onClose(CloseEvent<Window> event) {

代码示例来源:origin: com.googlecode.mgwt/mgwt

protected void setupNativeBrowerOrientationHandler() {
  nativeJsFunction = setupOrientation0(this);
  Window.addCloseHandler(new CloseHandler<Window>() {
    @Override
    public void onClose(CloseEvent<Window> event) {
      destroyOrientation(nativeJsFunction);
    }
  });
}

代码示例来源:origin: dankurka/mgwt

protected void setupNativeBrowerOrientationHandler() {
  nativeJsFunction = setupOrientation0(this);
  Window.addCloseHandler(new CloseHandler<Window>() {
    @Override
    public void onClose(CloseEvent<Window> event) {
      destroyOrientation(nativeJsFunction);
    }
  });
}

代码示例来源: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: com.intendia.gwt.rxgwt/rxgwt

public static Observable<CloseEvent<Window>> windowClose() {
  return Observable.create(s -> register(s, Window.addCloseHandler(s::onNext)), uiBackpressureMode());
}

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

public static Observable<CloseEvent<Window>> windowClose() {
  return Observable.create(s -> register(s, Window.addCloseHandler(s::onNext)));
}

代码示例来源: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.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: errai/errai

public ClientMessageBusImpl() {
 setBusToInitializableState();
 managementConsole = new ManagementConsole(this);
 clientId = String.valueOf(com.google.gwt.user.client.Random.nextInt(99999)) + "-"
   + (System.currentTimeMillis() % (com.google.gwt.user.client.Random.nextInt(99999) + 1));
 IN_SERVICE_ENTRY_POINT = "in." + getClientId() + ".erraiBus";
 OUT_SERVICE_ENTRY_POINT = "out." + getClientId() + ".erraiBus";
 // when the window is closing, we want to stop the bus without causing any
 // errors (unless the server is unavailable of course) (see ERRAI-225)
 Window.addCloseHandler(new CloseHandler<Window>() {
  @Override
  public void onClose(final CloseEvent<Window> event) {
   if (state != BusState.LOCAL_ONLY) {
    stop(true);
   }
  }
 });
}

代码示例来源: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()));
 };
}

相关文章