Extending : Widget extension : Enabling a customized widget in the XUI editor : Creating and registering widget mappings
  
Creating and registering widget mappings
After functional developers create an XUI file, UNICOM® Digital Transformation Toolkit (UDTT™) automatically generates a JSP file for the XUI file when Generate Dojo is selected. To generate proper JSP tags for the customized widget, a technical developer must create a new widget mapping file and the register it as a plugin extension.
After a technical developer creates a widget mapping file, they must register the mapping file. To register the widget mapping file, refer to Registering a widget mapping.
Creating a widget mapping file
Sample widget mapping file
<mappings prefix="alphadojo:">
<widget-mapping widgetName="AccountWidget" tagName="account">
<property-mapping propName="labelColor" attrName="color" />
<property-mapping propName="balanceColor" rule="RGBValueRule" />
</widget-mapping>
</mappings>
A widget mapping file must contain one <mappings> tag. The prefix attribute is the only attribute for the <mappings> tag. The prefix attribute specifies the prefix text for the tag when mapping the widget to the JSP file. The value should be the same as prefix attribute of ‘tablib' directive in JSP file.
Each widget requires a <widget-mapping> element to describe how a widget is mapped to a JSP tag. The <widget-mapping> tag has the following two attributes:
widgetName
Is the name for the given widget. The name should match with the name defined in the widget extension point. For more information on adding widget extension points, refer to Importing a widget.
tagName
Is the JSP tag name for this widget.
By default, each widget property name is mapped to the same attribute name of the JSP tag directly. For properties, without mapping definition, default mapping will be handled automatically. To customize property mapping, a technical developer can define a ‘property-mapping' element to specialize the mapping from widget property to a tag attribute. There are 3 attributes for ‘property-mapping' tag:
propName
Is the name of a property. The value of the propName attribute must be the same as the name of the property as defined in the widget definition .xml file. For more information on the widget definition .xml file, refer to Defining a widget.
attrName
Is the name of the attribute that maps a property to a JSP tag.
rule
Specifies the property mapping rule, which can handle more flexible property mapping scenarios. For information on how to implement a property mapping rule, refer to Creating a customized property mapping rule.
Go up to
Enabling a customized widget in the XUI editor