UI Metamodel

The UI Metamodel is an XML based configuration file used to construct the menus on the screen. Its entries control the visibility and function of menu elements based on permissions and roles defined within your module. Every aspect of the Command Center's menu is controlled using this file.

The UI Metamodel does not contain configuration information for layout, colors, logos, etc. This is all handled by cascading style sheets and is completely separate from the UI Metamodel.

The UI Metamodel can be defined either at the module-level or at the dataset-level. A dataset UI Meta Model can inherit all or some of the actions, folders, or menus defined in the modules it references. Let's take a look at the UI Metamodel in both the MPT and SPT settings.

Within the Module Process Template you can find the UI Metamodel within the file tail.mpth. The tail.mpth file is an XML file that contains a great deal more than the UI Metamodel definition. As such, the metamodel information is stored under a node within tail.mpth called <ModuleUiMetaModel>. While it's possible to edit this file directly, this is not recommended. Studio has a validating editor for the UI Metamodel which will immediately alert you if errors are introduced into the file.

Procedure 6.1. To view and edit the UI Metamodel entries for your MPT:

  1. From within Studio, Open the MPT for your application

  2. Locate the UIMetaModel tab

  3. Within the UI Metamodel, make one entry for each portlet similar to the following example:

    <WebAction name="PortletName"> <!-- *1* -->
          <PanelClass>One.Report</Panellass> <!-- *2* -->
          <PanelConfig>{reportName: 'PTA.PivotWithMonthSorting', autoExecute: true}</PanelConfig> <!-- *3* -->

    1. On this line you should specify the name of the portlet within the context of the UI meta-model. Normally you just use the regular name of the portlet.

    2. Within the panel class tag, specify the class used to create the portlet.

    3. Use the PanelConfig tag to create the configuration object to pass configuration settings to the portlet.

The UI Metamodel within the Module allows you to control the module's user interface elements for that module. As with all other aspects of the module's dataset, the UI Metamodel within the dataset allows you to further customize UI features in cases where you need to deploy additional instances of your module. For example, you have two customers who need different customizations to the module's user interface. Such customizations belong at the dataset level since they do not affect the entire application—only the current applied instance. This allows you to develop a module and then to customize it for different customers without creation branches of your module's source tree. Let's next take a look at opening the UI Metamodel within a dataset.

  1. Press Ctrl + Shift + R within Studio to bring up the Open Resource Dialog.

  2. Type UIMetaModel.xml to narrow the list in the Open Resource Dialog. There will be one entry for each dataset you currently have open in your Studio workspace.

  3. Double click the desired file to open it.

Aside from the obvious difference in the location of the UI Metamodel in the MPT and SPT environments, the format of the UI Metamodel entries is the same for both files except the root. The UI Metamodel within the dataset have root element <UiMetaModel> instead of <ModuleUiMetaModel>.The remainder of this section will focus on the various configurable entries with the UI Metamodel in the MPT.

In all cases throughout this chapter, we are assuming the use of Command Center as custom user interface development is beyond the scope of this user's guide.