...
8. View Definition Example
...
productsList.xml
Code Block |
---|
theme | Eclipse |
---|
langlanguage | xml |
---|
| <qcd:views plugin="products" xmlns:qcd |
<?xml version="1.0" encoding="UTF-8"?>
<view xmlns:xsi="http://www.qcadoow3.com/view">
<view name="products" modelorg/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/view"
xsi:schemaLocation="http://schema.qcadoo.org/view http://schema.qcadoo.org/view.xsd"
name="products"
modelName="product"
menuAccessible="true">
<component type="window" name="window">
<ribbon>
<group template="gridNewCopyAndRemoveAction"/>
</ribbon>
<component type="grid" name="products" reference="grid">
<option type="column" name="number" fields="number" link="true"
width="150" />
<option type="column" name="name" fields="name" link="true"
width="300" />
<option type="column" name="typeOfMaterial" fields="typeOfMaterial" />
<option type="column" name="ean" fields="ean" />
<option type="order" column="name" direction="asc"/>
<option type="correspondingView" value="products/product" />
<option type="correspondingComponent" value="form" />
<option type="searchable" value="name,number,typeOfMaterial,ean" />
<option type="orderable" value="name,number,typeOfMaterial,ean" />
<option type="fullscreen" value="true" />
<option type="multiselect" value="true" />
</component>
<option type="fixedHeight" value="true" />
<option type="header" value="false" />
</component>
</view>
<view name="product" model="product">
<component type="window" name="window">
<ribbon>
<group template="navigation"/>
<group template="formSaveCopyAndRemoveActions"/>
</ribbon>
<component type="form"
|
productDetails.xml
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
linenumbers | true |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/view"
xsi:schemaLocation="http://schema.qcadoo.org/view http://schema.qcadoo.org/view.xsd"
name="product"
reference modelName="formproduct">
<component type="gridLayoutwindow" name="gridLayoutwindow" columns="3" rows="11">
<ribbon>
<group template="navigation"/>
<layoutElement<group columntemplate="1" row="1"formSaveCopyAndRemoveActions"/>
</ribbon>
<component type="inputform" name="number" field="numberproduct" reference="numberform" />
<script>
</layoutElement> <![CDATA[
<layoutElementvar save column="1" row="2"> #{window}.getRibbonItem("actions.save");
<component type="textarea" name="name" field="name" hasDescription="true" />
this.addOnChangeListener({
</layoutElement>onSetValue: function(value) {
<layoutElement column="1" row="3">
if (value && value.content && !value.content.entityId) {
<component type="select" name="typeOfMaterial" field="typeOfMaterial" />
save.disable();
}
</layoutElement>}
<layoutElement column="1" row="4"});
]]>
</script>
<component type="selectgridLayout" name="unitgridLayout" fieldcolumns="unit3" />
</layoutElement>
rows="11">
<layoutElement column="21" row="1">
<component type="input" name="eannumber" field="eannumber" reference="number" />
</layoutElement>
<layoutElement column="21" row="2">
<component type="selecttextarea" name="categoryname" field="name" hasDescription="categorytrue" />
</layoutElement>
<layoutElement column="21" row="3">
<component type="inputselect" name="batchtypeOfMaterial" field="batchtypeOfMaterial" />
</layoutElement>
<layoutElement column="21" row="4">
<component type="checkboxselect" name="genealogyBatchRequnit" field="genealogyBatchRequnit" />
</layoutElement>
<option<layoutElement typecolumn="labelWidth2" valuerow="601" />
</component><component type="input" name="ean" field="ean" />
</layoutElement>
<layoutElement column="12" row="52" width="3" height="7">
>
<component type="borderLayoutselect" name="substitutesBorderLayoutcategory" referencefield="substitutesBorderLayoutcategory" />
</layoutElement>
<option <layoutElement typecolumn="label2" valuerow="substitutesBorderLayoutLabel3" />
<component type="gridLayoutinput" name="gridsLayoutbatch" columnsfield="5batch" rows="6" hasBorders="false">
/>
</layoutElement>
<layoutElement column="12" row="1" width="2" height="6">
4">
<component type="gridcheckbox" name="substitutesgenealogyBatchReq" referencefield="substitutes" source="#{form}.substitutesgenealogyBatchReq">
<option type="columnlabelWidth" namevalue="number60" fields="number" link="true" width="50"/>
</component>
<option type="column" name="name" fields="name" link="true" width="100"/</layoutElement>
<layoutElement column="1" row="5" width="3" height="7">
<option<component type="orderborderLayout" columnname="prioritysubstitutesBorderLayout" directionreference="ascsubstitutesBorderLayout"/>
<option type="correspondingViewlabel" value="products/substitutesubstitutesBorderLayoutLabel" />
<option<component type="correspondingComponentgridLayout" valuename="formgridsLayout" />
<option type="correspondingViewInModal" value="true" /columns="5" rows="6" hasBorders="false">
<option type="paginable" value="false" /<layoutElement column="1" row="1" width="2" height="6">
<option<component type="grid" name="creatablesubstitutes" valuereference="truesubstitutes" /source="#{form}.substitutes">
<option type="deletablecolumn" valuename="truenumber" fields="number" link="true" width="50"/>
<option type="column" name="fullscreenname" fields="name" valuelink="true" width="100"/>
<option type="multiselectorder" valuecolumn="truepriority" direction="asc"/>
</component>
</layoutElement>
<option type="correspondingView" value="products/substitute" />
<layoutElement<option columntype="3correspondingComponent" rowvalue="1form" width="3" height="6"/>
<component<option type="gridcorrespondingViewInModal" namevalue="substituteComponentstrue" />
source="#{substitutes}.components"<option type="paginable" value="false" />
<option type="columncreatable" namevalue="numbertrue" fields="product"/>
expression<option type="#product['number']deletable" linkvalue="true" width="50"/>
<option type="columnfullscreen" namevalue="nametrue" fields="product"
/>
expression<option type="#product['name']multiselect" linkvalue="true" width="100"/>
</component>
</layoutElement>
<option <layoutElement typecolumn="column3" namerow="quantity1" fieldswidth="quantity3" widthheight="406"/>
>
<component type="grid" name="substituteComponents"
source="#{substitutes}.components">
<option type="column" name="unitnumber" fields="product"
expression="#product['unitnumber']" link="falsetrue" width="3050"/>
<option type="ordercolumn" columnname="numbername" directionfields="descproduct"/>
<option typeexpression="#product['name']" link="correspondingViewtrue" valuewidth="products/substituteComponent100" />
<option type="column" name="correspondingComponentquantity" valuefields="formquantity" width="40"/>
<option type="correspondingViewInModalcolumn" valuename="trueunit" />fields="product"
<option typeexpression="paginable#product['unit']" valuelink="false" width="30"/>
<option type="creatableorder" valuecolumn="truenumber" direction="desc"/>
<option type="deletablecorrespondingView" value="trueproducts/substituteComponent" />
<option type="fullscreencorrespondingComponent" value="trueform" />
<option type="multiselectcorrespondingViewInModal" value="true" />
</component>
</layoutElement><option type="paginable" value="false" />
</component>
</component>
</layoutElement>
<option type="creatable" value="true" />
</component>
<option type="headerdeletable" value="true" />
<option type="expressionfullscreen" value="#nametrue" />
</component>
</component>
<preRenderHook<option beantype="com.qcadoo.mes.products.ProductServicemultiselect" methodvalue="generateProductNumbertrue" />
</view>
<view name="substitute" model="substitute">
<component type="window" name="window">
<ribbon>
<group template="navigation"/>component>
</layoutElement>
</component>
</component>
<group template="formSaveAndRemoveActions"/></layoutElement>
</ribbon>component>
<component<option type="formheader" namevalue="substitute" reference="form"true"/>
<component<option type="gridLayoutexpression" namevalue="gridLayout#name" columns="1" rows="3"/>
</component>
</component>
<hooks>
<layoutElement<beforeRender columnclass="1com.qcadoo.mes.products.ProductService" rowmethod="1generateProductNumber" />
<component type="input" name="number" field="number" />
</layoutElement>
<layoutElement column="1" row="2" height="2">
<component type="textarea" name="name" field="name" />
</layoutElement>
</component>
<option type="header" value="true"/>
<option type="expression" value="#name" />
</component>
</component>
</view>
<view name="substituteComponent" model="substituteComponent">
</hooks>
</view>
|
productSubstituteDetails.xml
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
linenumbers | true |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/view"
xsi:schemaLocation="http://schema.qcadoo.org/view http://schema.qcadoo.org/view.xsd"
name="substitute"
modelName="substitute"
<component type="window" name="window">
<ribbon>
<group template="navigation"/>
<group template="formSaveAndRemoveActions"/>
</ribbon>
<component type="form" name="substitute" reference="form">
<component type="gridLayout" name="gridLayout" columns="1" rows="3">
<layoutElement column="1" row="1">
<component type="input" name="number" field="number" />
</layoutElement>
<layoutElement column="1" row="2" height="2">
<component type="textarea" name="name" field="name" />
</layoutElement>
</component>
<option type="header" value="true"/>
<option type="expression" value="#name" />
</component>
</component>
</view>
|
productSubstituteComponentDetails.xml
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
linenumbers | true |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/view"
xsi:schemaLocation="http://schema.qcadoo.org/view http://schema.qcadoo.org/view.xsd"
name="substituteComponent"
modelName="substituteComponent"
<component type="window" name="window">
<ribbon>
<group template="navigation"/>
<group template="formSaveAndRemoveActions"/>
</ribbon>
<component type="form" name="substituteComponent" reference="form">
<component type="gridLayout" name="gridLayout" columns="1" rows="3">
<layoutElement column="1" row="1">
<component type="lookup" name="product" field="product" reference="product">
<option type="column" name="name" fields="name" link="true"
width="200" />
<option type="column" name="ean" fields="ean" />
<option type="searchable" value="name,ean" />
<option type="orderable" value="name,ean" />
<option type="expression" value="'<b>' + #number + '</b> - ' + #name"/>
<option type="fieldCode" value="number" />
<listener event="onSelectedEntityChange" beanclass="com.qcadoo.mes.products.util.UnitService" method="fillProductUnit" />
</component>
</layoutElement>
<layoutElement column="1" row="2">
<component type="input" name="quantity" field="quantity" />
</layoutElement>
<layoutElement column="1" row="3">
<component type="input" name="unit" reference="unit" defaultEnabled="false" />
</layoutElement>
</component>
<option type="header" value="true"/>
<option type="expression" value="#product['name'] + ' x ' + #quantity" />
</component>
</component>
<hooks>
<preRenderHook<beforeRender beanclass="com.qcadoo.mes.products.util.UnitService" method="fillProductUnitPreRender" />
</view>hooks>
</qcd:views>view>
|