PWindow extends PObject { public boolean removeCloseHandler(final PCloseHandler handler) { return closeHandlers != null && closeHandlers.remove(handler); } PWindow(); protected  PWindow(final boolean relative, final String url, final String name, final String features); protected  PWindow(final PWindow parent, final boolean relative, final String url, final String name, final String features); static PWindow getMain(); void open(); void print(); void resizeBy(final float xDelta, final float yDelta); void resizeTo(final int width, final int height); void moveBy(final float deltaX, final float deltaY); void moveTo(final float x, final float y); void focus(); void reload(); void close(); void setTitle(final String title); Location getLocation(); @Override void onClientData(final JsonObject event); void addOpenHandler(final POpenHandler handler); boolean removeOpenHandler(final POpenHandler handler); void addCloseHandler(final PCloseHandler handler); boolean removeCloseHandler(final PCloseHandler handler); void add(final IsPWidget widget); void add(final String id, final IsPWidget widget); boolean isOpened(); String getUrl(); String getName(); void clear(); @Override void onDestroy(); PRootPanel getPRootPanel(); PRootPanel getPRootPanel(final String zoneID); static boolean isMain(final PWindow window); PWindow getParent(); void addVisibilityHandler(final PVisibilityHandler visibilityHandler); void removeVisibilityHandler(final PVisibilityHandler visibilityHandler); boolean isShown(); @Override String toString();  }
@Test public void testRemoveCloseHandler() { final PWindow window = Element.newPWindow(null, null); AtomicInteger handlerFiredCount = new AtomicInteger(0); PCloseHandler handler = e -> handlerFiredCount.incrementAndGet(); window.addCloseHandler(handler); assertFalse(window.isOpened()); window.removeCloseHandler(handler); window.open(); assertTrue(window.isOpened()); window.close(); assertFalse(window.isOpened()); assertEquals(0, handlerFiredCount.get()); }