Files
ofbiz-framework/framework/webtools/widget/MiscScreens.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

242 lines
15 KiB
XML

<!--
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.
-->
<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Widget-Screen" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Screen http://ofbiz.apache.org/dtds/widget-screen.xsd">
<screen name="viewdatafile">
<section>
<actions>
<set field="headerItem" value="main"/>
<set field="titleProperty" value="WebtoolsDataFileMainTitle"/>
<set field="tabButtonItem" value="data"/>
<script location="component://webtools/groovyScripts/datafile/ViewDataFile.groovy"/>
</actions>
<widgets>
<decorator-screen name="CommonImportExportDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<screenlet>
<platform-specific><html><html-template location="component://webtools/template/datafile/ViewDataFile.ftl"/></html></platform-specific>
</screenlet>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="WebtoolsLayoutDemo">
<!-- Demonstrates UI layout best practices and serves as a visual theme test jig.
For more information:
https://cwiki.apache.org/confluence/display/OFBIZ/User+Interface+Layout+Best+Practices
https://cwiki.apache.org/confluence/display/OFBIZ/HTML+and+CSS+Best+Practices
https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+maincss.css+HTML+Element+Collection+Styles?src=search
-->
<section>
<actions>
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
<set field="titleProperty" value="WebtoolsLayoutDemo"/>
<set field="headerItem" value="LayoutDemo"/>
<set field="tabButtonItem" value="Selected"/>
<set field="demoText" from-field="uiLabelMap.WebtoolsLayoutDemoText" global="true"/>
<set field="errorMessage" from-field="demoText" global="true"/>
<set field="eventMessage" from-field="demoText" global="true"/>
<set field="demoTargetUrl" value="WebtoolsLayoutDemo"/>
<set field="demoParam1" value="one"/>
<set field="demoParam2" value="two"/>
<set field="demoParam3" value="three"/>
<set field="demoMap.name" from-field="uiLabelMap.WebtoolsLayoutDemo"/>
<set field="demoMap.description" from-field="uiLabelMap.WebtoolsLayoutDemoText"/>
<set field="demoMap.dropDown" value="Y"/>
<set field="demoMap.checkBox" value="Y"/>
<set field="demoMap.radioButton" value="Y"/>
<set field="demoList[]" from-field="demoMap"/>
<set field="demoList[]" from-field="demoMap"/>
<set field="demoList[]" from-field="demoMap"/>
<set field="altRowStyle" value=""/>
<set field="headerStyle" value="header-row-1"/>
<set field="tableStyle" value="basic-table light-grid"/>
<set field="mainDecoratorName" from-field="mainDecoratorName" default-value="main-decorator"/>
<set field="webtoolsLayoutDemoLabelTitle" from-field="webtoolsLayoutDemoLabelTitle" default-value="WebtoolsLayoutDemo"/>
</actions>
<widgets>
<decorator-screen name="${mainDecoratorName}" location="${parameters.mainDecoratorLocation}">
<decorator-section name="pre-body">
<section>
<condition>
<and>
<if-has-permission permission="OFBTOOLS" action="_VIEW"/>
</and>
</condition>
<widgets>
<include-menu name="LayoutDemo" location="component://webtools/widget/Menus.xml"/>
</widgets>
</section>
</decorator-section>
<decorator-section name="body">
<section>
<condition>
<if-has-permission permission="OFBTOOLS" action="_VIEW"/>
</condition>
<widgets>
<section name="Standard Page Start">
<widgets>
<container style="page-title">
<label style="h1" text="${uiLabelMap.${webtoolsLayoutDemoLabelTitle}}"/>
</container>
<container style="button-bar button-style-1">
<!-- Typically used for intra-app links -->
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonNew}" style="create" />
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonDelete}" style="delete"/>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonRefresh}" style="refresh"/>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonSearch}" style="search"/>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonSelected}" style="selected"/>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonEnabled}"/>
<link text="${uiLabelMap.CommonDisabled}" style="disabled"/>
</container>
<container style="button-bar button-style-2">
<!-- Typically used for inter-app links -->
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonNew}" style="create" link-type="auto">
<parameter param-name="demoParam1"/>
<parameter param-name="demoParam2"/>
<parameter param-name="demoParam3"/>
</link>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonDelete}" style="delete" link-type="anchor">
<parameter param-name="demoParam1"/>
<parameter param-name="demoParam2"/>
<parameter param-name="demoParam3"/>
</link>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonRefresh}" style="refresh" link-type="hidden-form">
<parameter param-name="demoParam1"/>
<parameter param-name="demoParam2"/>
<parameter param-name="demoParam3"/>
</link>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonSearch}" style="search">
<parameter param-name="demoParam1"/>
<parameter param-name="demoParam2"/>
<parameter param-name="demoParam3"/>
</link>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonSelected}" style="selected">
<parameter param-name="demoParam1"/>
<parameter param-name="demoParam2"/>
<parameter param-name="demoParam3"/>
</link>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonEnabled}">
<parameter param-name="demoParam1"/>
<parameter param-name="demoParam2"/>
<parameter param-name="demoParam3"/>
</link>
<link text="${uiLabelMap.CommonDisabled}" style="disabled">
<parameter param-name="demoParam1"/>
<parameter param-name="demoParam2"/>
<parameter param-name="demoParam3"/>
</link>
</container>
</widgets>
</section>
<section name="h1-h6 Styles">
<widgets>
<horizontal-separator/>
<label style="h1" text="${demoText} (h1)"/>
<label style="h2" text="${demoText} (h2)"/>
<label style="h3" text="${demoText} (h3)"/>
<label style="h4" text="${demoText} (h4)"/>
<label style="h5" text="${demoText} (h5)"/>
<label style="h6" text="${demoText} (h6)"/>
</widgets>
</section>
<section name="Form/List Styles">
<widgets>
<horizontal-separator/>
<include-grid name="LayoutDemoSimpleGrid" location="component://webtools/widget/MiscForms.xml"/>
<include-form name="LayoutDemoList" location="component://webtools/widget/MiscForms.xml"/>
<include-form name="LayoutDemoInLineList" location="component://webtools/widget/MiscForms.xml"/>
</widgets>
</section>
<section name="Screenlet Styles">
<widgets>
<horizontal-separator/>
<screenlet>
<label text="${demoText}"/>
</screenlet>
<screenlet title="${uiLabelMap.WebtoolsLayoutDemo}" padded="false">
<!-- For aligning screenlet body h3 elements with screenlet title h3 elements -->
<label style="h3" text="${demoText}"/>
</screenlet>
<screenlet title="${uiLabelMap.WebtoolsLayoutDemo}" id="screenlet-demo" collapsible="true">
<include-grid name="LayoutDemoSimpleGrid" location="component://webtools/widget/MiscForms.xml"/>
</screenlet>
<screenlet title="${uiLabelMap.WebtoolsLayoutDemo}" padded="false">
<include-grid name="LayoutDemoBasicGrid" location="component://webtools/widget/MiscForms.xml"/>
</screenlet>
<screenlet title="${uiLabelMap.WebtoolsLayoutDemo}" padded="false">
<section>
<actions>
<set field="viewSize" value="1" type="Integer"/>
</actions>
<widgets/>
</section>
<container style="button-bar button-style-1">
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonNew}" style="create"/>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonSelected}" style="selected"/>
<link target="${demoTargetUrl}" text="${uiLabelMap.CommonEnabled}"/>
<link text="${uiLabelMap.CommonDisabled}" style="disabled"/>
</container>
<include-form name="LayoutDemoList" location="component://webtools/widget/MiscForms.xml"/>
</screenlet>
</widgets>
</section>
</widgets>
<fail-widgets>
<label style="h3">${uiLabelMap.WebtoolsViewPermissionError}</label>
</fail-widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="WebtoolsLayoutDemoFop">
<section>
<actions>
<set field="mainDecoratorName" value="SimpleDecorator"/>
<set field="webtoolsLayoutDemoLabelTitle" value="WebtoolsViewAsPdfTheHtmlLayoutDemo"/>
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
</actions>
<widgets>
<include-screen name="WebtoolsLayoutDemo"/>
</widgets>
</section>
</screen>
<screen name="WebtoolsLayoutDemoText">
<section>
<actions>
<set field="mainDecoratorName" value="SimpleDecorator"/>
<set field="webtoolsLayoutDemoLabelTitle" value="WebtoolsViewAsTextTheHtmlLayoutDemo"/>
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
</actions>
<widgets>
<include-screen name="WebtoolsLayoutDemo"/>
</widgets>
</section>
</screen>
</screens>