Files
ofbiz-framework/framework/webtools/widget/MiscForms.xml
T
Nicolas Malin 38f972a0d0 Improved: Add CommonForms as template pattern configured by theme
(OFBIZ-11335)

Currently on OFBiz we implemented a process to define some different
screen and menu that can be implemented by the theming.
But for the form we have nothing. All style are hard coded on each

    <grid name="ListEntities" ...
      odd-row-style="alternate-row" default-table-style="basic-table hover-bar">

I extend the theming implementation principle to forms element with adding :
 * a new xsd element common-forms (like common-screens)
 * some default form templates to extend :
   * grid CommonSimpleGrid
   * grid CommonBasicGrid
   * form CommonSimpleList
   * form CommonBasicList
   * form CommonInLineEditList
   * form CommonBasicSingle

We can use its like :

    <form name="LayoutDemoList" extends="CommonBasicList"
          extends-resource="component://common/widget/CommonForms.xml"

The main difficulty raise to this task was propage the visualTheme during
the ModelForm intanciation, because we need to load wiget style
(and some other information wanted on the template) on model load in memory.
This is cover by commit 1941a05a34.

Forms present on the screen https://localhost:8443/webtools/control/WebtoolsLayoutDemo
are now extend through with theme.

Finally with this we can extend style form (pagination, header, line and so on ...)
directly by your theme without change the framework.
2020-02-20 14:49:11 +01:00

142 lines
8.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
<form name="ProgramExport" extends="CommonBasicSingle" extends-resource="component://common/widget/CommonForms.xml"
target="ProgramExport" default-map-name="parameters">
<field name="groovyProgram" required-field="true">
<textarea cols="120" rows="20" />
</field>
<field name="submitButton" title="${uiLabelMap.CommonRun}"><submit button-type="button"/></field>
</form>
<form name="LayoutDemoForm" extends="CommonBasicSingle" extends-resource="component://common/widget/CommonForms.xml"
target="${demoTargetUrl}" default-map-name="demoMap">
<actions>
<set field="numberValue" value="-9.958"/>
</actions>
<field name="name" title="${uiLabelMap.CommonName}" required-field="true">
<text />
</field>
<field name="description" title="${uiLabelMap.CommonDescription}"><text/></field>
<field name="default"><display type="number" description="${numberValue}"/></field>
<field name="quantity"><display type="number" format="quantity" description="${numberValue}"/></field>
<field name="amount"><display type="number" format="amount" description="${numberValue}"/></field>
<field name="spelled"><display type="number" format="spelled-out" description="${numberValue}"/></field>
<field name="percentage"><display type="number" format="percentage" description="${numberValue}"/></field>
<field name="accounting"><display type="number" format="accounting" description="${numberValue}"/></field>
<field name="dropDown" title="${uiLabelMap.CommonEnabled}">
<drop-down>
<option key="Y" description="${uiLabelMap.CommonYes}" />
<option key="N" description="${uiLabelMap.CommonNo}" />
</drop-down>
</field>
<field name="checkBox" title="${uiLabelMap.CommonEnabled}">
<check/>
</field>
<field name="radioButton" title="${uiLabelMap.CommonEnabled}">
<radio>
<option key="Y" description="${uiLabelMap.CommonYes}" />
<option key="N" description="${uiLabelMap.CommonNo}" />
</radio>
</field>
<field name="submitButton" title="${uiLabelMap.CommonSave}"><submit button-type="button"/></field>
<field name="cancelButton" title=" " widget-style="smallSubmit">
<hyperlink description="${uiLabelMap.CommonCancel}" target="${demoTargetUrl}"/>
</field>
</form>
<form name="LayoutDemoList" extends="CommonBasicList" extends-resource="component://common/widget/CommonForms.xml"
list-name="demoList" paginate-target="${demoTargetUrl}">
<field name="name" title="${uiLabelMap.CommonName}"><display/></field>
<!-- <field name="description" title="${uiLabelMap.CommonDescription}"><text/></field>-->
<field name="dropDown" title="${uiLabelMap.CommonEnabled}">
<drop-down>
<option key="Y" description="${uiLabelMap.CommonYes}" />
<option key="N" description="${uiLabelMap.CommonNo}" />
</drop-down>
</field>
<!-- <field name="checkBox" title="${uiLabelMap.CommonEnabled}">-->
<!-- <check/>-->
<!-- </field>-->
<!-- <field name="radioButton" title="${uiLabelMap.CommonEnabled}">-->
<!-- <radio>-->
<!-- <option key="Y" description="${uiLabelMap.CommonYes}" />-->
<!-- <option key="N" description="${uiLabelMap.CommonNo}" />-->
<!-- </radio>-->
<!-- </field>-->
<!-- <field name="updateButton" widget-style="button-col"><submit/></field>-->
</form>
<form name="LayoutDemoInLineList" extends="CommonInLineEditList" extends-resource="component://common/widget/CommonForms.xml"
list-name="demoList" paginate-target="${demoTargetUrl}">
<field name="name" title="${uiLabelMap.CommonName}"><display/></field>
<field name="description" title="${uiLabelMap.CommonDescription}"><text/></field>
<field name="dropDown" title="${uiLabelMap.CommonEnabled}">
<drop-down>
<option key="Y" description="${uiLabelMap.CommonYes}" />
<option key="N" description="${uiLabelMap.CommonNo}" />
</drop-down>
</field>
<field name="checkBox" title="${uiLabelMap.CommonEnabled}">
<check/>
</field>
<field name="radioButton" title="${uiLabelMap.CommonEnabled}">
<radio>
<option key="Y" description="${uiLabelMap.CommonYes}" />
<option key="N" description="${uiLabelMap.CommonNo}" />
</radio>
</field>
<field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="button-col">
<submit button-type="button"/>
</field>
</form>
<grid name="LayoutDemoSimpleGrid" extends="CommonSimpleGrid" extends-resource="component://common/widget/CommonForms.xml"
list-name="demoList" paginate-target="${demoTargetUrl}">
<actions>
<set field="numberValue" value="876.543"/>
</actions>
<field name="name" title="${uiLabelMap.CommonName}"><display/></field>
<field name="description" title="${uiLabelMap.CommonDescription}"><display/></field>
<field name="default"><display type="number" description="${numberValue}"/></field>
<field name="quantity"><display type="number" format="quantity" description="${numberValue}"/></field>
<field name="amount"><display type="number" format="amount" description="${numberValue}"/></field>
<field name="spelled"><display type="number" format="spelled-out" description="${numberValue}"/></field>
<field name="percentage"><display type="number" format="percentage" description="${numberValue}"/></field>
<field name="accounting"><display type="number" format="accounting" description="${numberValue}"/></field>
</grid>
<grid name="LayoutDemoBasicGrid" extends="CommonBasicGrid" extends-resource="component://common/widget/CommonForms.xml"
list-name="demoList" paginate-target="${demoTargetUrl}">
<actions>
<set field="numberValue" value="789.1230"/>
</actions>
<field name="name" title="${uiLabelMap.CommonName}"><display/></field>
<field name="description" title="${uiLabelMap.CommonDescription}"><display/></field>
<field name="default"><display type="number" description="${numberValue}"/></field>
<field name="quantity"><display type="number" format="quantity" description="${numberValue}"/></field>
<field name="amount"><display type="number" format="amount" description="${numberValue}"/></field>
<field name="spelled"><display type="number" format="spelled-out" description="${numberValue}"/></field>
<field name="percentage"><display type="number" format="percentage" description="${numberValue}"/></field>
<field name="accounting"><display type="number" format="accounting" description="${numberValue}"/></field>
</grid>
</forms>