File $projectDirectory/resources/xml/model/film/FilmTextDIGENERATED.xml describes the layout of FilmText entity linked to a Film entity (OneToOne relationship)..

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.filmText/FilmTextMM" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/includeTree.xsd">
    <section text="#MSG(filmText, detailSectionText)" style="Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED" id="detailSection">
        <listeners>
            <listener id="filmIELsnr" listenerTypes="BEFORE_ENTITY_INJECTION">
                <code>getComposite().setEnabled(null != getEntity());</code>
            </listener>
            <listener id="filmAELCLsnr" listenerTypes="AFTER_END_LIFE_CYCLE">
                <code>getComposite().setEnabled(null != getEntity());
getControl().setData(&quot;ONE_TO_ONE&quot;, #ENTITY_MM(adi://myproject/model.film/FilmMM).getFieldMap().get(&quot;filmText&quot;));</code>
            </listener>
        </listeners>
        <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"/>
        <extraText addRefreshItem="true" property="description" id="description"/>
        <imageViewer toolBarStyle="AdiSWT.EXPANDABLE | AdiSWT.EDITABLE | AdiSWT.DELETE_BUTTON" imageType="Data" property="image" id="image"/>
        <dateText property="lastUpdate" style="SWT.BORDER | SWT.TIME | AdiSWT.DELETE_BUTTON" id="lastUpdate"/>
    </section>
</includeTree>

renders the following layout:
 FilmText detail (brute)


Change XML elements

  • Copy FilmTextDIGENERATED.axml file to FilmTextDI.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.filmText/FilmTextMM" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/includeTree.xsd">
    <section text="#MSG(filmText, detailSectionText)" style="Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED" id="detailSection">
        <listeners>
            <listener id="filmIELsnr" listenerTypes="BEFORE_ENTITY_INJECTION">
                <code>getComposite().setEnabled(null != getEntity());</code>
            </listener>
            <listener id="filmAELCLsnr" listenerTypes="AFTER_END_LIFE_CYCLE">
                <code>getComposite().setEnabled(null != getEntity());
getControl().setData(&quot;ONE_TO_ONE&quot;, #ENTITY_MM(adi://myproject/model.film/FilmMM).getFieldMap().get(&quot;filmText&quot;));</code>
            </listener>
        </listeners>
        <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"/>
        <dateText property="lastUpdate" style="SWT.BORDER | SWT.TIME" enabled="false" id="lastUpdate"/>
        <composite layoutData="newline, grow, push, span 4" id="bottomComposite">
            <layout layoutConstraints="ins 0, wrap 2" columnConstraints="[fill,grow]15[fill,grow]" rowConstraints="[grow,fill, al top]"/>
            <extraText addRefreshItem="true" property="description" noLabel="true" layoutData="sg bottom, w 0:64:n" id="description"/>
            <imageViewer toolBarStyle="AdiSWT.DELETE_BUTTON | AdiSWT.EXPANDABLE | AdiSWT.EDITABLE" fitCanvas="true" imageType="Data" property="image" noLabel="true" layoutData="sg bottom, w 0:64:n" id="image"/>
        </composite>
    </section>
</includeTree>
renders the new layout:
 FilmText detail (improved)

Remark:
File FilmTextDIGENERATED.axml is copied as file FilmTextDI.axml, so that, if a generation process occurs, changes will not be affected.

  • Line 32: description property field is managed in a ExtraText controller.
  • Line 33: image property field is managed in a ImageViewer controller.
tutorial/improve_filmtext_detail.txt · Last modified: 2015/10/05 17:52 (external edit)