<formDesign entityType="EC" id="1001" name="#{bundle.FormDesign.ExpenseClaimStandard}">
<viewConfig>
<viewConfig name="expenseClaimItems">
<viewType>ENTITY_LIST_NARROW</viewType>
<pageable>false</pageable>
</viewConfig>
</viewConfig>
<layout><![CDATA[<div class="ui-form-design">
<h1>#{bundle.ExpenseClaim}</h1>
<div class="ui-grid ui-grid-2 ui-grid-name-value">
<div>#{bundle.Id}:</div>
<div>#{nid}</div>
<div>#{bundle.Summary}:</div>
<div>#{summary}</div>
<div>#{bundle.Employee}:</div>
<div>#{employee}</div>
<div class="ui-grid-colspan-2">#{OBJECT:expenseClaimItems}</div>
<div>#{bundle.Approver}:</div>
<div>#{approver}</div>
<div>#{bundle.ApprovedDate}:</div>
<div>#{approvedDate}</div>
<div>#{bundle.Creator}:</div>
<div>#{creator}</div>
<div>#{bundle.CreatedDate}:</div>
<div>#{createdDate}</div>
</div>
</div>]]></layout>
<style><![CDATA[
.ui-form-design h1 {
text-align: center;
}
]]></style>
</formDesign>
Form bean (nested bean) viewConfig name is its property name. The list of expense claim items is not pageable
(one page) in the example above.
All the expressions #{expression} in layout code will be resolved when the view is rendered.
@Override
public Map<Class, FormDesignDescriptor> getFormDesignDescriptorMap() {
Map<Class, FormDesignDescriptor> formDesignViewConfigDescriptorMap = new LinkedHashMap<Class, FormDesignDescriptor>();
// ExpenseClaim, use default FormDesign implementation
ViewConfigDescriptor ecViewConfigDescriptor = new ViewConfigDescriptor(
ExpenseClaim.PROPERTY_EXPENSE_CLAIM_ITEMS, ViewType.ENTITY_LIST_NARROW,
null, true
);
formDesignViewConfigDescriptorMap.put(ExpenseClaim.class,
new FormDesignDescriptor(null, new ViewConfigDescriptor[]{ecViewConfigDescriptor}));
return formDesignViewConfigDescriptorMap;
}
To add a menu node for managing Form Designs of a module, call getFormDesignTypeDescriptor(viewConfig) to get
the TypeDescriptor for FormDesign, and then add it to the module menu. For example,
public class HrMenuNodeFactory extends ModuleMenuNodeFactory {
@Override
protected void createSubMenu() throws SystemException {
MenuViewConfig viewConfig = this.viewConfig.clone();
MenuNode settingsMenuNode = addSettingsMenuNode(rootMenuNode);
TypeDescriptor[] settingTypes = new TypeDescriptor[] {
getFormDesignTypeDescriptor(viewConfig)
};
addTypedMenuNodes(this, settingsMenuNode, settingTypes);
}
}
Import form designs from system (provided by module), click "Import/System" under the "Form Designs" menu node. For example,
Settings > Form Designs > Import/System.Form designs can be exported to external files, and imported from external files.
When setting a Form Design programmatically in ViewConfig, it can be an existing FormDesign or a new FormDesign object. For example,
Create a lazy loading FormDesign by setting its formId and partiallyInitialized.
EntityViewConfig viewConfig = new EntityViewConfig(ViewType.ENTITY);
FormDesign formDesign = TypeMapping.newImplementationInstance(FormDesign.class);
DataType entityType = TypeMapping.getInstance().getDataTypeExactly(ExpenseClaim.class);
formDesign.setEntityType(entityType);
formDesign.setFormId("1001");
formDesign.setPartiallyInitialized(true);
viewConfig.setFormDesign(formDesign);
Create a new FormDesign object with layout code for Employee.
EntityViewConfig viewConfig = new EntityViewConfig(ViewType.ENTITY);
FormDesign formDesign = TypeMapping.newImplementationInstance(FormDesign.class);
formDesign.setLayout("#{photos}<br/>#{name} #{department}");
formDesign.setDecoded(true);
viewConfig.setFormDesign(formDesign);
<object xmlns="http://www.cmobilecom.com/af/objects" type="entity">
<entityType>ExampleHR.EC</entityType>
<mode>VIEW</mode>
<criteriaElements>
<function name="EQ" property="nid">100</function>
</criteriaElements>
<viewConfig>
<viewType>ENTITY</viewType>
<formDesign type="System.FD">
<entityType>ExampleHR.EC</entityType>
<formId>0001</formId>
</formDesign>
</viewConfig>
</object>
type and entityType are optional. FormDesign type is default to System.FD (the
FormDesign implementation in System module), and entityType will be obtained from its
EntityBackingBean.
<viewConfig>
<viewType>ENTITY</viewType>
<formDesign >
<formId>0001</formId>
</formDesign>
</viewConfig>
Create a new FormDesign with layout code and optional style sheet. For example,
<viewConfig>
<viewType>ENTITY</viewType>
<formDesign>
<layout><![CDATA[#{photos}<br/>#{name} #{department}]]></layout>
<style>...</style>
</formDesign>
</viewConfig>