Hi all,

We would like to share with you a thinking that we try at Nereide, to
reorganize some widget screen with compound widget associated with the
work about screen dynamism [1].

After the proposal by Xin Wang to improve the FindWorkEffort screen and
our suggestion to dynamism at the same time, it occured to us that codes
are spread in many places. To avoid that, we refactored using compound
widget introduced in OFBIZ-4090, that is not really used yet through
standard Apache OFBiz applications.

We wanted to share the idea since we weren't convinced at that time
about the compound feature [2]. With that usecase as a basis, we would
like to reconsider using it, and discuss with the community.

We did experiment to convert each tab in workeffort menu (rate, party,
note) to implement dynamism, gathering every element used by each menu
within one compound file.

The benefits of this are :
  * Everything in one sufficient and coherent file
  * Ease the integration of dynamic compound screen in application level.
  * Help detect screen complexity looking at compound file size.

As shown below, we created suffixed files with Cpd to quickly identify
the type of xml. We wonder about alternative like subfolder for compound
or other. WDYT ?

Some example on WorkEffortRate :

controller.xml :
   <include location="component://workeffort/widget/WorkEffortRateCpd.xml"/>

WorkEffortScreens.xml :
    ###########
    <screen name="EditWorkEffortRates">
        <section>...
           <widgets>
                <decorator-screen name="CommonWorkEffortDecorator"
location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-screen name="ListWorkEffortRates"
location="component://workeffort/widget/WorkEffortRateCpd.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    ###########

WorkEffortRateAssignCpd.xml :
    ###########
    <sc:site-conf>
        <sc:request-map uri="WorkEffortRate/List">...
        <sc:request-map uri="WorkEffortRate/Edit">...
        <sc:request-map uri="WorkEffortRate/update">...
            <sc:event type="service" invoke="updateRateAmount"/>
            <sc:response name="success" type="request" value="json"/>
            <sc:response name="error" type="request" value="json"/>
        </sc:request-map>
        <sc:request-map uri="WorkEffortRate/delete">...
        <sc:view-map name="WorkEffortRate/List" type="screen"
page="component://workeffort/widget/WorkEffortRateCpd.xml#ListWorkEffortRates"/>
        <sc:view-map name="WorkEffortRate/Edit" type="screen"
page="component://workeffort/widget/WorkEffortRateCpd.xml#EditWorkEffortRate"/>
    </sc:site-conf>

    <ws:screens>
        <ws:screen name="ListWorkEffortRates">...
                <ws:widgets>
                    <ws:decorator-screen name="CommonEmbeddedDecorator"
location="component://workeffort/widget/CommonScreens.xml">...
                            <ws:include-grid name="ListWorkEffortRates"
location="component://workeffort/widget/WorkEffortRateCpd.xml"/>...
        </ws:screen>
        <ws:screen name="EditWorkEffortRate">...
                <ws:widgets>
                    <ws:decorator-screen name="CommonEmbeddedDecorator"
location="component://workeffort/widget/CommonScreens.xml">...
                            <ws:include-form name="EditWorkEffortRate"
location="component://workeffort/widget/WorkEffortRateCpd.xml"/>...
    </ws:screens>

    <wm:menus>
        <wm:menu name="WorkEffortRateTabBar" extends="CommonTabBarMenu"
extends-resource="component://common/widget/CommonMenus.xml">
            <wm:menu-item name="AddWorkEffortRate" ...
                <wm:link target="WorkEffortRate/Edit"
link-type="layered-modal">...
                    <wm:set-callback area-target="WorkEffortRate/List">...
        </wm:menu>
        <wm:menu name="ListWorkEffortRatesInLineBar"
extends="CommonInlineBarMenu"
extends-resource="component://common/widget/CommonMenus.xml">
            <wm:menu-item name="EditWorkEffortRate"...
            <wm:menu-item name="DeleteWorkEffortRate" ...>
                <wm:link target="WorkEffortRate/delete"
request-confirmation="true">
                    <wm:auto-parameters-service
service-name="expireRateAmount"/>
                    <wm:set-callback area-target="WorkEffortRate/List"/>...
    </wm:menus>

    <wf:forms>
        <wf:grid name="ListWorkEffortRates"
paginate-target="WorkEffortRate/List"
                 extends="CommonDynamicGrid"
extends-resource="component://common/widget/CommonForms.xml">...
        <wf:form name="EditWorkEffortRate"
default-map-name="workEffortRateAmount" target="WorkEffortRate/update"
                 extends="CommonBasicSingle"
extends-resource="component://common/widget/CommonForms.xml">...
    </wf:forms>
    ###########

We understand that it's hard to read :) you can find the current work on
our labs [3]

Thanks for taking time to read this and any suggests are welcome

Cheers,
Gil, Leila, Nicolas

[1] https://issues.apache.org/jira/browse/OFBIZ-11808
[2]
https://lists.apache.org/thread.html/r729c22dcba0b7c4e29979f5e65230ab140427addb3af8844f33108f5%40%3Cdev.ofbiz.apache.org%3E
[3]
https://labs.nereide.fr/10031/Communautaire/-/compare/trunk...DynamismWorkEffort

-- 
logoNrd <https://nereide.fr/>
        Nicolas Malin
The apache way <http://theapacheway.com/> : *Charity* Apache’s mission
is providing software for the public good.
informat...@nereide.fr
8 rue des Déportés 37000 TOURS, 02 47 50 30 54

Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way
<http://theapacheway.com/>|réseau LE <http://www.libre-entreprise.org/>

Reply via email to