/** * {@inheritDoc} */ @Override protected void preparePaintComponent(final Request request) { explanationWithTimeStamp.setText("The time the page was rendered was " + (new Date()).toString()); tabset1TabClient.setContent(new ExplanatoryText( "This content was present when the page first rendered at " + (new Date()).toString())); tabset1TabServer.setContent(new ExplanatoryText( "This is the content of tab two. It should be noted that mode SERVER is deprecated.\nThis mode poses a" + " number of usability problems and should not be used.\n This content was created at " + (new Date()).toString())); tabset1TabLazy.setContent(new ExplanatoryText( "This tab content is rendered when the tab opens then remains static. Check the date stamp: " + (new Date()).toString())); tabset1TabDynamic.setContent(new ExplanatoryText( "This tab content refreshes each time it is opened. Check the date stamp: " + (new Date()).toString())); tabset1TabEager.setContent(new ExplanatoryText( "This tab content is fetched once asynchronously then remains static. Check the date stamp: " + (new Date()).toString())); }
/** * Test setContent - set non null content - to existing null content. */ @Test public void testSetContentNonNullToNull() { WComponent component = new DefaultWComponent(); WDecoratedLabel label = new WDecoratedLabel("label"); WTab tab = new WTab(component, label, WTabSet.TabMode.DYNAMIC); Assert.assertEquals("should be content as set in constructor", component, tab.getContent()); tab.setContent(null); WComponent component2 = component; tab.setContent(component2); Assert.assertEquals("should be content as set", component2, tab.getContent()); }
/** * Test setContent - set null content - to existing non null content. */ @Test public void testSetContentNullToNull() { WComponent component = new DefaultWComponent(); WDecoratedLabel label = new WDecoratedLabel("label"); WTab tab = new WTab(component, label, WTabSet.TabMode.DYNAMIC); Assert.assertEquals("should be content as set in constructor", component, tab.getContent()); tab.setContent(null); WComponent component2 = new DefaultWComponent(); tab.setContent(component2); Assert.assertEquals("should be content as set", component2, tab.getContent()); }
/** * Test setContent - set null content - to existing non null content. */ @Test public void testSetContentNullToNonNull() { WComponent component = new DefaultWComponent(); WDecoratedLabel label = new WDecoratedLabel("label"); WTab tab = new WTab(component, label, WTabSet.TabMode.DYNAMIC); Assert.assertEquals("should be content as set in constructor", component, tab.getContent()); WComponent component2 = null; tab.setContent(component2); Assert.assertEquals("should be content as set", component2, tab.getContent()); }
/** * Test setContent - set non null content - to existing non null content. */ @Test public void testSetContentNonNullToNonNull() { WComponent component = new DefaultWComponent(); WDecoratedLabel label = new WDecoratedLabel("label"); WTab tab = new WTab(component, label, WTabSet.TabMode.DYNAMIC); Assert.assertEquals("should be content as set in constructor", component, tab.getContent()); WComponent component2 = new DefaultWComponent(); tab.setContent(component2); Assert.assertEquals("should be content as set", component2, tab.getContent()); }