Adichatz generates brute Entity Editors to display detail parts of an Entity and the list of its related objects (dependencies). For example the Entity Editor for a Film class is described by an XML file called 'FilmEditorGENERATED.axml' or 'FilmDIGENERATED.axml' (see generated file).

For example, open file $projectDirectory/resources/xml/model/film/FilmDIGENERATED.xml.

Following XML elements:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<includeTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" entityURI="adi://myproject/model.film/FilmMM" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/includeTree.xsd">
    <section text="#MSG(film, detailSectionText)" style="Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED" id="detailSection">
        <layout layoutConstraints="wrap 4" columnConstraints="[fill, align right]10[fill,grow]25[align right]10[fill,grow]"/>
        <include adiResourceURI="#PARAM(TOOL_BAR)" id="detailToolbarMenu">
            <params>
                <param id="CONTROLLER" value="#CONTROLLER(detailSection)"/>
            </params>
        </include>
        <formattedText editPattern="######" format="Short" property="filmId" enabled="false" id="filmId"/>
        <refText property="languageByOriginalLanguageId" style="SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.EDITOR_BUTTON | AdiSWT.DELETE_BUTTON" id="languageByOriginalLanguageId">
            <convertModelToTarget>return null==value ? &quot;&quot; : #FV().name;</convertModelToTarget>
        </refText>
        <refText property="languageByLanguageId" mandatory="true" style="SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.EDITOR_BUTTON" id="languageByLanguageId">
            <convertModelToTarget>return null==value ? &quot;&quot; : #FV().name;</convertModelToTarget>
        </refText>
        <text textLimit="255" property="title" mandatory="true" id="title"/>
        <checkBox property="forRent" style="SWT.CHECK" id="forRent"/>
        <formattedText editPattern="######" format="Short" property="rentalDuration" mandatory="true" id="rentalDuration"/>
        <numericText pattern="##.##" property="rentalRate" mandatory="true" style="SWT.BORDER | SWT.RIGHT" id="rentalRate"/>
        <formattedText editPattern="######" format="Short" property="length" id="length"/>
        <numericText pattern="###.##" property="replacementCost" mandatory="true" style="SWT.BORDER | SWT.RIGHT" id="replacementCost"/>
        <text textLimit="5" property="rating" id="rating"/>
        <text textLimit="54" property="specialFeatures" id="specialFeatures"/>
        <text textLimit="255" property="description" id="description"/>
        <text textLimit="255" property="imageUrl" id="imageUrl"/>
        <dateText property="lastUpdate" mandatory="true" style="SWT.BORDER | SWT.TIME" id="lastUpdate"/>
    </section>
</includeTree>

renders the following layout:
 Film detail (brute)


Change XML elements

  • Copy FilmDIGENERATED.axml file to FilmDI.axml which will become the reference for generated code.
  • Replace above XML lines with the following ones:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<includeTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" entityURI="adi://myproject/model.film/FilmMM" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/includeTree.xsd">
    <section text="#MSG(film, detailSectionText)" style="Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED" id="detailSection">
        <layout layoutConstraints="wrap 4" columnConstraints="[fill, align right]10[fill,grow]25[align right]10[fill,grow]"/>
        <include adiResourceURI="#PARAM(TOOL_BAR)" id="detailToolbarMenu">
            <params>
                <param id="CONTROLLER" value="#CONTROLLER(detailSection)"/>
            </params>
        </include>
		<formattedText editPattern="######" format="Short" property="filmId" enabled="false" id="filmId"/>
		<text textLimit="255" property="title" mandatory="true" id="title"/>
		<text layoutData="span 3" textLimit="255" property="description" id="description"/>
		<composite layoutData="newline, grow, push, span 4" id="bottomComposite">
		    <layout layoutConstraints="wrap 2" columnConstraints="[fill, grow][fill, grow]" rowConstraints="[fill, grow, al top]"/>
		    <imageViewer imageType="Url" fitCanvas="true" toolBarStyle="AdiSWT.DELETE_BUTTON | AdiSWT.EXPANDABLE | AdiSWT.EDITABLE" noLabel="true" layoutData="hmax 300" property="imageUrl" id="imageUrl"/>
		    <composite id="fieldComposite">
		        <layout layoutConstraints="wrap 2" columnConstraints="[align right]10[fill,grow]"/>
		        <refText property="languageByOriginalLanguageId" style="SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.EDITOR_BUTTON | AdiSWT.DELETE_BUTTON" id="languageByOriginalLanguageId">
		              <convertModelToTarget>return null==value ? &quot;&quot; : #FV().name;</convertModelToTarget>
		        </refText>
		        <refText property="languageByLanguageId" mandatory="true" style="SWT.BORDER | AdiSWT.EDITOR_BUTTON | AdiSWT.FIND_BUTTON" id="languageByLanguageId">
		              <convertModelToTarget>return null==value ? &quot;&quot; : #FV().name;</convertModelToTarget>
		        </refText>
		        <ccombo values="G, PG, PG-13, R, NC-17" style="SWT.READ_ONLY | SWT.BORDER" property="rating" id="rating"/>
		        <checkBox text="#MSG(film,forRent)" property="forRent" noLabel="true" style="SWT.CHECK" id="forRent"/>
		        <composite id="forRentComposite">
		            <layout layoutConstraints="wrap 1, ins 0, hidemode 3" columnConstraints="[fill, grow]"/>
		            <pgroup text="#MSG(film,forRent)" id="forRentGroup" dirtyManagement="false">
		                <dynamicClause listenedFieldId="forRent">
		                    <conditionCode>#BEAN().getForRent()</conditionCode>
		                    <postCode>#CONTROLLER(fieldComposite).getComposite().layout();
#CONTROLLER(detailSection).reflow();</postCode>
		                </dynamicClause>
		                <layout layoutConstraints="wrap 2" columnConstraints="[align right]10[fill,grow]"/>
		                <formattedText editPattern="######" format="Short" property="rentalDuration" mandatory="true" id="rentalDuration"/>
		                <numericText pattern="##.##" property="rentalRate" mandatory="true" style="SWT.BORDER | SWT.RIGHT" id="rentalRate"/>
		                <numericText pattern="###.##" property="replacementCost" mandatory="true" style="SWT.BORDER | SWT.RIGHT" id="replacementCost"/>
		            </pgroup>
		        </composite>
		        <formattedText editPattern="######" format="Short" property="length" id="length"/>
		        <text textLimit="54" property="specialFeatures" id="specialFeatures"/>
		        <dateText property="lastUpdate" enabled="false" style="SWT.BORDER | SWT.TIME" id="lastUpdate"/>
		    </composite>
		</composite>
    </section>
</includeTree>
renders the new layout:
 Film detail (improved)

Remarks:
It is easy to change completely FilmDI.axml layouts.

tutorial/improve_film_detail.txt · Last modified: 2015/10/05 17:52 (external edit)