Differences
This shows you the differences between two versions of the page.
tutorial:improve_filmdesc_detail [2020/04/16 10:56] |
tutorial:improve_filmdesc_detail [2020/04/16 10:56] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | File <wrap adicode>$projectDirectory/resources/xml/model/film/FilmDescDIGENERATED.xml</wrap> describes the layout of <wrap adicode>FilmDesc</wrap> entity linked to a <wrap adicode>Film</wrap> entity (OneToOne relationship).. | ||
+ | |||
+ | **Following XML elements:** | ||
+ | <sxh xml; first-line: 10; title: excerpt from 'FilmDescDIGENERATED.axml' file.> | ||
+ | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
+ | <includeTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" XMLSchema-instance" coreClassName="org.adichatz.engine.core.ASectionCore" entityURI="adi:/entityURI="adi://myproject/model.filmDesc/FilmDescMM" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/includeTree.xsd"> | ||
+ | <section text="#MSG(filmDesc, detailContainerText)" style="Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED" id="detailContainer"> | ||
+ | <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("ONE_TO_ONE", #ENTITY_MM(adi://myproject/model.film/FilmMM).getFieldMap().get("filmDesc"));</code> | ||
+ | </listener> | ||
+ | </listeners> | ||
+ | <layout layoutConstraints="wrap 4" columnConstraints="[fill, align right]10[fill,grow]25[align right]10[fill,grow]"/> | ||
+ | <include adiResourceURI="getToolBarURI((String) #PARAM(TOOL_BAR_TYPE))" id="detailToolbarMenu"> | ||
+ | <params> | ||
+ | <param value="#CONTROLLER(detailContainer)" id="CONTROLLER"/> | ||
+ | <param optional="true" value="#PARAM(TOOL_BAR_TYPE)" id="TOOL_BAR_TYPE"/> | ||
+ | </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> | ||
+ | </sxh>\\ | ||
+ | **renders the following layout:**\\ | ||
+ | {{ filmdesc_detail_generated.jpg | FilmDescription detail (brute)}} | ||
+ | \\ \\ \\ | ||
+ | **Change XML elements** | ||
+ | * Copy <wrap adicode>FilmDescDIGENERATED.axml</wrap> file to <wrap adicode>FilmDescDI.axml</wrap> which will become the reference for generated code. | ||
+ | * Replace above XML lines with the following ones: | ||
+ | <sxh xml; first-line: 10; highlight: [32,33]; title: excerpt from 'FilmDescDI.axml' file (new version).> | ||
+ | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
+ | <includeTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" coreClassName="org.adichatz.engine.core.ASectionCore" entityURI="adi://myproject/model.filmDesc/FilmDescMM" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/includeTree.xsd"> | ||
+ | <section text="#MSG(filmDesc, detailContainerText)" style="Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED" id="detailContainer"> | ||
+ | <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("ONE_TO_ONE", #ENTITY_MM(adi://myproject/model.film/FilmMM).getFieldMap().get("filmDesc"));</code> | ||
+ | </listener> | ||
+ | </listeners> | ||
+ | <layout layoutConstraints="wrap 4" columnConstraints="[fill, align right]10[fill,grow]25[align right]10[fill,grow]"/> | ||
+ | <include adiResourceURI="getToolBarURI((String) #PARAM(TOOL_BAR_TYPE))" id="detailToolbarMenu"> | ||
+ | <params> | ||
+ | <param value="#CONTROLLER(detailContainer)" id="CONTROLLER"/> | ||
+ | <param optional="true" value="#PARAM(TOOL_BAR_TYPE)" id="TOOL_BAR_TYPE"/> | ||
+ | </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> | ||
+ | </sxh> | ||
+ | ** renders the new layout:**\\ | ||
+ | {{ filmdesc_detail.jpg | FilmDesc detail (improved)}} | ||
+ | <WRAP indic> | ||
+ | <wrap adititle>Remark</wrap>:\\ | ||
+ | File <wrap adicode>FilmDescDIGENERATED.axml</wrap> is copied as file <wrap adicode>FilmDescDI.axml</wrap>, so that, if a generation process occurs, changes will not be affected. | ||
+ | * Line 32: <wrap adicode>description</wrap> property field is managed in a <wrap adicode>ExtraText controller</wrap>. | ||
+ | * Line 33: <wrap adicode>image</wrap> property field is managed in a <wrap adicode>ImageViewer controller</wrap>. | ||
+ | </WRAP> | ||