File $projectDirectory/resources/xml/model/film/CustomerDIGENERATED.xml describes the layout of Customer entity.
Following XML elements:
<?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.customer/CustomerMM" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/includeTree.xsd"> <section text="#MSG(customer, detailContainerText)" style="Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED" id="detailContainer"> <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="customerId" enabled="false" id="customerId"/> <refText property="address" mandatory="true" style="SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.EDITOR_BUTTON" id="address"> <convertModelToTarget>return null==value ? "" : #FV().address + " " + #FV().city.city + " - " + #FV().city.country.country;</convertModelToTarget> </refText> <refText property="store" lazyFetches="store" mandatory="true" style="SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.EDITOR_BUTTON" id="store"> <convertModelToTarget>return null==value ? "" : String.valueOf(#FV().getStoreId());</convertModelToTarget> </refText> <text textLimit="45" property="firstName" mandatory="true" id="firstName"/> <text textLimit="45" property="lastName" mandatory="true" id="lastName"/> <text textLimit="50" property="email" id="email"/> <checkBox property="active" mandatory="true" style="SWT.CHECK" id="active"/> <dateText property="createDate" mandatory="true" style="SWT.BORDER | SWT.TIME" id="createDate"/> <dateText property="lastUpdate" mandatory="true" style="SWT.BORDER | SWT.TIME" id="lastUpdate"/> </section> </includeTree>
renders the following layout:
Change XML elements
- Copy CustomerDIGENERATED.axml file to CustomerDI.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" XMLSchema-instance" coreClassName="org.adichatz.engine.core.ASectionCore" entityURI="adi:/entityURI="adi://myproject/model.customer/CustomerMM" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/includeTree.xsd"> <section text="#MSG(customer, detailContainerText)" style="Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED" id="detailContainer"> <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="customerId" enabled="false" id="customerId"/> <refText property="address" mandatory="true" style="SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.EDITOR_BUTTON" id="address"> <convertModelToTarget>return null==value ? "" : #FV().address + " " + #FV().city.city + " - " + #FV().city.country.country;</convertModelToTarget> <params> <param id="CONTEXT_MENU" value="adi://org.adichatz.jpa/common.contextMenu/RefTextDialogPlusCM"/> <param id="POPUP_SIZE " value="600,400"/> <param xsi:type="customizationsType" id="NEW_ENTITY_POPUP_CUSTOMIZATION"> <text layoutData="wmin 400" id="detailINC:name"/> </param> </params> </refText> <refText property="store" lazyFetches="store" mandatory="true" style="SWT.BORDER | AdiSWT.FIND_BUTTON | AdiSWT.EDITOR_BUTTON" id="store"> <convertModelToTarget>return null==value ? "" : String.valueOf(#FV().getStoreId());</convertModelToTarget> </refText> <text textLimit="45" property="firstName" mandatory="true" id="firstName"/> <text textLimit="45" property="lastName" mandatory="true" id="lastName"/> <text textLimit="50" property="email" id="email"/> <checkBox property="active" mandatory="true" style="SWT.CHECK" id="active"/> <dateText property="createDate" mandatory="true" style="SWT.BORDER | SWT.TIME" id="createDate"/> <dateText property="lastUpdate" mandatory="true" style="SWT.BORDER | SWT.TIME" id="lastUpdate"/> </section> </includeTree>
Create editor file for Customer as shown:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <partTree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bindingServiceClassName="org.adichatz.engine.e4.resource.PartBindingService" entityURI="adi://myproject/model.customer/CustomerMM" image="#PARAM(IMAGE)" outlinePageClassName="org.adichatz.jpa.editor.EditorOutlinePage" title="#PARAM(TITLE)" toolTipText="#PARAM(TOOL_TIP_TEXT)" xsi:noNamespaceSchemaLocation="http://www.adichatz.org/xsd/v0.8.7/generator/partTree.xsd"> <config> <customizations> <tableColumn id="rentalsTSI:customerTC" valid="false"/> <tabular refreshAtStart="true" id="rentalsTSI:table"> <listeners> <listener id="rentalsTSIDCLsnr" listenerTypes="DOUBLE_CLICK"> <code>org.adichatz.jpa.extra.JPAUtil.openForm(getFromRegister("rentalsTSI:table"));</code> </listener> <listener id="rentalsTSISCLsnr" listenerTypes="SELECTION_CHANGED"> <code>#CONTROLLER(dependenciesCompositeBag).showChildController(#CONTROLLER(), #CONTROLLER(rentalsDIPart:detailContainer));</code> </listener> </listeners> <include adiResourceURI="adi://org.adichatz.jpa/common.contextMenu/ChildCM" id="rentalsCM"/> <contentProvider xsi:type="entitySetContentProviderType" fieldName="rentals" adiResourceURI="adi://myproject/model.rental/RentalQUERY" id="rentalsCP"/> </tabular> <section id="rentalsDIPart:detailContainer"> <layout layoutConstraints="wrap 2" columnConstraints="[fill, align right]10[fill,grow]"/> </section> <controlField id="rentalsDIPart:customer" valid="false"/> <tableColumn id="paymentsTSI:customerTC" valid="false"/> <tabular refreshAtStart="true" id="paymentsTSI:table"> <listeners> <listener id="paymentsTSIDCLsnr" listenerTypes="DOUBLE_CLICK"> <code>org.adichatz.jpa.extra.JPAUtil.openForm(getFromRegister("paymentsTSI:table"));</code> </listener> <listener id="paymentsTSISCLsnr" listenerTypes="SELECTION_CHANGED"> <code>#CONTROLLER(dependenciesCompositeBag).showChildController(#CONTROLLER(), #CONTROLLER(paymentsDIPart:detailContainer));</code> </listener> </listeners> <include adiResourceURI="adi://org.adichatz.jpa/common.contextMenu/ChildCM" id="paymentsCM"/> <contentProvider xsi:type="entitySetContentProviderType" fieldName="payments" adiResourceURI="adi://myproject/model.payment/PaymentQUERY" id="paymentsCP"/> </tabular> <section id="paymentsDIPart:detailContainer"> <layout layoutConstraints="wrap 2" columnConstraints="[fill, align right]10[fill,grow]"/> </section> <controlField id="paymentsDIPart:customer" valid="false"/> </customizations> <navigationPaths> <navigationPath name="#MSG(customer, editFormTitle)" path="Page1"/> <navigationPath name="#MSG(customer, rentals)" path="Page1, DependenciesTabFolder, rentalsItem"/> <navigationPath name="#MSG(customer, payments)" path="Page1, DependenciesTabFolder, paymentsItem"/> </navigationPaths> </config> <formPage formText="#MSG(customer, editFormText)" image="#IMG(adi://org.adichatz.engine/./IMG_DETAIL.png)" title="#MSG(customer, editFormText)" id="Page1"> <include adiResourceURI="adi://org.adichatz.jpa/common.toolBar/OnePageMasterDetailTBM" id="masterDetailTBM"/> <sashForm weights="3,2" id="firstSashForm"> <layout layoutConstraints="wrap 2, ins 0" columnConstraints="[grow,fill][grow,fill]" rowConstraints="grow,fill"/> <sashForm orientation="SWT.HORIZONTAL" weights="1,1" id="secondSashForm"> <scrolledComposite id="detailComposite"> <listeners> <listener listenerTypes="AFTER_SYNCHRONIZE | AFTER_PROPERTY_CHANGE | POST_REFRESH"> <code>displayGMap();</code> </listener> </listeners> <additionalCode>import org.adichatz.engine.widgets.gmaps.GMap; private boolean doit = true; private void displayGMap() { if (doit) { doit = false; GMap gmapControl = #CONTROL(map); Customer customer = #BEAN(); if (null != customer.getAddress()) { StringBuffer addresSB = new StringBuffer(); addresSB.append(customer.getAddress()).append(" "); addresSB.append(customer.getAddress().getCity().getCity()).append(" "); addresSB.append(customer.getAddress().getCity().getCountry().getCountry()); gmapControl.setValue(addresSB.toString().trim()); } else gmapControl.setValue(null); doit = true; } }</additionalCode> <layout layoutConstraints="wrap 1, ins 0" columnConstraints="[grow,fill]" rowConstraints="grow,fill"/> <include adiResourceURI="adi://model.customer/CustomerDI" id="customerDetail"> <params> <param id="TOOL_BAR" value="adi://org.adichatz.jpa/common.toolBar/DetailTBM"/> </params> </include> </scrolledComposite> <composite id="gmapComposite"> <layout layoutConstraints="wrap 1, ins 0" columnConstraints="grow,fill" rowConstraints="grow,fill"/> <gMap editable="false" toolBarStyle="AdiSWT.EXPANDABLE" zoom="14" id="map"/> </composite> </sashForm> <sashForm orientation="SWT.HORIZONTAL" weights="1,1" id="dependenciesSashForm"> <composite id="tableComposite"> <layout layoutConstraints="wrap 1, ins 0" columnConstraints="[grow,fill]" rowConstraints="grow,fill"/> <cTabFolder delayed="true" selection="0" id="DependenciesTabFolder"> <listeners> <listener id="DependenciesTabFolderWSLsnr" listenerTypes="WIDGET_SELECTED"> <code>#CONTROLLER(dependenciesCompositeBag).showChildController(getSelectedController());</code> </listener> </listeners> <cTabItem text="#MSG(customer, rentals)" entityURI="adi://myproject/model.rental/RentalMM" id="rentalsItem"> <include adiResourceURI="adi://model.rental/RentalTI" id="rentalsTSI"/> </cTabItem> <cTabItem text="#MSG(customer, payments)" entityURI="adi://myproject/model.payment/PaymentMM" id="paymentsItem"> <include adiResourceURI="adi://model.payment/PaymentTI" id="paymentsTSI"/> </cTabItem> </cTabFolder> </composite> <compositeBag id="dependenciesCompositeBag"> <include adiResourceURI="adi://model.rental/RentalDI" id="rentalsDIPart"> <params> <param id="TOOL_BAR" value="adi://org.adichatz.jpa/common.toolBar/ChildDetailTBM"/> </params> </include> <include adiResourceURI="adi://model.payment/PaymentDI" id="paymentsDIPart"> <params> <param id="TOOL_BAR" value="adi://org.adichatz.jpa/common.toolBar/ChildDetailTBM"/> </params> </include> </compositeBag> </sashForm> </sashForm> </formPage> </partTree>
Remark:
File CustomerDIGENERATED.axml is copied as file CustomerDI.axml and File CustomerEDITORGENERATED.axml is copied as file CustomerEDITOR.axml. So that, if a generation process occurs, changes will not be affected.
Change completely layouts is made easy.