IFieldTagGenerator This is the generator that is used for basic field types. Implementing a generator like this would handle all fields types that are directed to it.
IWSTagGenerator This generator will key off of WebSettings values on the field. If a generator of this type is selected then it will be used in preference over the generator for the basic field type.
IWSSubTagGenerator define the main HTML construct that is emitted.
The generator classes would be contained within a plugin. The plugin.xml for that plugin is used to make the generator classes visible to the WebFacing conversion and also to indicate what field or WebSetting type that it would be used for. When searching for a generator to use WebFacing conversion will first look for an overriding IWSTagGenerator based upon the WebSettings for the field. If one is not found then the IFieldTagGenerator for the generic field type would be used. If no generator is found then the default WebFacing output will be produced for that field.
This plugin contains the implementation of three example generators. There is one for fields with program defined HTML WebSetting, one for fields with user defined HTML web setting and a clear tag that simply encapsulates the default WebFacing output. In the plugin.html for this plugin you will see them defined as shown in the following plugin.xml fragment. The value links to the field or WebSetting type and the class points to the generator to be used for that type. Currently the values are shown as numerics. In the future this is expected to be replaced by symbolic types that will be easier to understand and expand upon.
<!-- Simple tag generators for program defined and user defined web settings --> <extension point="com.ibm.etools.iseries.webfacing.customwsgenerator"> <action value="16" class="com.ibm.etools.iseries.ae.customtags.gen.PgmDefTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customwsgenerator"> <action value="17" class="com.ibm.etools.iseries.ae.customtags.gen.UsrDefTagGen"/> </extension> <!-- Encapsulate all field types in a transparent container for ease of editing --> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="0" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="1" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="2" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="3" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="4" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="5" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="6" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="7" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="8" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="9" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="10" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="11" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="12" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="13" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="14" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="15" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="16" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="17" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="18" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension> <extension point="com.ibm.etools.iseries.webfacing.customfieldgenerator"> <action value="19" class="com.ibm.etools.iseries.ae.customtags.gen.MTFldTagGen"/> </extension>
In order to assist the understanding of how the generation classes are coded the source for the three simple examples in the plugin are available here
MTFldTagGen.java This is the source for the pass-through tag generator that simply encapsulates the normally generated field HTML in a tag.
PgmDefTagGen.java This generator uses a tag which extracts the field data for the field HTML.
UsrDefTagGen.java This generator uses the data contained in the user-defined HTML WebSetting for the field HTML.
As noted above there are three types of generators, one for handling the basic field types, one for handling WebSettings and one for what will be called Sub-WebSettings. The purpose of the first type of generator is obvious, simply to handle any field of that type. How and when the other two come into play is less obvious. A WebSetting based generator will be called when there is a WebSetting of that type on the field. This generator would then be expected to emit the tag source for the field in place of the field tag generator. There is only expected to be one WebSetting of this type associated with a given field. If there is more than one WebSetting that would resolve to a generator that will emit the entire tag content then it is undefined as to which one would be called.
Sub WebSettings should be viewed as simply modifiers of the primary element. Typically they would emit a tag that is included in the outer field tag. Here is a small example about how the html for Sub WebSettings might be used
// Obtain the list of subWebSettings for this field. // Typically that would be all the web settings other than the one // that may have been used to initiate the current generator Iterator i = input.getSubWebSettings(); while (true == i.hasNext()) { // Extract the next Web Settings element IRawWebSetting irws = (IRawWebSetting)i.next(); // Could check that it is within some desired range if ( irws.getWebSettingId() = a_desired_one_for_this_tag) { // Request the html output for this sub tag String sts = getSubTag(irws); // Maybe perform some checking or further customization of // the output as desired if (null != sts) { tagstring += sts; } } }