1st pass on Example component clean-up

I began to clean and make things consistent for lookups (in order to demonstrate the new Name/id mechanism) but then I realized that it should use Example entity and not Party. I will change that later and will remove all out-of-framework dependencies in the Example component 

* I have added an example of the new Name/id mechanism
* I removed deprecated snippets in ExampleForms (some were already commented out) and used rather LookupExampleFeature enhanced with autocomplete
* In FormWidgetExampleForms.xml I tried to clean things for the autocomplete in the 1st lookup, but I thing there is an issue when more than one name field is retrieved. It does not behave consistently, try for a Person and a PartyGroup for instance...

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@993527 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2010-09-07 20:46:32 +00:00
parent dec4ab2572
commit f5012cfbf8
5 changed files with 47 additions and 82 deletions
@@ -106,10 +106,25 @@ under the License.
<set field="queryString" from-field="result.queryString"/>
<set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
<set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="10"/>
<!-- entries needed for lookup ajax auto completer -->
<!-- required: entity to search in -->
<set field="entityName" value="ExampleFeature"/>
<!-- required: fields to search a match -->
<set field="searchFields" value="[exampleFeatureId, description]"/>
<!-- optional: field to return after user selection, default is first element of searchFields -->
<!-- return field might be hidden based on widget.autocompleter.displayReturnField property in widget.properties -->
<!--set field="returnField" value="exampleFeatureId"/-->
<!-- optional: fields to display, default are searchFields -->
<!--set field="displayFields" value="[exampleFeatureId, description]"/-->
</actions>
<widgets>
<decorator-screen name="LookupLayerPopupDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="search-options">
<include-form name="LookupFindExampleFeature" location="component://example/widget/example/ExampleFeatureForms.xml"/>
</decorator-section>
@@ -236,30 +236,20 @@ under the License.
<form name="AddExampleFeatureAppl" type="single" target="example_createExampleFeatureAppl" title="">
<auto-fields-service service-name="createExampleFeatureAppl"/>
<field name="exampleId"><hidden/></field>
<!-- a nice combination of the lookup option and the auto-complete, but unfortunately still requires a custom companion controller.xml request to handle AJAX data retreival -->
<field name="exampleFeatureId" title="${uiLabelMap.ExampleFeature}">
<lookup presentation="layer" position="center" target-form-name="LookupExampleFeature"/>
<on-field-event-update-area event-type="change" area-id="AddExampleFeatureAppl_exampleFeatureId" area-target="findExampleFeatures"/>
<lookup target-form-name="LookupExampleFeature"/>
</field>
<!-- basic example of server-side AJAX enabled option, requires use of custom companion request in controller.xml file to get data for drop-down -->
<!--
<field name="exampleFeatureId">
<text/>
<on-field-event-update-area event-type="change" area-id="AddExampleFeatureAppl_exampleFeatureId" area-target="findExampleFeatures"/>
</field>
-->
<!-- most feature rich for autocomplete, ie partial text entry searches the full string, doesn't require custom request to function, etc; Note that for usability this is still a bit lame since you can't see the full list, you HAVE to know part of the ID or description in order to see options -->
<!--
<field name="exampleFeatureId">
<!-- most feature rich for autocomplete, ie partial text entry searches the full string,
doesn't require custom request to function, etc; Note that for usability this is still a bit lame since you can't see the full list,
you HAVE to know part of the ID or description in order to see options -->
<!--field name="exampleFeatureId">
<drop-down>
<auto-complete/>
<entity-options entity-name="ExampleFeature" description="${exampleFeatureId}: ${description}">
<entity-order-by field-name="exampleFeatureId"/>
</entity-options>
</drop-down>
</field>
-->
</field-->
<field name="exampleFeatureApplTypeId" title="${uiLabelMap.CommonType}">
<drop-down allow-empty="false">
@@ -21,7 +21,7 @@ under the License.
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
<form name="lookupPartyName" target="LookupPartyExample" type="single"
<form name="lookupPartyName" target="LookupPartyName" type="single"
header-row-style="header-row" default-table-style="basic-table">
<!--<auto-fields-entity entity-name="PartyNameView" default-field-type="find"/>-->
<field name="partyId" title="${uiLabelMap.PartyPartyId}"><text-find/></field>
@@ -36,7 +36,7 @@ under the License.
<field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
<field name="submitButton" title="${uiLabelMap.CommonFind}"><submit button-type="button"/></field>
</form>
<form name="listLookupPartyName" type="list" list-name="listIt" paginate-target="LookupPartyExample"
<form name="listLookupPartyName" type="list" list-name="listIt" paginate-target="LookupPartyName"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<actions>
<set field="inputFields" from-field="parameters"/>
@@ -57,10 +57,10 @@ under the License.
</form>
<!-- Lookup By Name -->
<form name="lookupPartyNameByName" target="LookupPartyExampleByName" type="single"
<form name="lookupPartyGroupByName" target="LookupPartyGroupByName" type="single"
header-row-style="header-row" default-table-style="basic-table">
<field name="LayerFromLayer" title="${uiLabelMap.ExampleLayerFromLayer}">
<lookup target-form-name="LookupPartyExample" position="center"/>
<lookup target-form-name="LookupPartyName" position="center"/>
</field>
<field name="CalendarFromLayer" title="${uiLabelMap.ExampleCalendarFromLayer}"><date-time/></field>
<field name="partyId" title="${uiLabelMap.PartyPartyId}"><text-find/></field>
@@ -75,7 +75,7 @@ under the License.
<field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
<field name="submitButton" title="${uiLabelMap.CommonFind}"><submit button-type="button"/></field>
</form>
<form name="listLookupPartyNameByName" type="list" list-name="listIt" paginate-target="LookupPartyExampleByName"
<form name="listLookupPartyGroupByName" type="list" list-name="listIt" paginate-target="LookupPartyGroupByName"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<actions>
<set field="inputFields" from-field="parameters"/>
@@ -95,12 +95,4 @@ under the License.
<field name="groupName" title="${uiLabelMap.PartyGroupName}"><display/></field>
</form>
<form name="lookupPersonByName" target="LookupPersonByNameExamplePopup" extends="lookupPerson" extends-resource="component://party/widget/partymgr/LookupForms.xml"/>
<form name="listLookupPersonByName" extends="listLookupPerson" extends-resource="component://party/widget/partymgr/LookupForms.xml">
<field name="partyId" widget-style="smallSubmit" title="${uiLabelMap.VinopsPartyId}">
<hyperlink also-hidden="false" target-type="plain" description="${partyId}"
target="javascript:set_values('${firstName} ${lastName}','${partyId}')"/>
</field>
</form>
</forms>
@@ -20,7 +20,7 @@ under the License.
<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
<screen name="LookupParty">
<screen name="LookupPartyName">
<section>
<condition>
<if-service-permission service-name="partyBasePermissionCheck" main-action="VIEW"/>
@@ -64,7 +64,7 @@ under the License.
</section>
</screen>
<screen name="LookupPartyByName">
<screen name="LookupPartyGroupByName">
<section>
<condition>
<if-service-permission service-name="partyBasePermissionCheck" main-action="VIEW"/>
@@ -79,15 +79,21 @@ under the License.
<!-- entries needed for lookup ajax auto completer -->
<!-- required: entity to search in -->
<set field="entityName" value="PartyNameView"/>
<set field="entityName" value="PartyGroup"/>
<!-- entries needed for lookup ajax auto completer -->
<!-- required: entity to search in -->
<set field="entityName" value="ViewCustomersList"/>
<!-- required: fields to search a match -->
<!-- the first element from searchFields is returned after user selection -->
<!-- it might be hidden based on widget.autocompleter.displayReturnField property in widget.properties -->
<set field="searchFields" value="[partyId, firstName, middleName, lastName, groupName]"/>
<set field="searchFields" value="[groupName, partyId]"/>
<!-- optional: fields to display in the given order, default is searchFields -->
<set field="displayFields" value="[firstName, lastName, groupName]"/>
<!-- optional: field to return after user selection, default is first element of searchFields -->
<!-- return field might be hidden based on widget.autocompleter.displayReturnField property in widget.properties -->
<!--set field="returnField" value="groupName"/-->
<!-- optional: fields to display, default are searchFields -->
<set field="displayFields" value="[groupName, partyId]"/>
<!-- optional: additional entity condition (named andCondition) added to search query -->
<script location="component://party/webapp/partymgr/WEB-INF/actions/party/StatusCondition.groovy"/>
@@ -95,48 +101,10 @@ under the License.
<widgets>
<decorator-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="search-options">
<include-form name="lookupPartyNameByName" location="component://example/widget/example/FormWidgetExampleLookupForms.xml"/>
<include-form name="lookupPartyGroupByName" location="component://example/widget/example/FormWidgetExampleLookupForms.xml"/>
</decorator-section>
<decorator-section name="search-results">
<include-form name="listLookupPartyNameByName" location="component://example/widget/example/FormWidgetExampleLookupForms.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="LookupPersonByNameExamplePopup">
<section>
<actions>
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
<set field="title" value="${uiLabelMap.PartyLookupPartyPerson}"/>
<set field="queryString" from-field="result.queryString"/>
<set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/>
<set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="20"/>
<!-- entries needed for lookup ajax auto completer -->
<!-- required: entity to search in -->
<set field="entityName" value="PartyNameView"/>
<!-- required: fields to search a match -->
<set field="searchFields" value="[partyId, firstName, middleName, lastName]"/>
<!-- optional: field to return after user selection, default is first element of searchFields -->
<!-- return field might be hidden based on widget.autocompleter.displayReturnField property in widget.properties -->
<set field="returnField" value="partyId"/>
<!-- optional: fields to display, default are searchFields -->
<set field="displayFields" value="[firstName, lastName]"/>
</actions>
<widgets>
<decorator-screen name="LookupLayerPopupDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="search-options">
<include-form name="lookupPersonByName" location="component://example/widget/example/FormWidgetExampleLookupForms.xml"/>
</decorator-section>
<decorator-section name="search-results">
<include-form name="listLookupPersonByName" location="component://example/widget/example/FormWidgetExampleLookupForms.xml"/>
<include-form name="listLookupPartyGroupByName" location="component://example/widget/example/FormWidgetExampleLookupForms.xml"/>
</decorator-section>
</decorator-screen>
</widgets>