UI Annotations
Another form of annotation that exists in iiziGo is the UI Annotation. To access any of the UI Component Events in your Java code you must first set the ‘Events’ property on the component’s Panel. A UI Annotation will be added to your Java class. Then you can set a Java method to respond to any of the familiar UI events by assigning a value to a component’s UI event. A UI Annotation will be added to your Java Method.
Creating classes in the panel’s property editor
Common UI Events
OnUICreate |
OnUIValueChange |
OnUIDestroy |
OnUIAction |
OnUIConnect |
OnUISelection |
OnUIBack |
OnUITextChange |
OnUIFocus |
. |
Creating or selecting Java methods through a component’s Events property
In the following example, we will add a Java method to the UI Event, OnUICreate; our method will lock the mobile device orientation when the Panel is created. A Java method and its annotation are automatically created when adding a method to a UI Event in the Panel’s Property Editor. With the Panel selected in the Property Editor, the Property Editor displays the ‘Events’ section in which you can choose from the UI Events listed above. By clicking the more “…” button to the right of the OnUICreate property, you can create a new Java method – with the correct annotation – that will be called when your Panel is created. And by doing the same when it is destroyed. Notice that the client session is accessed on the event by a reference to the iizi Client Gyro.