Using custom screen recognition

You can use business logic to perform custom screen recognition. ZIETrans Toolkit provides many options for recognizing screens within a screen customization, including the number of fields on a screen, the presence or absence of strings, and the use of global variables. These options are described in Working with screen events. You might find, however, that you want to recognize a screen in a way that you cannot configure using the options in the screen customization editor. In that case, you can add your own custom screen recognition logic.
Note: The information in this section can be used for screen recognition within macros as well as within screen customizations.

If you want to create custom screen recognition logic using ZIETrans global variables, see Custom screen recognition using global variables.

If you have already created custom screen recognition logic by extending the ECLCustomRecoListener class, you can use this logic within ZIETrans. If you are creating new custom logic, follow these steps:
  1. Open the Java™ perspective.
  2. Click File > New > Class.
  3. Browse to the Source directory of your ZIETrans project.
  4. Enter the names of your package and class.
  5. For the superclass, click Browse and locate com.ibm.hats.common.customlogic.AbstractCustomScreenRecoListener.
  6. Select the check box for Inherited abstract methods. Click Finish. This imports the code skeleton into the project you specified.
  7. Add your logic to the isRecognized method. Make sure that it returns a boolean value.

    public boolean isRecognized(String arg0, IBusinessLogicInformation arg1, ECLPS arg2, ECLScreenDesc arg3)

    Refer to the ZIETrans API documentation at the in this documentation set for a description of this method.

  8. After creating your method, you must update the screen recognition to invoke your method. From the ZIETrans projects view, expand your project and the Screen Customizations folder. Double-click the name of the screen customization to which you want to add your custom logic. Click the Source tab to open the Source view of the screen customization.
  9. Within the Source view, you will see a block that begins and ends with the <description> and </description> tags. This block contains the information that is used to recognize screens. Add a line within this block to invoke your custom logic:

    <customreco id="customer.class.package.MyReco::settings" invertmatch="false" optional="false"/>

    where customer.class.package.MyReco is your package and class name. If you want to pass any settings into your class, add them after the class name, separated by two colons. Settings are optional, and your class must parse whatever values are passed in. If you do not need settings, omit the two colons.

    Consider where within the description block you want to place the <customreco> tag. If you want your custom logic invoked only if all the other criteria match, place the <customreco> tag at the end of the block, immediately before the </description> tag. If your screen customization compares a screen region to a value, the description block will contain a smaller block, beginning and ending with the <block> and </block> tags, to define the value to which the screen region is compared. Be sure not to place your customreco tag inside this block.

    Following is an example section of a description block. Note the <customreco> tag just before the </description> tag, and not between the <block and </block> tags.
    <description>
    <oia invertmatch="false" optional="false" status="NOTINHIBITED"/>
    <numfields invertmatch="false" number="61" optional="false"/>
    <numinputfields invertmatch="false" number="16" optional="false"/>
    <block casesense="false" col="2" ecol="14" erow="21" 
    			invertmatch="false" optional="false" row="20">
    <string value="USERID ==="/>
    <string value="PASSWORD ==="/>
    </block>
    <cursor col="16" invertmatch="false" optional="false" row="20"/>
    <customreco id="customer.class.package.MyReco::settings" 
    			invertmatch="false" optional="false"/>
    </description>
  10. To rebuild your ZIETrans project, click Project > Clean on the toolbar.
  11. For RCP, run the application in your local test environment to test your project. Refer to Preparing your ZIETrans project for use as an application for more information.