Some improvements to the example component, and added an exampleext component which extends the example webapp to demonstrate extension and overide mechanisms; note that this works except for menu extension which doesn't appear to be working on the framework level

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@539833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David E. Jones
2007-05-20 06:39:54 +00:00
parent e5986a66c2
commit 583cfeed38
16 changed files with 427 additions and 102 deletions
@@ -41,6 +41,90 @@ under the License.
</section>
</screen>
<screen name="CommonExampleDecorator">
<section>
<actions>
<set field="headerItem" value="Example"/>
<set field="exampleId" from-field="parameters.exampleId"/>
<entity-one entity-name="Example" value-name="example"/>
</actions>
<widgets>
<decorator-screen name="main-decorator">
<decorator-section name="body">
<section>
<!-- do check for EXAMPLE, _VIEW permission -->
<condition>
<if-has-permission permission="EXAMPLE" action="_VIEW"/>
</condition>
<widgets>
<section>
<condition>
<not><if-empty field-name="example"/></not>
</condition>
<widgets>
<include-menu name="EditExample" location="component://example/widget/example/ExampleMenus.xml"/>
<container style="button-bar"><link target="EditExample" text="${uiLabelMap.ExampleNewExample}" style="buttontext"/></container>
<container style="button-bar"><label style="head1">${uiLabelMap.${titleProperty}}</label><label style="head2"> ${uiLabelMap.CommonFor} "${example.exampleName}" [${exampleId}]</label></container>
</widgets>
</section>
<decorator-section-include name="body"/>
</widgets>
<fail-widgets>
<label style="head3">${uiLabelMap.ExampleViewPermissionError}</label>
</fail-widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="CommonExampleFeatureDecorator">
<section>
<actions>
<set field="headerItem" value="ExampleFeature"/>
<set field="exampleFeatureId" from-field="parameters.exampleFeatureId"/>
<entity-one entity-name="ExampleFeature" value-name="exampleFeature"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${mainDecoratorLocation}">
<decorator-section name="body">
<section>
<!-- do check for EXAMPLE, _VIEW permission -->
<condition>
<if-has-permission permission="EXAMPLE" action="_VIEW"/>
</condition>
<widgets>
<section>
<condition>
<not><if-empty field-name="exampleFeature"/></not>
</condition>
<widgets>
<include-menu name="EditExampleFeature" location="component://example/widget/example/ExampleMenus.xml"/>
<container style="button-bar">
<link target="EditExampleFeature" text="${uiLabelMap.ExampleNewExampleFeature}" style="buttontext"/>
</container>
<container style="button-bar">
<label style="head1">${uiLabelMap.${titleProperty}}</label><label style="head2"> ${uiLabelMap.CommonFor} "${exampleFeature.description}" [${exampleFeatureId}]</label>
</container>
</widgets>
</section>
<decorator-section-include name="body"/>
</widgets>
<fail-widgets>
<label style="head3">${uiLabelMap.ExampleViewPermissionError}</label>
</fail-widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="main">
<section>
<widgets>
@@ -65,7 +149,6 @@ under the License.
</widgets>
</section>
</screen>
<screen name="login">
<section>
<widgets>
@@ -27,7 +27,7 @@ under the License.
<set field="titleProperty" value="PageTitleFindExampleFeature"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="component://example/widget/example/CommonScreens.xml">
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<section>
<condition>
@@ -50,50 +50,6 @@ under the License.
</section>
</screen>
<screen name="CommonExampleFeatureDecorator">
<section>
<actions>
<set field="headerItem" value="ExampleFeature"/>
<set field="exampleFeatureId" from-field="parameters.exampleFeatureId"/>
<entity-one entity-name="ExampleFeature" value-name="exampleFeature"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="component://example/widget/example/CommonScreens.xml">
<decorator-section name="body">
<section>
<!-- do check for EXAMPLE, _VIEW permission -->
<condition>
<if-has-permission permission="EXAMPLE" action="_VIEW"/>
</condition>
<widgets>
<section>
<condition>
<not><if-empty field-name="exampleFeature"/></not>
</condition>
<widgets>
<include-menu name="EditExampleFeature" location="component://example/widget/example/ExampleMenus.xml"/>
<container style="button-bar">
<link target="EditExampleFeature" text="${uiLabelMap.ExampleNewExampleFeature}" style="buttontext"/>
</container>
<container style="button-bar">
<label style="head1">${uiLabelMap.${titleProperty}}</label><label style="head2"> ${uiLabelMap.CommonFor} "${exampleFeature.description}" [${exampleFeatureId}]</label>
</container>
</widgets>
</section>
<decorator-section-include name="body"/>
</widgets>
<fail-widgets>
<label style="head3">${uiLabelMap.ExampleViewPermissionError}</label>
</fail-widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="EditExampleFeature">
<section>
<actions>
@@ -104,7 +60,7 @@ under the License.
<entity-one entity-name="ExampleFeature" value-name="exampleFeature"/>
</actions>
<widgets>
<decorator-screen name="CommonExampleFeatureDecorator">
<decorator-screen name="CommonExampleFeatureDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<include-form name="EditExampleFeature" location="component://example/widget/example/ExampleFeatureForms.xml"/>
</decorator-section>
@@ -121,7 +77,7 @@ under the License.
<set field="exampleFeatureId" from-field="parameters.exampleFeatureId"/>
</actions>
<widgets>
<decorator-screen name="CommonExampleFeatureDecorator">
<decorator-screen name="CommonExampleFeatureDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<include-form name="ListExampleFeatureAppls" location="component://example/widget/example/ExampleFeatureForms.xml"/>
<include-form name="AddExampleFeatureAppl" location="component://example/widget/example/ExampleFeatureForms.xml"/>
@@ -81,7 +81,10 @@ under the License.
</entity-options>
</drop-down>
</field>
<field name="displayAnotherText"><display description="${example.anotherText}"/></field>
<field name="displayAnotherText" use-when="example!=null&amp;&amp;example.get(&quot;anotherText&quot;)!=null">
<display description="${example.anotherText}"/>
</field>
<field name="submitButton" use-when="example==null" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
<field name="submitButton" use-when="example!=null" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
</form>
@@ -20,10 +20,8 @@ under the License.
<menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-menu.xsd">
<menu name="EditExample" default-selected-style="selected"
menu-container-style="button-bar button-style-1"
selected-menuitem-context-field-name="tabButtonItem"
type="simple">
<menu name="EditExample" default-selected-style="selected" type="simple"
menu-container-style="button-bar button-style-1" selected-menuitem-context-field-name="tabButtonItem">
<menu-item name="EditExample" title="${uiLabelMap.ExampleExample}">
<link target="EditExample?exampleId=${exampleId}"/>
</menu-item>
@@ -34,10 +32,8 @@ under the License.
<link target="EditExampleFeatureAppls?exampleId=${exampleId}"/>
</menu-item>
</menu>
<menu name="EditExampleFeature" default-selected-style="selected"
menu-container-style="button-bar button-style-1"
selected-menuitem-context-field-name="tabButtonItem"
type="simple">
<menu name="EditExampleFeature" default-selected-style="selected" type="simple"
menu-container-style="button-bar button-style-1" selected-menuitem-context-field-name="tabButtonItem">
<menu-item name="EditExampleFeature" title="${uiLabelMap.ExampleFeature}">
<link target="EditExampleFeature?exampleFeatureId=${exampleFeatureId}"/>
</menu-item>
@@ -27,7 +27,7 @@ under the License.
<set field="titleProperty" value="PageTitleFindExample"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="component://example/widget/example/CommonScreens.xml">
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<section>
<condition>
@@ -48,46 +48,6 @@ under the License.
</section>
</screen>
<screen name="CommonExampleDecorator">
<section>
<actions>
<set field="headerItem" value="Example"/>
<set field="exampleId" from-field="parameters.exampleId"/>
<entity-one entity-name="Example" value-name="example"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="component://example/widget/example/CommonScreens.xml">
<decorator-section name="body">
<section>
<!-- do check for EXAMPLE, _VIEW permission -->
<condition>
<if-has-permission permission="EXAMPLE" action="_VIEW"/>
</condition>
<widgets>
<section>
<condition>
<not><if-empty field-name="example"/></not>
</condition>
<widgets>
<include-menu name="EditExample" location="component://example/widget/example/ExampleMenus.xml"/>
<container style="button-bar"><link target="EditExample" text="${uiLabelMap.ExampleNewExample}" style="buttontext"/></container>
<container style="button-bar"><label style="head1">${uiLabelMap.${titleProperty}}</label><label style="head2"> ${uiLabelMap.CommonFor} "${example.exampleName}" [${exampleId}]</label></container>
</widgets>
</section>
<decorator-section-include name="body"/>
</widgets>
<fail-widgets>
<label style="head3">${uiLabelMap.ExampleViewPermissionError}</label>
</fail-widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="EditExample">
<section>
<actions>
@@ -98,7 +58,7 @@ under the License.
<entity-one entity-name="Example" value-name="example"/>
</actions>
<widgets>
<decorator-screen name="CommonExampleDecorator">
<decorator-screen name="CommonExampleDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<include-form name="EditExample" location="component://example/widget/example/ExampleForms.xml"/>
</decorator-section>
@@ -115,7 +75,7 @@ under the License.
<set field="exampleId" from-field="parameters.exampleId"/>
</actions>
<widgets>
<decorator-screen name="CommonExampleDecorator">
<decorator-screen name="CommonExampleDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<include-form name="ListExampleItems" location="component://example/widget/example/ExampleForms.xml"/>
<include-form name="AddExampleItem" location="component://example/widget/example/ExampleForms.xml"/>
@@ -133,7 +93,7 @@ under the License.
<set field="exampleId" from-field="parameters.exampleId"/>
</actions>
<widgets>
<decorator-screen name="CommonExampleDecorator">
<decorator-screen name="CommonExampleDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<include-form name="ListExampleFeatureAppls" location="component://example/widget/example/ExampleForms.xml"/>
<include-form name="AddExampleFeatureAppl" location="component://example/widget/example/ExampleForms.xml"/>