You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2020/02/20 13:51:07 UTC

[ofbiz-framework] 03/04: Improved: Add CommonForms as template pattern configured by theme (OFBIZ-11335)

This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 38f972a0d0c0865b1d6fc5cf7bc71c50b4873355
Author: Nicolas Malin <ni...@nereide.fr>
AuthorDate: Thu Feb 20 14:49:11 2020 +0100

    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 1941a05a349865b8505ec373de3fce3b3a96c2a0.
    
    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.
---
 framework/common/groovyScripts/InitTheme.groovy    |  1 +
 framework/common/widget/CommonForms.xml            | 40 +++++++++++++++
 framework/webtools/widget/MiscForms.xml            | 60 ++++++++++++++++++++--
 framework/webtools/widget/MiscScreens.xml          | 34 ++----------
 framework/widget/dtd/widget-theme.xsd              | 58 +++++++++++++--------
 .../org/apache/ofbiz/widget/model/ModelForm.java   |  2 +-
 .../org/apache/ofbiz/widget/model/ModelTheme.java  | 32 +++++++++++-
 themes/common-theme/widget/CommonForms.xml         | 37 +++++++++++++
 themes/common-theme/widget/Theme.xml               | 10 ++++
 9 files changed, 217 insertions(+), 57 deletions(-)

diff --git a/framework/common/groovyScripts/InitTheme.groovy b/framework/common/groovyScripts/InitTheme.groovy
index 1481c62..be1afb0 100644
--- a/framework/common/groovyScripts/InitTheme.groovy
+++ b/framework/common/groovyScripts/InitTheme.groovy
@@ -31,6 +31,7 @@ else visualTheme = ThemeFactory.resolveVisualTheme(context.request?:null)
 if (visualTheme) {
     ModelTheme modelTheme = visualTheme.getModelTheme()
     globalContext.commonScreenLocations = modelTheme.getModelCommonScreens()
+    globalContext.commonFormLocations = modelTheme.getModelCommonForms()
     globalContext.visualTheme = visualTheme
     globalContext.modelTheme = modelTheme
 
diff --git a/framework/common/widget/CommonForms.xml b/framework/common/widget/CommonForms.xml
new file mode 100644
index 0000000..9d5bd30
--- /dev/null
+++ b/framework/common/widget/CommonForms.xml
@@ -0,0 +1,40 @@
+<?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">
+
+    <grid name="CommonSimpleGrid" extends="CommonSimpleGrid" extends-resource="${groovy:
+    commonFormLocations.CommonSimpleGrid ?: 'component://common-theme/widget/CommonForms.xml'}"/>
+    <grid name="CommonBasicGrid" extends="CommonBasicGrid" extends-resource="${groovy:
+    commonFormLocations.CommonBasicGrid ?: 'component://common-theme/widget/CommonForms.xml'}"/>
+
+    <form name="CommonSimpleList" extends="CommonSimpleList" extends-resource="${groovy:
+    commonFormLocations.CommonSimpleList ?: 'component://common-theme/widget/CommonForms.xml'}"/>
+    <form name="CommonBasicList" extends="CommonBasicList" extends-resource="${groovy:
+    commonFormLocations.CommonBasicList ?: 'component://common-theme/widget/CommonForms.xml'}"/>
+    <form name="CommonInLineEditList" extends="CommonInLineEditList" extends-resource="${groovy:
+    commonFormLocations.CommonInLineEditList ?: 'component://common-theme/widget/CommonForms.xml'}"/>
+
+    <form name="CommonBasicSingle" extends="CommonBasicSingle" extends-resource="${groovy:
+    commonFormLocations.CommonBasicSingle ?: 'component://common-theme/widget/CommonForms.xml'}"/>
+
+
+</forms>
diff --git a/framework/webtools/widget/MiscForms.xml b/framework/webtools/widget/MiscForms.xml
index 1d72e5b..22ab232 100644
--- a/framework/webtools/widget/MiscForms.xml
+++ b/framework/webtools/widget/MiscForms.xml
@@ -20,14 +20,16 @@ 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">
+    <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" type="single" target="${demoTargetUrl}" default-map-name="demoMap">
+    <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>
@@ -62,8 +64,30 @@ under the License.
         </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}">
+    <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}">
@@ -86,4 +110,32 @@ under the License.
         </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>
diff --git a/framework/webtools/widget/MiscScreens.xml b/framework/webtools/widget/MiscScreens.xml
index 7c75796..e60abfa 100644
--- a/framework/webtools/widget/MiscScreens.xml
+++ b/framework/webtools/widget/MiscScreens.xml
@@ -164,24 +164,9 @@ under the License.
                                 <section name="Form/List Styles">
                                     <widgets>
                                         <horizontal-separator/>
-                                        <include-form name="LayoutDemoForm" location="component://webtools/widget/MiscForms.xml"/>
-                                        <include-form name="LayoutDemoList" location="component://webtools/widget/MiscForms.xml"/>
-                                        <section>
-                                            <actions>
-                                                <set field="tableStyle" value="basic-table dark-grid"/>
-                                            </actions>
-                                            <widgets/>
-                                        </section>
-                                        <include-form name="LayoutDemoList" location="component://webtools/widget/MiscForms.xml"/>
-                                        <section>
-                                            <actions>
-                                                <set field="altRowStyle" value="alternate-row"/>
-                                                <set field="headerStyle" value="header-row-2"/>
-                                                <set field="tableStyle" value="basic-table hover-bar"/>
-                                            </actions>
-                                            <widgets/>
-                                        </section>
+                                        <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">
@@ -195,25 +180,14 @@ under the License.
                                             <label style="h3" text="${demoText}"/>
                                         </screenlet>
                                         <screenlet title="${uiLabelMap.WebtoolsLayoutDemo}" id="screenlet-demo" collapsible="true">
-                                            <include-form name="LayoutDemoForm" location="component://webtools/widget/MiscForms.xml"/>
+                                            <include-grid name="LayoutDemoSimpleGrid" location="component://webtools/widget/MiscForms.xml"/>
                                         </screenlet>
                                         <screenlet title="${uiLabelMap.WebtoolsLayoutDemo}" padded="false">
-                                            <section>
-                                                <actions>
-                                                    <set field="altRowStyle" value="alternate-row"/>
-                                                    <set field="headerStyle" value="header-row-1"/>
-                                                    <set field="tableStyle" value="basic-table light-grid hover-bar"/>
-                                                </actions>
-                                                <widgets/>
-                                            </section>
-                                            <include-form name="LayoutDemoList" location="component://webtools/widget/MiscForms.xml"/>
+                                            <include-grid name="LayoutDemoBasicGrid" location="component://webtools/widget/MiscForms.xml"/>
                                         </screenlet>
                                         <screenlet title="${uiLabelMap.WebtoolsLayoutDemo}" padded="false">
                                             <section>
                                                 <actions>
-                                                    <set field="altRowStyle" value="alternate-row"/>
-                                                    <set field="headerStyle" value="header-row-2"/>
-                                                    <set field="tableStyle" value="basic-table hover-bar"/>
                                                     <set field="viewSize" value="1" type="Integer"/>
                                                 </actions>
                                                 <widgets/>
diff --git a/framework/widget/dtd/widget-theme.xsd b/framework/widget/dtd/widget-theme.xsd
index 40fd549..3362cef 100644
--- a/framework/widget/dtd/widget-theme.xsd
+++ b/framework/widget/dtd/widget-theme.xsd
@@ -27,6 +27,7 @@ under the License.
                 <xs:element minOccurs="0" maxOccurs="1" ref="theme-properties"/>
                 <xs:element minOccurs="0" maxOccurs="1" ref="templates"/>
                 <xs:element minOccurs="0" maxOccurs="1" ref="common-screens"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="common-forms"/>
                 <xs:element minOccurs="0" maxOccurs="1" ref="common-menus"/>
             </xs:sequence>
             <xs:attribute type="xs:string" name="name" use="required" />
@@ -125,9 +126,9 @@ under the License.
             </xs:sequence>
         </xs:complexType>
     </xs:element>
-        <xs:annotation><xs:documentation>
-            This element contains all properties dedicate with the theme technology
-        </xs:documentation></xs:annotation>
+    <xs:annotation><xs:documentation>
+        This element contains all properties dedicate with the theme technology
+    </xs:documentation></xs:annotation>
     <xs:element name="property">
         <xs:complexType>
             <xs:attribute type="xs:string" name="name" use="required">
@@ -146,9 +147,9 @@ under the License.
             </xs:sequence>
         </xs:complexType>
     </xs:element>
-        <xs:annotation><xs:documentation>
-            This element contains all ftl macro template supported by this theme
-        </xs:documentation></xs:annotation>
+    <xs:annotation><xs:documentation>
+        This element contains all ftl macro template supported by this theme
+    </xs:documentation></xs:annotation>
     <xs:element name="template">
         <xs:complexType>
             <xs:sequence>
@@ -163,20 +164,20 @@ under the License.
         </xs:complexType>
     </xs:element>
     <xs:element name="template-file">
-    <xs:complexType>
-        <xs:attribute name="widget" use="required" >
-            <xs:simpleType>
-                <xs:restriction base="xs:token">
-                    <xs:enumeration value="screen" />
-                    <xs:enumeration value="form" />
-                    <xs:enumeration value="tree" />
-                    <xs:enumeration value="menu" />
-                    <xs:enumeration value="error" />
-                </xs:restriction>
-            </xs:simpleType>
-        </xs:attribute>
-        <xs:attribute type="xs:string" name="location" use="required"/>
-    </xs:complexType>
+        <xs:complexType>
+            <xs:attribute name="widget" use="required" >
+                <xs:simpleType>
+                    <xs:restriction base="xs:token">
+                        <xs:enumeration value="screen" />
+                        <xs:enumeration value="form" />
+                        <xs:enumeration value="tree" />
+                        <xs:enumeration value="menu" />
+                        <xs:enumeration value="error" />
+                    </xs:restriction>
+                </xs:simpleType>
+            </xs:attribute>
+            <xs:attribute type="xs:string" name="location" use="required"/>
+        </xs:complexType>
     </xs:element>
     <xs:element name="common-screens">
         <xs:annotation><xs:documentation>
@@ -190,6 +191,16 @@ under the License.
             </xs:sequence>
         </xs:complexType>
     </xs:element>
+    <xs:element name="common-forms">
+        <xs:annotation><xs:documentation>
+            List the location of each common forms that the theme implement
+        </xs:documentation></xs:annotation>
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="root-decorator" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
     <xs:element name="common-menus">
         <xs:annotation><xs:documentation>
             List the location of each common menus that the theme implement
@@ -204,6 +215,7 @@ under the License.
         <xs:complexType>
             <xs:choice>
                 <xs:element maxOccurs="unbounded" ref="screen"/>
+                <xs:element maxOccurs="unbounded" ref="form"/>
                 <xs:element maxOccurs="unbounded" ref="menu"/>
             </xs:choice>
             <xs:attribute type="xs:string" name="default-location" use="optional" />
@@ -231,6 +243,12 @@ under the License.
             <xs:attribute type="xs:string" name="location" use="optional"/>
         </xs:complexType>
     </xs:element>
+    <xs:element name="form">
+        <xs:complexType>
+            <xs:attribute type="xs:string" name="name" use="required"/>
+            <xs:attribute type="xs:string" name="location" use="optional"/>
+        </xs:complexType>
+    </xs:element>
     <xs:element name="menu">
         <xs:complexType>
             <xs:attribute type="xs:string" name="name" use="required"/>
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java
index e9a139a..5c8d9c9 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java
@@ -1330,7 +1330,7 @@ public abstract class ModelForm extends ModelWidget {
     }
 
     public String getTarget() {
-        return target.getOriginal();
+        return target != null ? target.getOriginal() : null;
     }
 
     /** iterate through altTargets list to see if any should be used, if not return original target
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java
index b9e93e2..8230161 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java
@@ -74,6 +74,7 @@ public class ModelTheme implements Serializable {
     //template rendering
     private final Map<String, ModelTemplate> modelTemplateMap;
     private final Map<String, String> modelCommonScreensMap;
+    private final Map<String, String> modelCommonFormsMap;
     private final Map<String, String> modelCommonMenusMap;
 
     /**
@@ -87,6 +88,7 @@ public class ModelTheme implements Serializable {
         Map<String, Object> initThemePropertiesMap = new HashMap<>();
         Map<String, ModelTemplate> initModelTemplateMap = new HashMap<>();
         Map<String, String> initModelCommonScreensMap = new HashMap<>();
+        Map<String, String> initModelCommonFormsMap = new HashMap<>();
         Map<String, String> initModelCommonMenusMap = new HashMap<>();
 
         // first resolve value from the origin theme
@@ -123,6 +125,9 @@ public class ModelTheme implements Serializable {
             if (originTheme.modelCommonScreensMap != null) {
                 initModelCommonScreensMap = UtilMisc.makeMapWritable(originTheme.modelCommonScreensMap);
             }
+            if (originTheme.modelCommonFormsMap != null) {
+                initModelCommonFormsMap = UtilMisc.makeMapWritable(originTheme.modelCommonFormsMap);
+            }
             if (originTheme.modelCommonMenusMap != null) {
                 initModelCommonMenusMap = UtilMisc.makeMapWritable(originTheme.modelCommonMenusMap);
             }
@@ -173,6 +178,23 @@ public class ModelTheme implements Serializable {
                         }
                     }
                     break;
+                case "common-forms":
+                    for (Element formPurpose : UtilXml.childElementList(childElement)) {
+                        String defaultLocation = formPurpose.getAttribute("default-location");
+                        for (Element form : UtilXml.childElementList(formPurpose)) {
+                            String name = form.getAttribute("name");
+                            String location = form.getAttribute("location");
+                            if (UtilValidate.isEmpty(location)) {
+                                location = defaultLocation;
+                            }
+                            if (UtilValidate.isEmpty(location)) {
+                                Debug.logWarning("We can resolve the form location " + name + " in the theme " + this.name + " so no added it", module);
+                                continue;
+                            }
+                            initModelCommonFormsMap.put(name, location);
+                        }
+                    }
+                    break;
                 case "common-menus":
                     for (Element menuPurpose : UtilXml.childElementList(childElement)) {
                         String defaultLocation = menuPurpose.getAttribute("default-location");
@@ -209,6 +231,7 @@ public class ModelTheme implements Serializable {
         this.themePropertiesMap = Collections.unmodifiableMap(initThemePropertiesMap);
         this.modelTemplateMap = Collections.unmodifiableMap(initModelTemplateMap);
         this.modelCommonScreensMap = Collections.unmodifiableMap(initModelCommonScreensMap);
+        this.modelCommonFormsMap = Collections.unmodifiableMap(initModelCommonFormsMap);
         this.modelCommonMenusMap = Collections.unmodifiableMap(initModelCommonMenusMap);
     }
 
@@ -401,7 +424,12 @@ public class ModelTheme implements Serializable {
     public Map<String,String> getModelCommonScreens() {
         return modelCommonScreensMap;
     }
-    public Map<String,String> getModelCommonMenus() { return modelCommonMenusMap; }
+    public Map<String,String> getModelCommonForms() {
+        return modelCommonFormsMap;
+    }
+    public Map<String,String> getModelCommonMenus() {
+        return modelCommonMenusMap;
+    }
 
     /**
      * the ModelTemplate class, manage the complexity of macro library definition and the rendering technology
@@ -467,7 +495,7 @@ public class ModelTheme implements Serializable {
          * @param currentModelTemplate
          * @param originModelTemplate
          */
-        public ModelTemplate (ModelTemplate currentModelTemplate, ModelTemplate originModelTemplate) {
+        public ModelTemplate(ModelTemplate currentModelTemplate, ModelTemplate originModelTemplate) {
             boolean exist = currentModelTemplate != null;
             this.name = exist ? currentModelTemplate.name : originModelTemplate.name;
             this.type = exist ? currentModelTemplate.type : originModelTemplate.type;
diff --git a/themes/common-theme/widget/CommonForms.xml b/themes/common-theme/widget/CommonForms.xml
new file mode 100644
index 0000000..40aace9
--- /dev/null
+++ b/themes/common-theme/widget/CommonForms.xml
@@ -0,0 +1,37 @@
+<?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">
+
+
+    <grid name="CommonSimpleGrid" default-table-style="basic-table dark-grid"/>
+    <grid name="CommonBasicGrid"  default-table-style="basic-table hover-bar"
+          odd-row-style="alternate-row" header-row-style="header-row-2"/>
+
+    <form name="CommonSimpleList" type="list" default-table-style="basic-table dark-grid"/>
+    <form name="CommonBasicList"  type="list" default-table-style="basic-table hover-bar"
+          odd-row-style="alternate-row" header-row-style="header-row-2"/>
+    <form name="CommonInLineEditList" type="list" default-table-style="basic-table hover-bar"
+          odd-row-style="alternate-row" header-row-style="header-row-2" separate-columns="true"/>
+
+    <form name="CommonBasicSingle" type="single"/>
+
+</forms>
diff --git a/themes/common-theme/widget/Theme.xml b/themes/common-theme/widget/Theme.xml
index e289532..9ead18d 100644
--- a/themes/common-theme/widget/Theme.xml
+++ b/themes/common-theme/widget/Theme.xml
@@ -165,6 +165,16 @@ under the License.
             <screen name="ShowHelp" location="component://common-theme/widget/HelpScreens.xml"/>
         </generic-screen>
     </common-screens>
+    <common-forms><!--list all common form to each application that each theme can be surcharge or not and use the form present on common theme-->
+        <root-decorator default-location="component://common-theme/widget/CommonForms.xml">
+            <form name="CommonSimpleGrid"/>
+            <form name="CommonBasicGrid"/>
+            <form name="CommonSimpleList"/>
+            <form name="CommonBasicList"/>
+            <form name="CommonInLineEditList"/>
+            <form name="CommonBasicSingle"/>
+        </root-decorator>
+    </common-forms>
     <common-menus><!--list all common menu to each application that each theme can be surcharge or not and use the menu present on common theme-->
         <root-decorator default-location="component://common-theme/widget/CommonMenus.xml">
             <menu name="CommonAppBarMenu"/>