Author: jleroux
Date: Tue Sep 7 20:46:32 2010 New Revision: 993527 URL: http://svn.apache.org/viewvc?rev=993527&view=rev Log: 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... Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml ofbiz/trunk/framework/example/widget/example/ExampleForms.xml ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupForms.xml ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupScreens.xml Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml?rev=993527&r1=993526&r2=993527&view=diff ============================================================================== --- ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml (original) +++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml Tue Sep 7 20:46:32 2010 @@ -192,8 +192,8 @@ under the License. <request-map uri="FormWidgetExamples"><security https="true" auth="true"/><response name="success" type="view" value="FormWidgetExamples"/></request-map> <request-map uri="LookupExampleFeature"><security https="true" auth="true"/><response name="success" type="view" value="LookupExampleFeature"/></request-map> - <request-map uri="LookupPartyExample"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyExample"/></request-map> - <request-map uri="LookupPartyExampleByName"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyExampleByName"/></request-map> + <request-map uri="LookupPartyName"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyName"/></request-map> + <request-map uri="LookupPartyGroupByName"><security https="true" auth="true"/><response name="success" type="view" value="LookupPartyGroupByName"/></request-map> <request-map uri="ListExampleFormOnly"><security https="true" auth="false"/><response name="success" type="view" value="ListExampleFormOnly"/></request-map> <request-map uri="CreateExampleFormOnly"><security https="true" auth="false"/><response name="success" type="view" value="CreateExampleFormOnly"/></request-map> @@ -252,8 +252,8 @@ under the License. <view-map name="FormWidgetExamples" type="screen" page="component://example/widget/example/FormWidgetExampleScreens.xml#FormWidgetExamples"/> <view-map name="LookupExampleFeature" type="screen" page="component://example/widget/example/ExampleFeatureScreens.xml#LookupExampleFeature"/> - <view-map name="LookupPartyExample" type="screen" page="component://example/widget/example/FormWidgetExampleLookupScreens.xml#LookupParty"/> - <view-map name="LookupPartyExampleByName" type="screen" page="component://example/widget/example/FormWidgetExampleLookupScreens.xml#LookupPartyByName"/> + <view-map name="LookupPartyName" type="screen" page="component://example/widget/example/FormWidgetExampleLookupScreens.xml#LookupPartyName"/> + <view-map name="LookupPartyGroupByName" type="screen" page="component://example/widget/example/FormWidgetExampleLookupScreens.xml#LookupPartyGroupByName"/> <!-- ajax view mappings --> <view-map name="findExampleAjax" type="screen" page="component://example/widget/example/ExampleAjaxScreens.xml#AjaxExample"/> Modified: ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml?rev=993527&r1=993526&r2=993527&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleFeatureScreens.xml Tue Sep 7 20:46:32 2010 @@ -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> Modified: ofbiz/trunk/framework/example/widget/example/ExampleForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleForms.xml?rev=993527&r1=993526&r2=993527&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleForms.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleForms.xml Tue Sep 7 20:46:32 2010 @@ -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"> Modified: ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupForms.xml?rev=993527&r1=993526&r2=993527&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupForms.xml (original) +++ ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupForms.xml Tue Sep 7 20:46:32 2010 @@ -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> Modified: ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupScreens.xml?rev=993527&r1=993526&r2=993527&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/FormWidgetExampleLookupScreens.xml Tue Sep 7 20:46:32 2010 @@ -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,64 +79,32 @@ under the License. <!-- entries needed for lookup ajax auto completer --> <!-- required: entity to search in --> - <set field="entityName" value="PartyNameView"/> - - <!-- 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]"/> - - <!-- optional: fields to display in the given order, default is searchFields --> - <set field="displayFields" value="[firstName, lastName, groupName]"/> - - <!-- optional: additional entity condition (named andCondition) added to search query --> - <script location="component://party/webapp/partymgr/WEB-INF/actions/party/StatusCondition.groovy"/> - </actions> - <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"/> - </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"/> + <set field="entityName" value="PartyGroup"/> <!-- entries needed for lookup ajax auto completer --> <!-- required: entity to search in --> - <set field="entityName" value="PartyNameView"/> + <set field="entityName" value="ViewCustomersList"/> <!-- required: fields to search a match --> - <set field="searchFields" value="[partyId, firstName, middleName, lastName]"/> + <set field="searchFields" value="[groupName, partyId]"/> <!-- 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"/> + <!--set field="returnField" value="groupName"/--> <!-- optional: fields to display, default are searchFields --> - <set field="displayFields" value="[firstName, lastName]"/> + <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"/> </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="lookupPersonByName" 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="listLookupPersonByName" location="component://example/widget/example/FormWidgetExampleLookupForms.xml"/> + <include-form name="listLookupPartyGroupByName" location="component://example/widget/example/FormWidgetExampleLookupForms.xml"/> </decorator-section> </decorator-screen> </widgets> |
Free forum by Nabble | Edit this page |