Extending : Widget extension : Advanced topics : Changing the default XUI generation behavior
  
Changing the default XUI generation behavior
UDTT implements default behavior when generating an XUI page from transaction context data. For example, field type data is associated with a Text widget by default, and iColl type data is associated with a Table widget by default. However, technical developers have the option to override default UDTT behavior when generating an XUI page from transaction context data, such as associating iColl type data to a customized widget.
There are two methods by which technical developers can change the default behavior of XUI page generation:
Simple method: Technical developers have some control over UDTT default generation behavior without implementing a new XUI generation class. They can change the default XUI page generation behavior by changing the configuration file of the UDTT XUI default behavior generator. This method is suitable for changing or creating mapping between data type and widget.
Full control method: Technical developers can implement and register a new XUI generator for full control on XUI generation. The steps in this topic describe how to change the default UDTT behavior of generating an XUI page.
To change the default XUI generation behaviour by implementing and registering a new XUI generator
1 Register the extension point.
In the All Extensions panel, add a new XUIDefaultGenerator element to the com.ibm.btt.tools.transaction.editor.XUIDefaultBehaviourGenerator extension.
This graphic is described in the surrounding text.
In the Extension Element Details panel, enter the following required information:
In the name field, enter the name of the generator. This name must be unique.
In the file field, specify the configuration file for the generator.
In the class field, enter the implementation class of the generator. Technical developers can use either the UDTT default com.ibm.btt.tools.transaction.xuigenerator.XUIGenerate class, or a new class that implements the com.ibm.btt.tools.transaction.xuigenerator.IXUIGenerate interface.
In the priority field, specify the priority of this extension. If the extension point is registered by multiple plug-ins, the extension with the highest priority is invoked by UDTT. The UDTT default generator is registered as low priority; therefore, the customized generator should be registered as medium or high priority.
This graphic is described in the surrounding text.
2 Modify the default configuration file.
The default configuration file for XUI generation contains mapping information between XUI widgets and context data types. Technical developers can modify existing mapping entries or create new files for new mapping entries. The mapping entries in the UDTT default configuration file for XUI widgets and context data types is shown here:
<defaultXUIGeneration>
  <widgetMappings>
    <widgetMapping dataElement="field" widgetName="Text"/>
    <widgetMapping dataElement="iColl" widgetName="Table"/>
    <widgetMapping dataElement="kColl" widgetName="Combo"/>
    <widgetMapping dataElement="data" widgetName="Text"/>
  </widgetMappings>
</defaultXUIGeneration>
3 Implement a new XUI generation class.
UDTT provides capability for technical developers to implement and register a new XUI generation class to have full control when generating XUI page skeleton from transaction context data. The class should implement the com.ibm.btt.tools.transaction.xuigenerator.IXUIGenerate interface. The following is API description of IXUIGenerate interface:
public void generateXUIFile(String folder, String fileName, String XUITemplateName, List <MetaData> dataToBeGenerated, String contextName)
This method performs XUI generation for data passed as parameter in dataToBeGenerated. This data is in context specified as argument or in its hierarchy. In case of using a template (XUITemplatName parameter), the generation is located in the first form in the template. The generation is performed in a file with the name and in the folder specified as parameters.
public void generateXUIFile(String folder, String fileName, String XUITemplateName, List <MetaData> dataToBeGenerated, String contextName, Hashtable <String, String> defaultMapping)
The method performs XUI generation for data passed as parameter in dataToBeGenerated. This data is in context specified as argument or in its hierarchy. For data included in defaultMapping, the widget generated is the one specified in the hashtable. This hashtable must contain as keys any of these values: IXUIGenerate.FIELD, IXUIGenerate.KEYED_COLLECTION, IXUIGenerate.INDEXED_COLLECTION and IXUIGenerate.DATA. Corresponding values must a widget name. In case of using a template (XUITemplatName parameter), the generation is located in the first form in the template. The generation is performed in a file with the name and in the folder specified as parameters
public IRootModel generateXUIFile(String XUITemplateName, List <MetaData> dataToBeGenerated, String contextName)
The method performs XUI generation for data passed as parameter in dataToBeGenerated. This data is in context specified as argument or in its hierarchy. In case of using a template (XUITemplatName parameter), the generation is located in the first form in the template. An IRootModel object is returned containing the generation
public IRootModel generateXUIFile(String XUITemplateName, List <MetaData> dataToBeGenerated, String contextName, Hashtable <String, String> defaultMapping)
The method performs XUI generation for data passed as parameter in dataToBeGenerated. This data is in context specified as argument or in its hierarchy. For data included in defaultMapping, the widget generated is the one specified in the hashtable. This hashtable must contain as keys any of these values: IXUIGenerate.FIELD, IXUIGenerate.KEYED_COLLECTION, IXUIGenerate.INDEXED_COLLECTION and IXUIGenerate.DATA. In case of using a template (XUITemplatName parameter), the generation is located in the first form in the template. An IRootModel object is returned containing the generation.
Go up to
Advanced topics