Screen customization is a screen event designed to perform a set of actions when a host screen is recognized. It includes recognizing a screen and transforming it into a GUI for the user or playing a macro to skip the screen. The screen customization definition includes a set of screen recognition criteria and a list of actions to be taken when a host screen matches the recognition criteria.
A host screen is recognized by matching specific screen recognition. For the recognition, we need to identify some fields, global variables, colors, etc. which are unique to the screens.
Consider a scenario where there are two HOST screens with the same fields and data. The first screen displays the complete data but in the second screen we have few data which are hidden or protected. Such screens cannot be recognized by using the ‘String Criteria’ but can be recognized by using the ‘Custom criteria’ option.
Implementation of Custom Screen Recognition criteria
To create a new custom criteria logic, we need to follow the below steps:
- Open the Java™ perspective and create a ZIETrans project.
- Click File > New > Class.
- Browse to the Source directory of your ZIETrans project.
- Enter the names of your package and class.
- Click Finish.
It is a simple java class extending com.ibm.hats.common.customlogic.AbstractAdvancedCustomScreenRecoListener
We need to add the logic to the ‘isRecognized’ method which returns a boolean value.
public boolean isRecognized(String arg0, IBusinessLogicInformation arg1, ECLPS arg2, ECLScreenDesc arg3)
In the customed event file, click on Screen Recognition Criteria tab then select Custom Criterion from the Add dropdown option.
In the Class name input field, specify the name of the java class containing the method we want to run, or click Browse to select the class name from the source directory and call the method ‘isRecognized’. (As shown in Fig 3).
Recognition based on hidden fields
When we select a screen capture for recognition criteria, there is a check box for the Highlighting field, once we click on the check box for Hidden/Protected we can identify all the hidden/protected fields in the host screen. This feature is helpful to view the hidden and protected fields on a screen.
For example, we have an 8-character field in (16, 2) which is visible on the first screen but hidden in the second.
Below is an example of Custom criteria logic for hidden field recognition –
Recognition using protected fields
Here is an example of creating custom criteria based on a protected field. Consider an example where there are two similar screens but in one screen LOC text field is protected and another it is unprotected. Based on the start and end position of this protected field, we have implemented our business logic in custom criteria to recognize the screens.
Here is a sample for the logic implemented in ‘isRecognized’ method to understand the protected field –