/** * Creates a new Window containing the specified content. * * @param content the window content. */ public WWindow(final WComponent content) { this(); setContent(content); }
/** * Creates a MyApp. */ private MyApp() { add(appContent); add(window); window.setContent(new WLabel("test")); } }
window.setContent(content); window.setWidth(width); window.setHeight(height);
@Test public void testSetContent() { final WComponent content1 = new WTextField(); final WComponent content2 = new WTextField(); WWindow window = new WWindow(); window.setContent(content1); Assert.assertSame("Incorrect content returned", content1, window.getContent()); WComponent parentWindow = WebUtilities.getAncestorOfClass(WWindow.class, content1); Assert.assertSame("Content's parent window is incorrect", window, parentWindow); window.setContent(new WLabel()); window = new WWindow(content1); Assert.assertSame("Incorrect content returned", content1, window.getContent()); parentWindow = WebUtilities.getAncestorOfClass(WWindow.class, content1); Assert.assertSame("Content's parent window is incorrect", window, parentWindow); window.setContent(content2); Assert.assertSame("Incorrect content returned", content2, window.getContent()); Assert.assertNull("Old content's parent should be null", content1.getParent()); parentWindow = WebUtilities.getAncestorOfClass(WWindow.class, content2); Assert.assertSame("Content's parent window is incorrect", window, parentWindow); }
window.setContent(new MockLabel("dummy")); app.add(window); WContent content = new WContent();