This is the most important concept in gui4j, since most attributes are based on method calls. In xml this is simply a string which is parsed by the framework and translated into method calls using the reflection API of Java. The framework acts like a simple Java parser.
<button guiId=”saveButton” text=”‘Save'” actionCommand=”saveData”/>
This example defines a button with name saveButton, displaying the text Save and when the user presses the button the action saveData is executed. Note that each view is linked with one controller instance (see the definition of the View Constructor). When the framework reads the above xml definition, a method with the name saveData is searched in the class definition of the linked controller and the corresponding super class definitions. Since the method in the above example has no arguments, the class search considers only methods with no arguments:
public void saveData()
… some action
The value of the above text attribute is a method call, too. It is a string constant denoted by the special notion using apostrophes.
Supported notions by the gui4j parser
- ‘some text’
The string constant some text. The type of this expression is java.lang.String.
An expression starting with a colon implies that the following name (here SomeTypeAlias) is a type alias defined using ClassAlias. Usually this notion is used to refer to static fields or static methods, without the need on an instance. The type of this expression is the type of the defined type alias.