Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

8. View Definition Example



productsList.xml

Code Block
themeEclipse
languagexmlthemeEclipse
linenumberstrue

<qcd:views plugin="products"
<?xml version="1.0" encoding="UTF-8"?>

<view xmlns:qcdxsi="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>
		



productDetails.xml

Code Block
themeEclipse
languagexml
linenumberstrue

<?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"
	modelName="product">

	<component type="formwindow" name="product" reference="form">
                             <script>
                                    <![CDATA[
                                        var save 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>
						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="61" width="3" height="6">
								<component type="grid" name="substituteComponents"
									source="#{substitutes}.components">
									<component<option type="gridcolumn" name="substituteComponentsnumber" fields="product"
										source="#{substitutes}.components">
	expression="#product['number']" link="true" width="50"/>
									<option type="column" name="numbername" fields="product"
											expression="#product['numbername']" link="true" width="50100"/>
									<option type="column" name="quantity" fields="quantity" width="40"/>
									<option type="column" name="nameunit" fields="product"
											expression="#product['nameunit']" link="truefalse" width="10030"/>
										<option type="column" name="quantityorder" fieldscolumn="quantitynumber" widthdirection="40desc"/>
										<option type="columncorrespondingView" namevalue="unitproducts/substituteComponent" fields="product"/>
											expression<option type="#product['unit']correspondingComponent" linkvalue="falseform" width="30"/>
										<option type="ordercorrespondingViewInModal" columnvalue="number" direction="desc"true" />
										<option type="correspondingViewpaginable" value="products/substituteComponentfalse" />
										<option type="correspondingComponentcreatable" value="formtrue" />
										<option type="correspondingViewInModaldeletable" value="true" />
										<option type="paginablefullscreen" value="falsetrue" />
										<option type="creatablemultiselect" value="true" />
								</component>
		<option type="deletable" value="true" />					</layoutElement>
						</component>
					</component>
				</layoutElement>
			</component>
			<option type="fullscreenheader" value="true" />
										<option type="multiselectexpression" value="true#name" />
									</component>
								</layoutElement>
							</component>
					
	</component>
	<hooks>
				</layoutElement>
				</component>
				<option type="header" value="true"/>
				<option type="expression" value="#name" />
			</component>
		</component>
		<preRenderHook bean="com.qcadoo.mes.products.ProductService" method="generateProductNumber" />
	</view>
	<view <beforeRender class="com.qcadoo.mes.products.ProductService" method="generateProductNumber" />
	</hooks>
</view>



productSubstituteDetails.xml

Code Block
themeEclipse
languagexml
linenumberstrue

<?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="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>/component>
			<option type="header" value="true"/>
					<layoutElement<option columntype="1expression" rowvalue="2#name" 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 </component>
	</component>
</view>



productSubstituteComponentDetails.xml

Code Block
themeEclipse
languagexml
linenumberstrue

<?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="'&lt;b&gt;' + #number + '&lt;/b&gt; - ' + #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>