Adichatz generates one XML file by entity to display query result in a table control.\\
For example, the generated file for a Customer class is described by an XML file called $projectDirectory/resources/xml/model/customer/CustomerTIGENERATED.axml:
\\
return null != #ROW().address ? #ROW().address.address : "";
return null != #ROW().store ? String.valueOf(#ROW().store.getStoreId()) : "";
Remarks:\\
* Line 3 - Controller wraps a table control and hosts rows of type Customer.
* Line 4 - Context menu is passed as a parameter.
* Lines 5-8 - Links give acces to Cross references (e.g all rentals of a customer).
* Lines 11 and 14 - Displayed values for this column are computed.
\\ \\
After [[tutorial:complete_query|having completed query for Customer]] by adding jointures, displayed data can be enriched as shown below.
For example, create file $projectDirectory/resources/xml/model/cutomer/CustomerTI.xml.
return !row.isActive() ? #COLOR(SWT.COLOR_YELLOW) : null;
return !row.isActive() ? #COLOR(SWT.COLOR_YELLOW) : null;
return null != #ROW().address ? #ROW().address.address + " - " + #ROW().address.city.city
+ " - " + #ROW().address.city.country.country : "";
return null != #ROW().store ? #MSG(customer, store) + ":" + #ROW().store.address.city.city + " - " + #ROW().store.address.city.country.country + " (" + #ROW().store.staff.lastName + ")" : "";
\\
**renders the following layout:**\\
{{tutorial:table_controller.png?600 | Table controller}}
Explanations:\\
File CustomerTIGENERATED.axml is copied as file CustomerTI.axml, so that, if a generation process occurs, changes will not be affected.
* Lines 11 and 14: Background is **Yellow** when customer is not valid.
* Lines 18 and 21: Return computed value for store and address.
return null != #ROW().address ? #ROW().address.address
+ " - " + #ROW().address.city.city
+ " - " + #ROW().address.city.country.country : "";
is equivalent to
if (null != customer.getAddress())
return customer.getAddress().getAddress() + " - "
+ customer.getAddress().getCity().getCity() + " - "
+ customer.getAddress().getCity().getCountry().getCountry();
else
return "";
So, this table controller works with query containing all needed jointures. E.g. use example query described in page [[complete_query#changed_query|complete query]].