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 [[http://www.adichatz.org/document/FilmDI.xml|generated file]]).
For example, open file $projectDirectory/resources/xml/model/film/FilmDIGENERATED.xml.\\ \\
**Following XML elements:**
return null==value ? "" : #FV().name;
return null==value ? "" : #FV().name;
return #FV() < 1900 || #FV() > 2155;
return null == value ? null : ((java.math.BigDecimal) value).doubleValue();
return null == value ? null : new java.math.BigDecimal((Double) value);
return null == value ? null : ((java.math.BigDecimal) value).doubleValue();
return null == value ? null : new java.math.BigDecimal((Double) value);
\\
**renders the following layout:**\\
{{ tutorial:film_detail_generated.jpg?550 | 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:
return null==value ? "" : #FV().name;
return null==value ? "" : #FV().name;
#BEAN().isActive()
#CONTROLLER(detailContainer).reflowControllers();
** renders the new layout:**\\
{{tutorial:film_detail.jpg?550 | Film detail (improved)}}
Remarks:
|< 100% 10em - >|
^ Lines 15:|@#eff5fb:A **text controller** is trplced by an **ImageViewer controller** which displays an image for an URL.|
^ Lines 29-32:|@#eff5fb:show how to create a dynamic block. '**forRentGroup**' pgroup is created only when field **forRent** is set to **true**.|
\\
If you are using **pagila** postgresql datababase rather than **sakila** mysql, two changes must be done:\\
replace line **25** by following lines.
return ((#MODELPACKAGE().MpaaRatingEnum) element).getValue();
return java.util.Arrays.asList(#MODELPACKAGE().MpaaRatingEnum.values());
replace line **41** (line **46** after previous change) by following lines.
return java.util.Arrays.copyOf((Object[]) value, ((Object[]) value).length, String[].class);
//See page [[tutorial:improve_film_detail|Improve Film Detail (pagila)]].//
\\
Same method can be used for [[tutorial:improve_filmdesc_detail|FilmDescription]].
\\