Rollups are conceptually similar to Expanders. Like expanders, rollups also allow the user to expand or collapse a region of the screen to make more room for other content. However, rather than a defining a titled, rectangular region, Rollups supports a configurable "header" component; when collapsed, only the header is visible. Additionally, rollups can be nested to create the appearance of a "tree" structure.
The first three rollups in the example below present the same content as in the Expanders example. The fourth includes an example of nested rollups:
The WTKX source for this example is as follows. Note that the "fill" style is set to true on the nested rollups - this allows the rollup content to wrap:
<Window title="Rollups" maximized="true" xmlns:wtkx="http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk"> <content> <Border styles="{padding:6}"> <content> <ScrollPane horizontalScrollBarPolicy="fill"> <view> <BoxPane orientation="vertical" styles="{fill:true, padding:{left:2, right:2}}"> <Rollup expanded="true"> <heading> <Label text="Stocks" styles="{fontBold:true, color:13}"/> </heading> <content> <wtkx:include src="stocks.wtkx"/> </content> </Rollup> <Rollup> <heading> <Label text="Weather" styles="{fontBold:true, color:13}"/> </heading> <content> <wtkx:include src="weather.wtkx"/> </content> </Rollup> <Rollup> <heading> <Label text="Calendar" styles="{fontBold:true, color:13}"/> </heading> <content> <wtkx:include src="calendar.wtkx"/> </content> </Rollup> <Rollup styles="{fill:true}"> <heading> <Label text="Nested" styles="{fontBold:true, color:13}"/> </heading> <content> <BoxPane orientation="vertical" styles="{fill:true}"> <Rollup styles="{fill:true}"> <heading> <Label text="Level 1"/> </heading> <content> <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum." styles="{wrapText:true}"/> </content> </Rollup> <Rollup styles="{fill:true}"> <heading> <Label text="Level 2"/> </heading> <content> <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum." styles="{wrapText:true}"/> </content> </Rollup> <Rollup styles="{fill:true}"> <heading> <Label text="Level 3"/> </heading> <content> <Label text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum." styles="{wrapText:true}"/> </content> </Rollup> </BoxPane> </content> </Rollup> </BoxPane> </view> </ScrollPane> </content> </Border> </content> </Window>
The Java source serves only to load and display the content defined in the WTKX:
package org.apache.pivot.tutorials.navigation; import org.apache.pivot.collections.Map; import org.apache.pivot.wtk.Application; import org.apache.pivot.wtk.DesktopApplicationContext; import org.apache.pivot.wtk.Display; import org.apache.pivot.wtk.Window; import org.apache.pivot.wtkx.WTKXSerializer; public class Rollups implements Application { private Window window = null; public void startup(Display display, Map<String, String> properties) throws Exception { WTKXSerializer wtkxSerializer = new WTKXSerializer(); window = (Window)wtkxSerializer.readObject(this, "rollups.wtkx"); window.open(display); } public boolean shutdown(boolean optional) { if (window != null) { window.close(); } return false; } public void suspend() { } public void resume() { } public static void main(String[] args) { DesktopApplicationContext.main(Rollups.class, args); } }
Next: Viewports