OFBiz
  1. OFBiz
  2. OFBIZ-4472

New elements auto-parameters-[entity/service] for link/hyperlink

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Implemented
    • Affects Version/s: Screen Widget Redesign, SVN trunk
    • Fix Version/s: SVN trunk
    • Component/s: framework
    • Labels:
      None

      Description

      When you want edit/remove an entity from link call it's needed to give all pk on parameter element as like :

      <field name="deleteLink">
      <hyperlink target="example_deleteExampleFeatureAppl">
      <parameter param-name="exampleId"/>
      <parameter param-name="exampleFeatureId"/>
      <parameter param-name="fromDate"/>
      <hyperlink/>
      </field>

      To simplify, I introduce auto-parameters-entity like this :

      <field name="deleteLink">
      <hyperlink target="example_deleteExampleFeatureAppl">
      <auto-parameters-entity entity-name="ExampleFeatureAppl"/>
      <hyperlink/>
      </field>

      or

      <form name="ListExampleFeatureAppls" type="list" default-entity-name="ExampleFeatureAppl">
      <field name="deleteLink">
      <hyperlink target="example_deleteExampleFeatureAppl">
      <auto-parameters-entity/>
      <hyperlink/>
      </field>

      This method is inspired from auto-fields-entity and I homogenized on widget renderer screen (link), menu (link) and form (hyperlink, sub-link)

      Any comments are welcome

      1. OFBIZ-4472.patch
        34 kB
        Nicolas Malin
      2. OFBIZ-4472.patch
        34 kB
        Nicolas Malin
      3. OFBIZ-4472.patch
        24 kB
        Nicolas Malin
      4. OFBIZ-4472.patch
        25 kB
        Nicolas Malin
      5. OFBIZ-4472.patch
        24 kB
        Nicolas Malin
      6. OFBIZ-4472.patch
        21 kB
        Nicolas Malin

        Issue Links

          Activity

          Hide
          Nicolas Malin added a comment -

          I update the patch with :

          • manage auto-parameters-entity on event-update-area
          • imporve resolving entityName
          Show
          Nicolas Malin added a comment - I update the patch with : manage auto-parameters-entity on event-update-area imporve resolving entityName
          Hide
          Nicolas Malin added a comment -

          Improve patch : when the flexibleString is resolved, search fields on root context and parameters map.

          Show
          Nicolas Malin added a comment - Improve patch : when the flexibleString is resolved, search fields on root context and parameters map.
          Hide
          Adrian Crum added a comment -

          Since the type of action in your example (delete an ExampleFeatureAppl) usually results in a service call (via a request event), it seems to me it would make more sense to base the parameters on a service definition instead of an entity.

          Show
          Adrian Crum added a comment - Since the type of action in your example (delete an ExampleFeatureAppl) usually results in a service call (via a request event), it seems to me it would make more sense to base the parameters on a service definition instead of an entity.
          Hide
          Nicolas Malin added a comment -

          You are absolutely right adrian, auto-parameters-service will be a better solution on my example. My origin case was only on entity, but if you are interested to extend on service, I can improve this issue.

          Show
          Nicolas Malin added a comment - You are absolutely right adrian, auto-parameters-service will be a better solution on my example. My origin case was only on entity, but if you are interested to extend on service, I can improve this issue.
          Hide
          Jacques Le Roux added a comment -

          Hi Nicolas, I tried your patch but it does no longer apply on trunk.

          Show
          Jacques Le Roux added a comment - Hi Nicolas, I tried your patch but it does no longer apply on trunk.
          Hide
          Nicolas Malin added a comment -

          Ok, I update a new patch and validate it.

          The modification on specialpurpose/example is present to have a use case. It's possible to don't commit it.

          Jacques to test, you can create a ExampleFeature and associate to an Example. When you list all features associate, the delete link must be contains all pk on parameter.

          Nicolas

          Show
          Nicolas Malin added a comment - Ok, I update a new patch and validate it. The modification on specialpurpose/example is present to have a use case. It's possible to don't commit it. Jacques to test, you can create a ExampleFeature and associate to an Example. When you list all features associate, the delete link must be contains all pk on parameter. Nicolas
          Hide
          Nicolas Malin added a comment -

          I add auto-parameters-service to resolve all parameters waiting by a service and complete xsd.

          Show
          Nicolas Malin added a comment - I add auto-parameters-service to resolve all parameters waiting by a service and complete xsd.
          Hide
          Jacques Le Roux added a comment -

          Hi Nicolas,

          I tried it and it works well. I did not completely review yet and I'd like more people involved before committing. Please test, review if you want, and vote.
          From now I'd like this process to be used for not trivial patches (and maybe even trivial looking ones, as OFBIZ-5192 suggests), thanks in advance for your help!

          To quickly test, as Nicolas suggested, apply this snippet (part of the OFBIZ-4472.patch 12/Nov/12 11:43 version)

          Index: specialpurpose/example/widget/example/ExampleForms.xml
          ===================================================================
          --- specialpurpose/example/widget/example/ExampleForms.xml	(révision 1408116)
          +++ specialpurpose/example/widget/example/ExampleForms.xml	(copie de travail)
          @@ -200,7 +200,7 @@
               </form>
           
               <!-- ExampleFeatureAppl -->
          -    <form name="ListExampleFeatureAppls" type="list"  list-name="exampleFeatureAppls"  target="example_updateExampleFeatureAppl">
          +    <form name="ListExampleFeatureAppls" type="list"  list-name="exampleFeatureAppls"  target="example_updateExampleFeatureAppl" default-entity-name="ExampleFeatureAppl">
                   <actions>
                       <entity-condition entity-name="ExampleFeatureAppl">
                           <condition-expr field-name="exampleId" from-field="exampleId"/>
          @@ -226,10 +226,8 @@
                   </field>
                   <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
                   <field name="deleteLink" title=" " widget-style="buttontext">
          -            <hyperlink target="example_deleteExampleFeatureAppl" description="${uiLabelMap.CommonDelete}" also-hidden="false" image-location="${iconsLocation}/delete.png">
          -                <parameter param-name="exampleId"/>
          -                <parameter param-name="exampleFeatureId"/>
          -                <parameter param-name="fromDate"/>
          +            <hyperlink target="example_deleteExampleFeatureAppl" description="${uiLabelMap.CommonDelete}" also-hidden="false" >
          +                <auto-parameters-entity/>
                       </hyperlink>
                   </field>
               </form>
          

          You will then see a difference: the delete (no entry) icon will not appears but it will still continue to work the same: feature will be deleted. Also in HTML source you will see the input hidden fields like

          <input type="hidden" name="exampleId" value="EX01" id="ListExampleFeatureAppls_exampleId_o_0"/>
          
          Show
          Jacques Le Roux added a comment - Hi Nicolas, I tried it and it works well. I did not completely review yet and I'd like more people involved before committing. Please test, review if you want, and vote. From now I'd like this process to be used for not trivial patches (and maybe even trivial looking ones, as OFBIZ-5192 suggests), thanks in advance for your help! To quickly test, as Nicolas suggested, apply this snippet (part of the OFBIZ-4472 .patch 12/Nov/12 11:43 version) Index: specialpurpose/example/widget/example/ExampleForms.xml =================================================================== --- specialpurpose/example/widget/example/ExampleForms.xml (révision 1408116) +++ specialpurpose/example/widget/example/ExampleForms.xml (copie de travail) @@ -200,7 +200,7 @@ </form> <!-- ExampleFeatureAppl --> - <form name= "ListExampleFeatureAppls" type= "list" list-name= "exampleFeatureAppls" target= "example_updateExampleFeatureAppl" > + <form name= "ListExampleFeatureAppls" type= "list" list-name= "exampleFeatureAppls" target= "example_updateExampleFeatureAppl" default -entity-name= "ExampleFeatureAppl" > <actions> <entity-condition entity-name= "ExampleFeatureAppl" > <condition-expr field-name= "exampleId" from-field= "exampleId" /> @@ -226,10 +226,8 @@ </field> <field name= "submitButton" title= "${uiLabelMap.CommonUpdate}" ><submit button-type= "button" /></field> <field name= "deleteLink" title= " " widget-style= "buttontext" > - <hyperlink target= "example_deleteExampleFeatureAppl" description= "${uiLabelMap.CommonDelete}" also-hidden= " false " image-location= "${iconsLocation}/delete.png" > - <parameter param-name= "exampleId" /> - <parameter param-name= "exampleFeatureId" /> - <parameter param-name= "fromDate" /> + <hyperlink target= "example_deleteExampleFeatureAppl" description= "${uiLabelMap.CommonDelete}" also-hidden= " false " > + <auto-parameters-entity/> </hyperlink> </field> </form> You will then see a difference: the delete (no entry) icon will not appears but it will still continue to work the same: feature will be deleted. Also in HTML source you will see the input hidden fields like <input type= "hidden" name= "exampleId" value= "EX01" id= "ListExampleFeatureAppls_exampleId_o_0" />
          Hide
          Jacques Le Roux added a comment -

          Hi Nicolas, I reviewed a 1st part today (WidgetWorker.java really thorough) and found 2 possible (though unlikely) NPEs in the 2 WidgetWorker.getParametersMap() methods. When the dispatcher or delegator are null better to return directly the empty map, after showing the error message in log.

          Also in formatting avoid
          if (! excludeList.contains(paramName)) {
          prefer
          if (!excludeList.contains(paramName)) {

          I'd really appreciate reviews and tests by others (Neogia team? ) before committing

          Thanks!

          Show
          Jacques Le Roux added a comment - Hi Nicolas, I reviewed a 1st part today (WidgetWorker.java really thorough) and found 2 possible (though unlikely) NPEs in the 2 WidgetWorker.getParametersMap() methods. When the dispatcher or delegator are null better to return directly the empty map, after showing the error message in log. Also in formatting avoid if (! excludeList.contains(paramName)) { prefer if (!excludeList.contains(paramName)) { I'd really appreciate reviews and tests by others (Neogia team? ) before committing Thanks!
          Hide
          Jacques Le Roux added a comment -

          Bump!

          Show
          Jacques Le Roux added a comment - Bump!
          Hide
          Gil Portenseigne added a comment -

          Hi,

          I just have tested the patch, with auto-parameters-entity and service, everything works well.

          I had a quick review on the code, seems good to me, just some english mistakes in xsd documentation :

          -The service name use to resolve parameters. If empty, use form defaultServiceName. Flexible string allow.
          +The service name used to resolve parameters. If empty, use form defaultServiceName. Flexible string allowed.

          Gil

          Show
          Gil Portenseigne added a comment - Hi, I just have tested the patch, with auto-parameters-entity and service, everything works well. I had a quick review on the code, seems good to me, just some english mistakes in xsd documentation : -The service name use to resolve parameters. If empty, use form defaultServiceName. Flexible string allow. +The service name used to resolve parameters. If empty, use form defaultServiceName. Flexible string allowed. Gil
          Hide
          Nicolas Malin added a comment - - edited

          Thanks jacques for your interest and followed on this issue.

          Gil I updated the path with your correction.

          Nicolas

          Show
          Nicolas Malin added a comment - - edited Thanks jacques for your interest and followed on this issue. Gil I updated the path with your correction. Nicolas
          Hide
          Jacques Le Roux added a comment -

          Thanks Nicolas, Gil,

          Nicolas your patch is in trunk at revision: 1506835

          I simply put returns in case of no dispatcher or delegator

          Show
          Jacques Le Roux added a comment - Thanks Nicolas, Gil, Nicolas your patch is in trunk at revision: 1506835 I simply put returns in case of no dispatcher or delegator

            People

            • Assignee:
              Jacques Le Roux
              Reporter:
              Nicolas Malin
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development