Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Each region within the layout can have a different type, where the type determines how the content added to the region is displayed, tab is the default if not set and the available types are:

Type

Description

tab

Multiple views can be added to the region with tabs being added to the region to allow the user to switch between the contained content

accordion

Multiple views can be added to the region with collapsible labels added to the region to allow the user to switch between the contained content

fit

One view can be added to the regions and the view will be sized to take up the entire available area

border

No views can be added to the region, instead the region is given its own layout and views are added to that layout

...

One thing to remember is that every layout always must have a center region and this center region will fill up the space remaining from the other regions in the layout.

So the first thing is you need to do is set the type to border for the region you want to split, then the split has the same options as the main layout tag (i.e. it now has a center, north, south, west and east regions)

So if we have the following layout

Code Block
xml
xml
linenumberstruexml

<layout>
	<center type="tab"/>
	<west width="300" type="tab"/>
</layout>

which looks like the first

Info

Note that we didn't provide any width or height information for the center region above but we did for the west region, this is because the size of the center region is always determined automatically based on the size of the east, west, north and south regions is shares its layout with.

So you should always set a width for east and west, and a height for north and south regions.

The next thing we do is to change the west type to border (which is temporarily invalid, because a border type always needs the layout content)

Code Block
xml
xml
linenumberstruexml

<layout>
	<center type="tab"/>
	<west width="300" type="border"/>
</layout>

So the next thing we have to do is set the layout content for the west region

Code Block
xml
xml
linenumberstruexml

<layout>
	<center type="tab"/>
	<west width="300" type="border">
		<layout>
			<center type="tab"/>
			<south type="fit" height="200"/>
		</layout>
	</west>
</layout>

...

From here we could name the regions so later on we can refer to them using easy to remember names (plus we can change our layout without having to make sure we change the locations for any views that we've added to the region)

Code Block
xml
xml
linenumberstruexml

<layout>
	<center name="map" type="tab"/>
	<west width="300" type="border">
		<layout>
			<center name="toc" type="tab"/>
			<south name="logo" type="fit" height="200"/>
		</layout>
	</west>
</layout>

...

This can be applied recursively and to each of the five regions available in a layout

Code Block
xml
xml
linenumberstruexml

<layout>
	<center type="border">
		<layout>
			<center type="tab"/>
			<west type="fit" width="100"/>
		</layout>
	</center>
	<west width="300" type="border">
		<layout>
			<center type="tab"/>
			<south type="fit" height="100"/>
		</layout>
	</west>
	<south type="tab" height="200"/>
	<east width="400" type="border">
		<layout>
			<center type="border">
				<layout>
					<east type="fit" width="100"/>
					<center type="tab"/>
				</layout>
			</center>
			<north type="fit" height="200"/>
		</layout>
	</east>
</layout>

...

Also, you should set a default height for north and south regions and a default width for east and west.
Further for north, south, east and west a minSize and maxSize should be provided if you set split to true. If split is false or not set then the region can't be resized.
You can also set collapsible to true to allow for easy collapsing of the region

Code Block
xml
xml
linenumberstruexml

<layout>
	<center name="map" type="tab"/>
	<west width="300" type="border" split="true" minSize="100" maxSize="500" collapsible="true">
		<layout>
			<center name="toc" type="tab"/>
			<south name="logo" type="fit" height="200"/>
		</layout>
	</west>
</layout>

And then finally you can add a toolbar and statusbar to each layout

Code Block
xml
xml
linenumberstruexml

<layout>
	<center name="map" type="tab"/>
	<west width="300" type="border" collapsible="true">
		<layout>
			<toolbar>
				<item action="..."/>
			</toolbar>
			<center name="toc" type="tab"/>
			<south name="logo" type="fit" height="200"/>
		</layout>
	</west>
	<statusbar>
		<item component="..."/>
	</statusbar>
</layout>

...