Cmobilecom AF 5.19 Developer Guide

24.1 ContainerBean Configuration

A page is backed by a container bean whose page content is composed of regions, and each region is composed of one or more backing beans. Backing beans are interactive objects such as menu beans, entity beans, or entity list beans.

Page content, regions and layout are configured in ${cmobilecom.home}/conf/containers.xml. For example,


<?xml version="1.0" encoding="UTF-8"?>
<containers>
	<container name="indexCntrBean">
		<regions>
			<region number="0">pageHeaderMenu</region>
			<region number="1">containerMenu</region>
			<region number="5">queryForm</region>
			<region number="7,6">queryResults</region>
		</regions>

		<pageLayout>
			<unit position="north">
				<content><![CDATA[
					#{facet_logo}#{region_0}#{region_1}
					]]>
				</content>				
			</unit>
			
			<unit position="center">
				<content>#{OBJECT:page}</content>			
			</unit>			
		</pageLayout>		
	</container>
	
	<container name="manageCntrBean">
		<regions>
			<region number="0">pageHeaderMenu</region>
			<region number="1">containerMenu</region>
			<region number="2">toolbarMenu</region>	
			<region number="5">queryForm</region>	
			<region number="7,6">queryResults</region>
		</regions>
		
		<!-- menu style: ACCORDION_TREE, TREE, MENU_BAR, TIERED_MENU -->
		<!-- pageHeaderMenu default menuStyle: MENU_BAR -->
		<viewConfig name="pageHeaderMenu">
			<viewType>MENU</viewType>
			<menuStyle>TIERED_MENU</menuStyle>
			<overlay/>
		</viewConfig>
				
		<!-- containerMenu default menuStyle: ACCORDION_TREE -->
		<viewConfig name="containerMenu">
			<viewType>MENU</viewType>
			<menuStyle>ACCORDION_TREE</menuStyle>
			<accordionView>
				<multiple>false</multiple>
			</accordionView>
		</viewConfig>
				
		<pageLayout>
			<unit position="north">
				<!-- content: support expressions for regions and facets -->
				<content><![CDATA[
					<div>#{facet_logo}#{facet_title}#{region_0}</div>#{region_2}
					]]>
				</content>				
			</unit>
			
			<unit position="west">
				<content>#{region_1}</content>
			</unit>

			<unit position="west">
				<content>#{OBJECT:Page}</content>
			</unit>

			<unit position="east">
				<content>#{region_5}#{region_6}</content>			
			</unit>
		</pageLayout>
	</container>
	
</containers>
In the example above, container beans named "indexCntrBean" and "manageCntrBean" are configured for pages index.xhtml and manage.xhtml respectively. Backing beans can be added into any regions of a container bean, but their region numbers must be contained in the page layout in order to be visible. The default content for manage page consists of five regions in a border layout.

North layout unit:

West layout unit:

Center layout unit

East layout unit:

By default, non-query backing beans are shown in the region for query results. To add a bean into a specified region:

   PageContent pageContent = containerBean.getPageContent();
   pageContent.add(bean, regionNumber);

ViewConfig

ViewConfig can be specified for pageHeaderMenu, containerMenu and toolbar to override default. see View Config for details.

Page Layout

Page layout is a border layout that can contain north, west, center, east and south layout units.

The layout code of a layout unit is a piece of HTML code that can contain expressions. Supported expressions:

Request contextPath can be used in hyperlinks such as

	<a href="#{request.contextPath}/privacyPolicy.page">Privacy Policy</a>
Only facet_logo and facet_title facets are supported by default, which shows the icon and name of current bound InstanceType by default. A website can specify a different logo.
ThemesDatabase DescriptorFrames / No Frames