/** * Monitors the specified popup presenter so that we know when it * is closing. This allows us to make sure it doesn't receive * future messages. * * @param popupPresenter The {@link PresenterWidget} to monitor. */ private void monitorCloseEvent(final PresenterWidget<? extends PopupView> popupPresenter) { PopupView popupView = popupPresenter.getView(); popupView.setCloseHandler(popupPresenter::removeFromParentSlot); }
/** * Internal method called to hide a presenter. * See {@link PresenterWidget} for ways to hide a presenter. */ void internalHide() { if (!isVisible()) { return; } for (PresenterWidget<?> child : children) { child.internalHide(); } if (isPopup()) { ((PopupView) this.getView()).setCloseHandler(null); ((PopupView) this.getView()).hide(); } unregisterVisibleHandlers(); visible = false; onHide(); }
/** * Internal method called to reset a presenter. Instead of using that method, * fire a {@link ResetPresentersEvent} to perform a reset manually. */ void internalReset() { if (!isVisible()) { return; } onReset(); // use new set to prevent concurrent modification for (PresenterWidget<?> child: new HashSet<>(children)) { child.internalReset(); } if (isPopup()) { ((PopupView) getView()).show(); } }
/** * Internal method called to reveal a presenter. * See {@link PresenterWidget} and {@link Presenter} for ways to reveal a * presenter. */ @SuppressWarnings("unchecked") void internalReveal() { if (isVisible()) { return; } onReveal(); visible = true; // use new set to prevent concurrent modification for (PresenterWidget<?> child: new HashSet<>(children)) { child.internalReveal(); } if (isPopup()) { monitorCloseEvent((PresenterWidget<? extends PopupView>) this); ((PopupView) getView()).showAndReposition(); } registerVisibleHandlers(); }