Adichatz generates XML file using Scenarios and from the XML files use Generators which produce Java classes.
The result (editors, navigators, entities…) is rather a draft but by changing manually Adichatz XML file, developers can easily improve layouts and behaviors.

Original XML File

<?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" generationType="DETAIL" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.1/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.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" 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>

Original layout

 Film detail (original)

Using Adichatz XML file editor, it is very easy to change completely the behavior:

Improved XML File

<?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" generationType="DETAIL" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.1/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 textLimit="255" property="description" layoutData="span 3" 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 toolBarStyle="AdiSWT.DELETE_BUTTON | AdiSWT.EXPANDABLE | AdiSWT.EDITABLE" fitCanvas="true" imageType="Url" property="imageUrl" noLabel="true" layoutData="hmax 300" 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.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" id="languageByLanguageId">
                    <convertModelToTarget>return null==value ? &quot;&quot; : #FV().name;</convertModelToTarget>
                </refText>
                <combo values="G, PG, PG-13, R, NC-17" 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">
				    <dynamicClause listenedFieldId="forRent" listenedContainerId="detailSection">
				        <conditionCode>null != #BEAN().getForRent() &amp;&amp; #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>

Improved layout

 Film detail (improved)

The differences are:

  • A better layout.
  • an Image field rather a Text field containing an URL.
  • Combo field replace a text field.
  • A dynamic block for the rent issue.

So in a few minutes you can completely change the behavior of generated editors. That only a small part of what you can do. For example, Three other staways are available:

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