ContentWelcomeProducts Abeona Gaia News Documentation Introduction Swing support Server application Basics Controller Forms Validation XML Logging Utilities Launcher License Download Hephaistos JavaGantt Services Promote your software Contact Us Links |
Form and data bindingEach client / server application must interract with a user. Gaia supports this requirement with the FormController class. FormController is an abstract superclass for all form-based controllers. It supports data binding - it extracts from given data objects data requested by the form, prepares it for ApplicationResponse and also processes returned changed data from a client. Form controller works with a form description in XML format. So you can use the same form XML file for the Swing client form and also on server side. FormController extracts binding attributes from that XML file and creates its internal bind-mapping. Then - when constructing response for client - it mines property values defined in binding from given data object and sends it to the client to show in UI. There are some methods you have to implement in your subclass:
There is the method displayForm(Context) which creates completed application response with extracted and converted values from the context's data object and with the data for list models. This method invokes all of above methods. The data extraction and data binding for displaying data on the client is processed in method buildFormObject(Object, String, Context) in these steps:
If you want to use this built-in mechanism but you need to modify it, you can override method getMiner() to change the tool to access data properties or getPropertyValueFromDataObject(Object, String, Context) to do the same without changing the miner. There is also the support to process the modified data from the client. It is started with method acceptFormObject(ApplicationRequest, Context) (you have to invoke it from your code yourself). It takes the server data object (via getObject(Context) method) and incoming data from the client request, walks in client form object(s) property by property and searches the appropriate property in data object(s). When it is found, invokes method acceptFormPropertyValue(Object, Object, Object, Object, String, Context) to set changed value to the data object. Override this last method to:
|