Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:improve_film_detail [2015/02/16 10:53]
yarpheuil
tutorial:improve_film_detail [2015/10/05 17:52] (current)
Line 1: Line 1:
 Adichatz generates brute Entity Editors to display detail parts of an Entity and the list of its related objects (dependencies). 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 'FilmEditor.axml' or '​FilmDIGENERATED.axml'​ (see [[http://​www.adichatz.org/​document/​FilmDI.xml|generated file]]).+For example the Entity Editor for a Film class is described by an XML file called '<wrap adicode>​FilmEditorGENERATED.axml</​wrap>​' or '<wrap adicode>FilmDIGENERATED.axml</​wrap>​' (see [[http://​www.adichatz.org/​document/​FilmDI.xml|generated file]]).
  
 For example, open file <wrap adicode>​$projectDirectory/​resources/​xml/​model/​film/​FilmDIGENERATED.xml</​wrap>​.\\ \\ For example, open file <wrap adicode>​$projectDirectory/​resources/​xml/​model/​film/​FilmDIGENERATED.xml</​wrap>​.\\ \\
 **Following XML elements:** **Following XML elements:**
-<sxh xml; first-line: ​10; title: excerpt from '​FilmDIGENERATED.axml'​ file.>+<sxh xml; first-line: ​1; title: excerpt from '​FilmDIGENERATED.axml'​ 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"​ 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"/>​         <​formattedText editPattern="######"​ format="​Short"​ property="​filmId"​ enabled="​false"​ id="​filmId"/>​
-        <refText property="​languageByOriginalLanguageId"​ style="​SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.DELETE_BUTTON"​ id="​languageByOriginalLanguageId">​+        <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>​             <​convertModelToTarget>​return null==value ? &​quot;&​quot;​ : #​FV().name;</​convertModelToTarget>​
         </​refText>​         </​refText>​
-        <refText property="​languageByLanguageId"​ mandatory="​true"​ style="​SWT.BORDER | AdiSWT.FIND_BUTTON"​ id="​languageByLanguageId">​+        <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>​             <​convertModelToTarget>​return null==value ? &​quot;&​quot;​ : #​FV().name;</​convertModelToTarget>​
         </​refText>​         </​refText>​
Line 23: Line 32:
         <text textLimit="​255"​ property="​imageUrl"​ id="​imageUrl"/>​         <text textLimit="​255"​ property="​imageUrl"​ id="​imageUrl"/>​
         <​dateText property="​lastUpdate"​ mandatory="​true"​ style="​SWT.BORDER | SWT.TIME"​ id="​lastUpdate"/>​         <​dateText property="​lastUpdate"​ mandatory="​true"​ style="​SWT.BORDER | SWT.TIME"​ id="​lastUpdate"/>​
 +    </​section>​
 +</​includeTree>​
 </​sxh>​\\ </​sxh>​\\
 **renders the following layout:**\\ **renders the following layout:**\\
 {{ film_detail_generated.jpg | Film detail (brute)}} {{ film_detail_generated.jpg | Film detail (brute)}}
 \\ \\ \\ \\ \\ \\
-**Change ​with XML elements** +**Change XML elements** 
-<sxh xml; first-line: ​10; highlight: [29,​30,​31,​32,​33];​ title: excerpt from '​FilmDI.axml'​ file (new version).>​ +  * Copy <wrap adicode>​FilmDIGENERATED.axml</​wrap>​ file to <wrap adicode>​FilmDI.axml</​wrap>​ which will become the reference for generated code. 
-<​formattedText editPattern="######"​ format="​Short"​ property="​filmId"​ enabled="​false"​ id="​filmId"/>​ +  * Replace above XML lines with the following ones: 
-<text textLimit="​255"​ property="​title"​ mandatory="​true"​ id="​title"/>​ +<sxh xml; first-line: ​1; highlight: [15,29,​30,​31,​32,​33];​ title: excerpt from '​FilmDI.axml'​ file (new version).>​ 
-<text layoutData="​span 3" textLimit="​255"​ property="​description"​ id="​description"/>​ +<?xml version="​1.0"​ encoding="​UTF-8"​ standalone="​yes"?>​ 
-<​composite layoutData="​newline,​ grow, push, span 4" id="​bottomComposite">​ +<​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">​ 
- <layout layoutConstraints="​wrap 2" columnConstraints="​[fill,​ grow][fill, grow]" rowConstraints="​[fill,​ grow, al top]"/>​ +    <section text="#​MSG(film,​ detailSectionText)"​ style="​Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED"​ id="​detailSection">​ 
- <​imageViewer imageType="​Url"​ fitCanvas="​true"​ toolBarStyle="​AdiSWT.DELETE_BUTTON | AdiSWT.EXPANDABLE | AdiSWT.EDITABLE"​ noLabel="​true"​ layoutData="​hmax 300" property="​imageUrl"​ id="​imageUrl"/>​ +        <layout layoutConstraints="​wrap 4" columnConstraints="​[fill,​ align right]10[fill,​grow]25[align right]10[fill,​grow]"/>​ 
- <​composite id="​fieldComposite">​ +        <include adiResourceURI="#​PARAM(TOOL_BAR)"​ id="​detailToolbarMenu">​ 
-     ​<layout layoutConstraints="​wrap 2" columnConstraints="​[align right]10[fill,​grow]"/>​ +            <​params>​ 
-     ​<refText property="​languageByOriginalLanguageId"​ style="​SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.DELETE_BUTTON"​ id="​languageByOriginalLanguageId">​ +                <param id="​CONTROLLER"​ value="#​CONTROLLER(detailSection)"/>​ 
-           ​<​convertModelToTarget>​return null==value ? &​quot;&​quot;​ : #​FV().name;</​convertModelToTarget>​ +            </​params>​ 
-     ​</​refText>​ +        </​include>​ 
-     ​<refText property="​languageByLanguageId"​ mandatory="​true"​ style="​SWT.BORDER | AdiSWT.FIND_BUTTON"​ id="​languageByLanguageId">​ + <​formattedText editPattern="######"​ format="​Short"​ property="​filmId"​ enabled="​false"​ id="​filmId"/>​ 
-           ​<​convertModelToTarget>​return null==value ? &​quot;&​quot;​ : #​FV().name;</​convertModelToTarget>​ + <text textLimit="​255"​ property="​title"​ mandatory="​true"​ id="​title"/>​ 
-     ​</​refText>​ + <text layoutData="​span 3" textLimit="​255"​ property="​description"​ id="​description"/>​ 
-     ​<ccombo values="​G,​ PG, PG-13, R, NC-17" style="​SWT.READ_ONLY | SWT.BORDER"​ property="​rating"​ id="​rating"/>​ + <​composite layoutData="​newline,​ grow, push, span 4" id="​bottomComposite">​ 
-     ​<​checkBox text="#​BUNDLE(film,​forRent)"​ property="​forRent"​ noLabel="​true"​ style="​SWT.CHECK"​ id="​forRent"/>​ +     <layout layoutConstraints="​wrap 2" columnConstraints="​[fill,​ grow][fill, grow]" rowConstraints="​[fill,​ grow, al top]"/>​ 
-     ​<​composite id="​forRentComposite">​ +     <​imageViewer imageType="​Url"​ fitCanvas="​true"​ toolBarStyle="​AdiSWT.DELETE_BUTTON | AdiSWT.EXPANDABLE | AdiSWT.EDITABLE"​ noLabel="​true"​ layoutData="​hmax 300" property="​imageUrl"​ id="​imageUrl"/>​ 
-         ​<layout layoutConstraints="​wrap 1, ins 0, hidemode 3" columnConstraints="​[fill,​ grow]"/>​ +     <​composite id="​fieldComposite">​ 
-         ​<pgroup text="#​BUNDLE(Film,​forRent)"​ id="​forRentGroup"​ dirtyManagement="​false">​ +         <layout layoutConstraints="​wrap 2" columnConstraints="​[align right]10[fill,​grow]"/>​ 
-        ​  ​   ​<​dynamicClause listenedFieldId="​forRent">​ +         <refText property="​languageByOriginalLanguageId"​ style="​SWT.BORDER | AdiSWT.FIND_BUTTON ​| AdiSWT.EDITOR_BUTTON ​| AdiSWT.DELETE_BUTTON"​ id="​languageByOriginalLanguageId">​ 
-            ​  ​   ​<​conditionCode>#​BEAN().getForRent()</​conditionCode>​ +               <​convertModelToTarget>​return null==value ? &​quot;&​quot;​ : #​FV().name;</​convertModelToTarget>​ 
-            ​  ​   ​<​postCode>#​CONTROLLER(fieldComposite).getComposite().layout();​+         </​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>​ #​CONTROLLER(detailSection).reflow();</​postCode>​
-            ​</​dynamicClause>​ +                 </​dynamicClause>​ 
-        ​  ​   ​<layout layoutConstraints="​wrap 2" columnConstraints="​[align right]10[fill,​grow]"/>​ +                 <layout layoutConstraints="​wrap 2" columnConstraints="​[align right]10[fill,​grow]"/>​ 
-        ​  ​   ​<​formattedText editPattern="######"​ format="​Short"​ property="​rentalDuration"​ mandatory="​true"​ id="​rentalDuration"/>​ +                 <​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="​rentalRate"​ mandatory="​true"​ style="​SWT.BORDER | SWT.RIGHT"​ id="​rentalRate"/>​ 
-        ​  ​   ​<​numericText pattern="###​.##"​ property="​replacementCost"​ mandatory="​true"​ style="​SWT.BORDER | SWT.RIGHT"​ id="​replacementCost"/>​ +                 <​numericText pattern="###​.##"​ property="​replacementCost"​ mandatory="​true"​ style="​SWT.BORDER | SWT.RIGHT"​ id="​replacementCost"/>​ 
-    ​  ​   ​</​pgroup>​ +             </​pgroup>​ 
-     ​</​composite>​ +         </​composite>​ 
-     ​<​formattedText editPattern="######"​ format="​Short"​ property="​length"​ id="​length"/>​ +         <​formattedText editPattern="######"​ format="​Short"​ property="​length"​ id="​length"/>​ 
-     ​<text textLimit="​54"​ property="​specialFeatures"​ id="​specialFeatures"/>​ +         <text textLimit="​54"​ property="​specialFeatures"​ id="​specialFeatures"/>​ 
-     ​<​dateText property="​lastUpdate"​ enabled="​false"​ style="​SWT.BORDER | SWT.TIME"​ id="​lastUpdate"/>​ +         <​dateText property="​lastUpdate"​ enabled="​false"​ style="​SWT.BORDER | SWT.TIME"​ id="​lastUpdate"/>​ 
- </​composite>​ +     </​composite>​ 
-</​composite>​+ </​composite
 +    </​section>​ 
 +</​includeTree>
 </​sxh>​ </​sxh>​
 ** renders the new layout:**\\ ** renders the new layout:**\\
 {{tutorial:​entity_editor:​1_detail.jpg | Film detail (improved)}} {{tutorial:​entity_editor:​1_detail.jpg | Film detail (improved)}}
-\\+\\ \\ 
 +<WRAP INDIC><​wrap adititle>​Remarks</​wrap>:​\\ 
 +It is easy to change completely <wrap adicode>​FilmDI.axml</​wrap>​ layouts. ​   
 +</​WRAP>​
  
-<WRAP INDIC><​wrap adititle>​Remark</​wrap>:​\\ 
-Lines 29-32 show how to create a dynamic block. '​**forRentGroup**'​ pgroup is created only when field **forRent** is set to **true**.</​WRAP>​ 
tutorial/improve_film_detail.1424080427.txt.gz · Last modified: 2015/09/30 16:46 (external edit)