Cmobilecom AF 5.19 Developer Guide

21.9 Embedded Objects - Exec

To execute one or more command after an embedded object is created and before added to a region, add one or more

	<exec action="menuNode-command-or-id" />
under the <object> element.

The action attribute value is the command name or id of a menu node. For example, cmd.Search, id.DoSomething.

Note that the menu node must exist in the header menu or footer menu of an EntityBackingBean or EntityListBackingBean. Otherwise, the action will be ignored with a warning message.

For example, embed a query bean in region 8, and show query results in region 9 at the same time.


	<object xmlns="http://www.cmobilecom.com/af/objects"
			id="queryEmployees" type="entity" region="8">
		<entityType>HR.EMP</entityType>
		<viewConfig>
			<viewType>QUERY</viewType>

			<viewConfig name="footerMenu" >
				<viewType>MENU</viewType>
				<menuStyle>MENU_BAR</menuStyle>
				<menuNode key="cmd.Search">
					<partialBehaviorSupport>
						<partialBehavior event="action">
							<renderRegions>9</renderRegions>
							<openDialog>false</openDialog>
						</partialBehavior>
					</partialBehaviorSupport>
				</menuNode>
			</viewConfig>
		</viewConfig>

		<exec action="cmd.Search"/>
	</object>

	<object xmlns="http://www.cmobilecom.com/af/objects"
			id="employees" type="placeholder" region="9">
	</object>
To hide the query bean and show its query results only in the same region, add

	<hidden>true</hidden>
under the <object> element.

	<object xmlns="http://www.cmobilecom.com/af/objects"
			id="queryEmployees" type="entity" region="8">
		<entityType>HR.EMP</entityType>
		<viewConfig>
			<viewType>QUERY</viewType>

			<viewConfig name="footerMenu" >
				<viewType>MENU</viewType>
				<menuStyle>MENU_BAR</menuStyle>
				<menuNode key="cmd.Search">
					<partialBehaviorSupport>
						<partialBehavior event="action">
							<renderRegions>8</renderRegions>
							<openDialog>false</openDialog>
						</partialBehavior>
					</partialBehaviorSupport>
				</menuNode>
			</viewConfig>
		</viewConfig>

		<exec action="cmd.Search"/>
		<hidden>true</hidden>
	</object>
The query bean can be opened from the query results to narrow search or change query criteria.

Another example: show Expense Report in region 8, group by employee and set chart width to be 400px.


	<object xmlns="http://www.cmobilecom.com/af/objects"
			id="expenseReport" type="entity" region="8">
		<entityType>HR.ER</entityType>

		<criteriaElements>
			<function name="EQ" property="groupBy">0</function>
			<function name="EQ" property="chartWidth">400px</function>
		</criteriaElements>

		<viewConfig>
			<viewType>QUERY</viewType>

			<viewConfig name="footerMenu" >
				<viewType>MENU</viewType>
				<menuStyle>MENU_BAR</menuStyle>
				<menuNode key="cmd.View">
					<partialBehaviorSupport>
						<partialBehavior event="action">
							<renderRegions>8</renderRegions>
							<openDialog>false</openDialog>
						</partialBehavior>
					</partialBehaviorSupport>
				</menuNode>
			</viewConfig>
		</viewConfig>

		<exec action="cmd.View"/>
		<hidden>true</hidden>
	</object>
DataType HR.ER is mapped to ExpenseReportQueryForm. Create the query form bean and then execute the View command to generate the report in the same region 8. The query form bean is hidden, which can be opened from report bean to change report data and display options.
Embedded Objects: Partial Behavior SupportEmbedded Objects: LoginFrames / No Frames