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:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<includeTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.9.1/generator/includeTree.xsd">
    <table sortedColumn="customerIdTC" entityURI="adi://myproject/model.customer/CustomerMM" id="table">
        <include adiResourceURI="#PARAM(CONTEXT_MENU)" id="tableContextMenu"/>
        <crossReferences>
            <crossReference entitySetId="rentals" description="#MSG(customer, rentals)" axmlDetailURI="adi://myproject/model.rental/RentalDI" axmlTableURI="adi://myproject/model.rental/RentalTI" axmlQueryURI="adi://myproject/model.rental/RentalQUERY"/>
            <crossReference entitySetId="payments" description="#MSG(customer, payments)" axmlDetailURI="adi://myproject/model.payment/PaymentDI" axmlTableURI="adi://myproject/model.payment/PaymentTI" axmlQueryURI="adi://myproject/model.payment/PaymentQUERY"/>
        </crossReferences>
        <tableColumn property="customerId" pattern="######" sorted="true" id="customerIdTC"/>
        <tableColumn property="address" sorted="true" id="addressTC">
            <columnText>return null != #ROW().address ? #ROW().address.address : &quot;&quot;;</columnText>
        </tableColumn>
        <tableColumn property="store" sorted="true" id="storeTC">
            <columnText>return null != #ROW().store ? String.valueOf(#ROW().store.getStoreId()) : &quot;&quot;;</columnText>
        </tableColumn>
        <tableColumn property="firstName" sorted="true" id="firstNameTC"/>
        <tableColumn property="lastName" sorted="true" id="lastNameTC"/>
        <tableColumn property="email" sorted="true" id="emailTC"/>
        <tableColumn property="active" pattern="CHECK_ONLY" sorted="true" id="activeTC"/>
        <tableColumn property="createDate" sorted="true" id="createDateTC"/>
        <tableColumn property="lastUpdate" sorted="true" id="lastUpdateTC"/>
    </table>
</includeTree>

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 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.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<includeTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.9.1/generator/includeTree.xsd">
    <table sortedColumn="customerIdTC" entityURI="adi://myproject/model.customer/CustomerMM" id="table">
        <include adiResourceURI="#PARAM(CONTEXT_MENU)" id="tableContextMenu"/>
        <crossReferences>
            <crossReference entitySetId="rentals" description="#MSG(customer, rentals)" axmlDetailURI="adi://myproject/model.rental/RentalDI" axmlTableURI="adi://myproject/model.rental/RentalTI" axmlQueryURI="adi://myproject/model.rental/RentalQUERY"/>
            <crossReference entitySetId="payments" description="#MSG(customer, payments)" axmlDetailURI="adi://myproject/model.payment/PaymentDI" axmlTableURI="adi://myproject/model.payment/PaymentTI" axmlQueryURI="adi://myproject/model.payment/PaymentQUERY"/>
        </crossReferences>
        <tableColumn property="customerId" pattern="######" sorted="true" id="customerIdTC"/>
        <tableColumn property="firstName" sorted="true" id="firstNameTC">
			<columnBackground>return !row.isActive() ? #COLOR(SWT.COLOR_YELLOW) : null;</columnBackground>
		</tableColumn>
        <tableColumn property="lastName" sorted="true" id="lastNameTC">
			<columnBackground>return !row.isActive() ? #COLOR(SWT.COLOR_YELLOW) : null;</columnBackground>
		</tableColumn>
        <tableColumn property="active" pattern="CHECK_ONLY" sorted="true" id="activeTC"/>
        <tableColumn property="address" sorted="true" id="addressTC">
            <columnText>return null != #ROW().address ? #ROW().address.address + &quot; - &quot; + #ROW().address.city.city&#xD; + &quot; - &quot; + #ROW().address.city.country.country : &quot;&quot;;</columnText>
        </tableColumn>
        <tableColumn property="store" sorted="true" id="storeTC">
            <columnText>return null != #ROW().store ? #MSG(customer, store) + &quot;:&quot; + #ROW().store.address.city.city + &quot; - &quot; + #ROW().store.address.city.country.country + &quot; (&quot; + #ROW().store.staff.lastName + &quot;)&quot; : &quot;&quot;;</columnText>
        </tableColumn>
        <tableColumn property="email" sorted="true" id="emailTC"/>
        <tableColumn property="createDate" sorted="true" id="createDateTC"/>
        <tableColumn property="lastUpdate" sorted="true" id="lastUpdateTC"/>
    </table>
</includeTree>

renders the following layout:
 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.
<columnText>return null != #ROW().address ? #ROW().address.address
                + &quot; - &quot;  + #ROW().address.city.city
                + &quot; - &quot;  + #ROW().address.city.country.country : &quot;&quot;;</columnText>

is equivalent to

<columnText>
if (null != customer.getAddress())
	return customer.getAddress().getAddress() + " - "  
	     + customer.getAddress().getCity().getCity() + " - "
	     + customer.getAddress().getCity().getCountry().getCountry();
else
    return "";
</columnText>

So, this table controller works with query containing all needed jointures. E.g. use example query described in page complete query.