OpenLegacy Blog

More useful API's

Share this:

Do you know about our API's which simplify the model binding to a terminal snapshot?  Let's review them:

@ScreenListField

This annotation is applicable for fields with multiple instances which are not tables.
For example, on the session snapshot you see:
Phone: ______ Phone2: ______ Phone3: ______

With @ScreenListField you define it as follows:

@ScreenListField(fieldLength = 6, count = 3, gaps = { 20, 17})
@ScreenField(row = 8, column = 25)
private List<String> phones;

This way you can easily map snapshot content to Java List or array.
Using gaps of 80 or higher you can map over multiple rows too.

@ScreenField when/unless

Sometimes snapshots display different kind of content on the same position.
OpenLegacy helps you capture this use cases by defining a condition on the current text.
If the current text doesn't match the "when" regular expression, then the Java field will remain null.
Same applies for "unless" attribute, but binding is done when condition does NOT match.

@ScreenField(when="Err.*", row=24, Column=2)
private String errorMessage;

@ScreenField(unless="Err.*", row=24, Column=2)
private String userMessage;

Binding to field attributes

In some cases, logical data relies in the attributes of the host fields. Thus, you may want to bind to attributes too.
Now you can.

@ScreenField(row = 9, column = 10, attribute = FieldAttributeType.Editable)
private Boolean recordEditable;

Color binding is also supported using FieldAttributeType.Color.
In future versions we will add binding support for expressions and more attributes types.

You can find answers to may questions in our FAQs. Stay tuned! 

Tags: Development

Share this: