A combined patch from Adrian's, James Yong's and my work for "Add Support For Compound Screen Widget XML Files" - https://issues.apache.org/jira/browse/OFBIZ-4090 and "Add Example for Compound Screen Widget" - https://issues.apache.org/jira/browse/OFBIZ-6990

Adrian: This adds the ability to include screen widgets, form widgets, menu widgets, and simple methods in a single XML file. This approach could be used in situations where the widgets share a logical grouping - so they can be kept in one place.

James: An example to test out Compound Screen Widget

jlerouxc: here are the changes and tests globally
# As James mentionned we no longer need *-v2.xsd files, I removed them from Adrian's patch
# I created a compound-widgets.xsd based on Adrian's and James Yong's previous work. From Paul Foxworthy's comment in OFBIZ-4090, I decided to name the root compound-widgets (hence the file name). I arranged its elements in another way, see below with ExampleCompoundWidgets.xml
# I slightly modified James Yong's ExampleCompoundScreenWidget.xml file and renamed it ExampleCompoundWidgets.xml. I added an "s" because there are several OFBiz widgets gathered in one place. For the modifications: I simply changed the names and arranged the elements in another way which I find better suited. I'm used to 1st create the query, then the menus, the screens and their forms. We rarely use widget-trees but it's there also. Finally the simple-method at end if any. The order is not enforced though, so everybody can use her/his own :)
# I added a French label
# I completed the widget-catalog.xml with this new entry and tested locally in Eclipse by reloading the XML catalog entries.

I hope I did not miss nor mixed things, the local instance I used is a bit overcrowded with pending changes...




git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@1738958 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2016-04-13 15:38:16 +00:00
parent a87003c975
commit 44036fc73c
4 changed files with 123 additions and 0 deletions
@@ -0,0 +1,115 @@
<?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.
-->
<!-- This document serves as an example for Compound Screen Widget feature -->
<compound-widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/compound-widgets.xsd">
<site-conf xmlns="http://ofbiz.apache.org/Site-Conf" xsi:schemaLocation="http://ofbiz.apache.org/Site-Conf http://ofbiz.apache.org/dtds/site-conf.xsd">
<request-map uri="CompoundWidgets1">
<security https="true" auth="true"/>
<event type="simple" invoke="CompoundWidgetsFunc" path="component://example/widget/example/ExampleCompoundWidgets.xml"/>
<response name="success" type="view" value="CompoundWidgets1"/>
</request-map>
<request-map uri="CompoundWidgets2"><security https="true" auth="true"/><response name="success" type="view" value="CompoundWidgets2"/></request-map>
<view-map name="CompoundWidgets1" type="screen" page="component://example/widget/example/ExampleCompoundWidgets.xml#CompoundWidgets1"/>
<view-map name="CompoundWidgets2" type="screen" page="component://example/widget/example/ExampleCompoundWidgets.xml#CompoundWidgets2"/>
</site-conf>
<menus xmlns="http://ofbiz.apache.org/Widget-Menu" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Menu http://ofbiz.apache.org/dtds/widget-menu.xsd">
<menu name="CompoundWidgetsMenu" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
<menu-item name="Example1" title="${uiLabelMap.ExampleExample} 1">
<link target="CompoundWidgets1"/>
</menu-item>
<menu-item name="Example2" title="${uiLabelMap.ExampleExample} 2">
<link target="CompoundWidgets2"/>
</menu-item>
</menu>
</menus>
<screens 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="CompoundWidgets1">
<section>
<actions>
<set field="headerItem" value="ExampleCompoundWidgets" />
<set field="tabButtonItem" value="Example1"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="pre-body">
<include-menu name="CompoundWidgetsMenu" location="component://example/widget/example/ExampleCompoundWidgets.xml" />
</decorator-section>
<decorator-section name="body">
<section>
<widgets>
<container style="clear" />
<label>Demo For Compound Screen Widget</label>
<include-form location="component://example/widget/example/ExampleCompoundWidgets.xml" name="CompoundWidgetsForm1"/>
</widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="CompoundWidgets2">
<section>
<actions>
<set field="headerItem" value="ExampleCompoundWidgets" />
<set field="tabButtonItem" value="Example2"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="pre-body">
<include-menu name="CompoundWidgetsMenu" location="component://example/widget/example/ExampleCompoundWidgets.xml" />
</decorator-section>
<decorator-section name="body">
<section>
<widgets>
<container style="clear" />
<label>Demo For Compound Screen Widget</label>
<include-form location="component://example/widget/example/ExampleCompoundWidgets.xml" name="CompoundWidgetsForm2"/>
</widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
</screens>
<forms 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="CompoundWidgetsForm1">
<field name="exampleName" title="${uiLabelMap.FormFieldTitle_exampleName} 1" required-field="true"><text /></field>
</form>
<form name="CompoundWidgetsForm2">
<field name="exampleName" title="${uiLabelMap.FormFieldTitle_exampleName} 2" required-field="true"><text /></field>
</form>
</forms>
<simple-methods xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
<simple-method method-name="CompoundWidgetsFunc">
<log message="CompoundWidgetsFunc runs" level="info"/>
</simple-method>
</simple-methods>
</compound-widgets>