@Override protected void dispatch(CloseHandler<T> handler) { handler.onClose(this); } }
@Override protected void dispatch(CloseHandler<T> handler) { handler.onClose(this); } }
@Override protected void dispatch(CloseHandler<T> handler) { handler.onClose(this); } }
@Override public void onClose(CloseEvent<MaterialOverlay> closeEvent) { if (isEnabled()) { closeHandler.onClose(closeEvent); } } }, CloseEvent.getType());
private void notifyCloseHandlers() { WSTabCloseEvent<WSTab> evt = new WSTabCloseEvent<WSTab>(this, false); for (CloseHandler<WSTab> handler : tabCloseHandlers) { handler.onClose(evt); } }
@Override public void onClose(CloseEvent<MaterialPopupMenu> closeEvent) { if (isEnabled()) { closeHandler.onClose(closeEvent); } } }, CloseEvent.getType());
@Override public void onClose(CloseEvent<MaterialTreeItem> event) { if (isEnabled()) { handler.onClose(event); } } }, CloseEvent.getType());
@Override public Void answer(InvocationOnMock invocation) throws Throwable { // simulate is what PopupView will do in response to hide() registeredCloseHandler.onClose(mock(CloseEvent.class)); return null; } }).when(popupView).hide();
@Override public Void answer(InvocationOnMock invocation) throws Throwable { // simulate is what PopupView will do in response to hide() registeredCloseHandler.onClose(mock(CloseEvent.class)); return null; } }).when(popupView).hide();
@SuppressWarnings("unchecked") @Test public void shouldUsePlaceManagerToCloseSelfOnViewClosedCallback() throws Exception { popupActivity.onStartup(popupPlace); popupActivity.onOpen(); registeredCloseHandler.onClose(mock(CloseEvent.class)); verify(placeManager, times(1)).closePlace(popupPlace); }
@SuppressWarnings("unchecked") @Test public void shouldUsePlaceManagerToCloseSelfOnViewClosedCallback() throws Exception { popupActivity.onStartup(popupPlace); popupActivity.onOpen(); registeredCloseHandler.onClose(mock(CloseEvent.class)); verify(placeManager, times(1)).closePlace(popupPlace); }
/** * Test to ensure we don't start an infinite loop when someone clicks the "X" in the popup header. * See also the complementary test, {@link #shouldNotCallCloseOnPlaceManagerWhenCloseOperationTriggeredByPlaceManager()}. */ @SuppressWarnings("unchecked") @Test public void shouldNotCallHideOnViewWhenCloseOperationTriggeredByView() throws Exception { doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { // simulate is what PlaceManager will do in response to the close hook popupActivity.onClose(); return null; } }).when(placeManager).closePlace(popupPlace); popupActivity.onStartup(popupPlace); popupActivity.onOpen(); registeredCloseHandler.onClose(mock(CloseEvent.class)); verify(placeManager, times(1)).closePlace(popupPlace); // we shouldn't call hide() on the popup, because this sequence of events // was triggered by the fact that it was already hiding itself verify(popupView, never()).hide(); }
/** * Test to ensure we don't start an infinite loop when someone clicks the "X" in the popup header. * See also the complementary test, {@link #shouldNotCallCloseOnPlaceManagerWhenCloseOperationTriggeredByPlaceManager()}. */ @SuppressWarnings("unchecked") @Test public void shouldNotCallHideOnViewWhenCloseOperationTriggeredByView() throws Exception { doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { // simulate is what PlaceManager will do in response to the close hook popupActivity.onClose(); return null; } }).when(placeManager).closePlace(popupPlace); popupActivity.onStartup(popupPlace); popupActivity.onOpen(); registeredCloseHandler.onClose(mock(CloseEvent.class)); verify(placeManager, times(1)).closePlace(popupPlace); // we shouldn't call hide() on the popup, because this sequence of events // was triggered by the fact that it was already hiding itself verify(popupView, never()).hide(); }