@Ignore("Test is not longer valid with code-splitting in the method. REFACTOR NEEDED.") @Test public void windowBroughtToFrontWhenShown_show_config() { final Window mockWindow = mock(Window.class); when(mockWindow.isVisible()).thenReturn(true); WindowConfig wc = mock(WindowConfig.class); uut.show(wc, false); verify(mockWindow).show(); verify(windowManagerMock).bringToFront(eq(mockWindow)); }
public void show(final WindowState windowState) { final WindowConfig config = getConfig(windowState); String windowId = constructWindowId(config); for (Widget w : windowManager.getWindows()) { String currentId = ((Window) w).getStateId(); if (windowId.equals(currentId)) { ((IPlantWindowInterface) w).asWindow().show(); return; } } getOrCreateWindow(config).get(new AsyncCallback<IPlantWindowInterface>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(IPlantWindowInterface window) { window.setPixelSize(windowState.getWidth(), windowState.getHeight()); window.setPagePosition(windowState.getWinLeft(), windowState.getWinTop()); if (desktopContainer != null) { window.setContainer(desktopContainer); } window.show(config, constructWindowId(config), true); if (sticky != null) { windowManager.bringToFront(sticky); } } }); }
DesktopWindowManager { public void show(final WindowState windowState) { final WindowConfig config = getConfig(windowState); String windowId = constructWindowId(config); for (Widget w : windowManager.getWindows()) { String currentId = ((Window) w).getStateId(); if (windowId.equals(currentId)) { ((IPlantWindowInterface) w).asWindow().show(); return; } } getOrCreateWindow(config).get(new AsyncCallback<IPlantWindowInterface>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(IPlantWindowInterface window) { window.setPixelSize(windowState.getWidth(), windowState.getHeight()); window.setPagePosition(windowState.getWinLeft(), windowState.getWinTop()); if (desktopContainer != null) { window.setContainer(desktopContainer); } window.show(config, constructWindowId(config), true); if (sticky != null) { windowManager.bringToFront(sticky); } } }); } }
DesktopWindowManager { public void show(final WindowState windowState) { final WindowConfig config = getConfig(windowState); String windowId = constructWindowId(config); for (Widget w : windowManager.getWindows()) { String currentId = ((Window) w).getStateId(); if (windowId.equals(currentId)) { ((IPlantWindowInterface) w).asWindow().show(); return; } } getOrCreateWindow(config).get(new AsyncCallback<IPlantWindowInterface>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(IPlantWindowInterface window) { window.setPixelSize(windowState.getWidth(), windowState.getHeight()); window.setPagePosition(windowState.getWinLeft(), windowState.getWinTop()); if (desktopContainer != null) { window.setContainer(desktopContainer); } window.show(config, constructWindowId(config), true); if (sticky != null) { windowManager.bringToFront(sticky); } } }); } @Inject  DesktopWindowManager(final WindowManager windowManager,
                         final WindowFactory windowFactory); }
DesktopWindowManager { public void show(final WindowState windowState) { final WindowConfig config = getConfig(windowState); String windowId = constructWindowId(config); for (Widget w : windowManager.getWindows()) { String currentId = ((Window) w).getStateId(); if (windowId.equals(currentId)) { ((IPlantWindowInterface) w).asWindow().show(); return; } } getOrCreateWindow(config).get(new AsyncCallback<IPlantWindowInterface>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(IPlantWindowInterface window) { window.setPixelSize(windowState.getWidth(), windowState.getHeight()); window.setPagePosition(windowState.getWinLeft(), windowState.getWinTop()); if (desktopContainer != null) { window.setContainer(desktopContainer); } window.show(config, constructWindowId(config), true); if (sticky != null) { windowManager.bringToFront(sticky); } } }); } @Inject  DesktopWindowManager(final WindowManager windowManager,
                         final WindowFactory windowFactory); void closeActiveWindow(); void show(final WindowState windowState); void show(WindowType windowType); void show(final WindowConfig config, final boolean updateExistingWindow); void stickWindowToTop(Window window); }
DesktopWindowManager { public void show(final WindowState windowState) { final WindowConfig config = getConfig(windowState); String windowId = constructWindowId(config); for (Widget w : windowManager.getWindows()) { String currentId = ((Window) w).getStateId(); if (windowId.equals(currentId)) { ((IPlantWindowInterface) w).asWindow().show(); return; } } getOrCreateWindow(config).get(new AsyncCallback<IPlantWindowInterface>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(IPlantWindowInterface window) { window.setPixelSize(windowState.getWidth(), windowState.getHeight()); window.setPagePosition(windowState.getWinLeft(), windowState.getWinTop()); if (desktopContainer != null) { window.setContainer(desktopContainer); } window.show(config, constructWindowId(config), true); if (sticky != null) { windowManager.bringToFront(sticky); } } }); } @Inject  DesktopWindowManager(final WindowManager windowManager,
                         final WindowFactory windowFactory); void closeActiveWindow(); void show(final WindowState windowState); void show(WindowType windowType); void show(final WindowConfig config, final boolean updateExistingWindow); void stickWindowToTop(Window window);  }