(OFBIZ-7532)
To display a number we had different possibilities :
* on ftl use the template <@ofbizAmount and <@ofbizCurrency
* by java call a function UtilFormatOut.formatAmount, UtilFormatOut.formatPrice, UtilFormatOut.formatQuantity, etc..
* by form widget, use <display type=accounting-number for accounting but nothing for other
To simplify and homogenize all, I implemented a number type purpose :
* default: display a number by default, use when no purpose is present
* quantity: display a number as a quantity
* amount: display a number as an amount (like price without currency)
* spelled: litteral displaying for a number (use on <@ofbizAmount ftl only before)
* percentage: display a number as a percentage
* accounting: diplay a number for accounting specific
Each purpose can be associate to a number for displaying it :
* on ftl <@ofbizNumber number=value format=purpose/>
* on java UtilFormatOut.formatNumber(value, purpose, delegator, locale)
* on form widget <display type=number format=purpose/>
The format use by a purpose is define on framework/common/config/number.properties with the template
.displaying.format = ##0.00
With this, you can surchage a configuration, create your own purpose or surchage only one through entity SystemProperty.
Concerning the backware compatibility:
* For the ftl the template <@ofbizAmount is now a link to '<@ofbizNumber format=amount'
* For java all previous function call UtilFormatOut.formatNumber with the matching purpose
* For form xml accounting-number is managed as an exection
Last point, display a currency is different that a number, so I didn't refactoring some code for this case (only move properties from general to number for centralize de configuration on the same file)
Thanks Charles Steltzlen to start the refactoring
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1864832 13f79535-47bb-0310-9956-ffa450edef68
90 lines
4.5 KiB
XML
90 lines
4.5 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" type="single" 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" type="single" 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" type="list" list-name="demoList" paginate-target="${demoTargetUrl}" separate-columns="true"
|
|
odd-row-style="${altRowStyle}" header-row-style="${headerStyle}" default-table-style="${tableStyle}">
|
|
<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>
|
|
|
|
</forms>
|