...
8. View Definition Example
//
//
file1
...
productsList.xml
Code Block |
---|
theme | Eclipse |
---|
language | xml | theme | Eclipse |
---|
linenumbers | true |
---|
|
<view name<?xml version="products1.0" modelencoding="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" />
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="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="namenumber" fields="namenumber" link="true"
width="300150" />
<option type="column" name="typeOfMaterialname" fields="typeOfMaterialname" />link="true"
<option typewidth="column300" name="/>
<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>
|
productDetails.xml
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
themelinenumbers | Eclipse | linenumbers | true |
---|
|
<view name<?xml version="product1.0" modelencoding="productUTF-8"?>
<component type="window" name="window">
<ribbon>
<group template="navigation"/>
<group template="formSaveCopyAndRemoveActions"/>
<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"
modelName="product">
<component type="window" name="window">
<ribbon>
<group template="navigation"/>
<group template="formSaveCopyAndRemoveActions"/>
</ribbon>
<component type="form" name="product" reference="form">
<script>
<![CDATA[
var save = #{window}.getRibbonItem("actions.save");
this.addOnChangeListener({
onSetValue: function(value) {
if (value && value.content && !value.content.entityId) {
save.disable();
}
}
});
]]>
</script>
<script>
<![CDATA[
var save = #{window}.getRibbonItem("actions.save");
this.addOnChangeListener({
onSetValue: function(value) {
if (value && value.content && !value.content.entityId) {
save.disable();
}
}
});
]]>
</script>
<component type="gridLayout" name="gridLayout" columns="3" rows="11">
<layoutElement column="1" row="1">
<component type="input" name="number" field="number" reference="number" />
</layoutElement>
<layoutElement column="1" row="2">
<component type="textarea" name="name" field="name" hasDescription="true" />
</layoutElement>
<layoutElement column="1" row="3">
<component type="select" name="typeOfMaterial" field="typeOfMaterial" />
</layoutElement>
<layoutElement column="1" row="4">
<component type="select" name="unit" field="unit" />
</layoutElement>
<layoutElement column="2" row="1">
<component type="input" name="ean" field="ean" />
</layoutElement>
<layoutElement column="2" row="2">
<component type="select" name="category" field="category" />
</layoutElement>
<layoutElement column="2" row="3">
<component type="input" name="batch" field="batch" />
</layoutElement>
<layoutElement column="2" row="4">
<component type="checkbox" name="genealogyBatchReq" field="genealogyBatchReq">
<option type="labelWidth" value="60" />
</component>
</layoutElement>
<layoutElement column="1" row="5" width="3" height="7">
<component type="borderLayout" name="substitutesBorderLayout" reference="substitutesBorderLayout">
<option type="label" value="substitutesBorderLayoutLabel" />
<component type="gridLayout" name="gridsLayout" columns="5" rows="6" hasBorders="false">
<layoutElement column="1" row="1" width="2" height="6">
<component type="grid" name="substitutes" reference="substitutes" source="#{form}.substitutes">
<option type="column" name="number" fields="number" link="true" width="50"/>
<option type="column" name="name" fields="name" link="true" width="100"/>
<option type="order" column="priority" direction="asc"/>
<option type="correspondingView" value="products/substitute" />
<option type="correspondingComponent" value="form" />
<option type="correspondingViewInModal" value="true" />
<option type="paginable" value="false" />
<option type="creatable" value="true" />
<option type="deletable" value="true" />
<option type="fullscreen" value="true" />
<option type="multiselect" value="true" />
</component>
</layoutElement>
<layoutElement column="3" row="1" width="3" height="6">
<component type="grid" name="substituteComponents"
source="#{substitutes}.components">
<option type="column" name="number" fields="product"
expression="#product['number']" link="true" width="50"/>
<option type="column" name="name" fields="product"
expression="#product['name']" link="true" width="100"/>
<option type="column" name="quantity" fields="quantity" width="40"/>
<option type="column" name="unit" fields="product"
expression="#product['unit']" link="false" width="30"/>
<option type="order" column="number" direction="desc"/>
<option type="correspondingView" value="products/substituteComponent" />
<option type="correspondingComponent" value="form" />
<option type="correspondingViewInModal" value="true" />
<option type="paginable" value="false" />
<option type="creatable" value="true" />
<option type="deletable" value="true" />
<option type="fullscreen" value="true" />
<option type="multiselect" value="true" />
</component>
</layoutElement>
</component>
</component>
</layoutElement>
</component>
<option type="header" value="true"/>
<option type="expression" value="#name" />
</layoutElement>component>
</component>
<hooks>
<option<beforeRender typeclass="headercom.qcadoo.mes.products.ProductService" valuemethod="truegenerateProductNumber" />
<option type="expression" value="#name" />
</component>
</component>
<preRenderHook bean="com.qcadoo.mes.products.ProductService" method="generateProductNumber" />
</view>
|
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<view </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"
model modelName="substitute">
<component type="window" name="window">
<ribbon>
<group template="navigation"/>
<group template="formSaveAndRemoveActions"/>
</ribbon>
<component type="form" name="substitute" reference="form">
<component type="form" name="substitute" reference="form">
="gridLayout" name="gridLayout" columns="1" rows="3">
<layoutElement column="1" row="1">
<component type="gridLayoutinput" name="gridLayoutnumber" columnsfield="1number" rows="3"/>
</layoutElement>
<layoutElement column="1" row="1"2" height="2">
<component type="inputtextarea" name="numbername" field="numbername" />
</layoutElement>
<layoutElement column="1" row="2" height="2"</component>
<option type="header" value="true"/>
<component<option type="textareaexpression" namevalue="name#name" field="name" />
</layoutElement>
</component>
<option type="header" value="true"/>
<option type="expression" value="#name" />
</component>
</component>
</view>
|
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
linenumbers | true |
---|
|
<view </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"
model 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" />
</hooks>
</view>
|