Commit Graph
1275 Commits
Author SHA1 Message Date
Nicolas Malin c6e44d143f Fixed: Attribute default-field-type hidden doesn't work for auto-fields-service element (OFBIZ-12555)
Fix the compilation error on build bot that not support java11, downgrade the code to java8
2022-02-03 10:46:30 +01:00
Nicolas Malin 850a32df17 Reverted: Improved: no functional change, adds a BuildBot badge (INFRA-22807)
This reverts commit 884864b07f that contains a revert error of 9ea7afe97a
2022-02-03 10:46:10 +01:00
Jacques Le Roux 884864b07f Improved: no functional change, adds a BuildBot badge (INFRA-22807)
It works locally (once you have installed Ruby, asciidoctor and
asciidoctor-diagram). CHecking that it's also OK on BuildBot, let's see result
at https://nightlies.apache.org/ofbiz/trunk/readme/html5/
2022-02-03 09:53:55 +01:00
Nicolas Malin 9ea7afe97a Fixed: Attribute default-field-type hidden doesn't work for auto-fields-service element (OFBIZ-12555)
When you define a widget form and wish populate hidden fields with the element auto-fields-service, OFBiz rendering each as edit field type.

    <form name="ListPartyQuals" ...>
        <auto-fields-service service-name="updatePartyQual" default-field-type="hidden"/>
    </form>

The problem came from the function ModelFormFieldBuilder.induceFieldInfoFromServiceParam didn't manage the case "hidden"

By the way, this function is "if" forest, and simplify reading.
2022-02-02 18:07:37 +01:00
Nicolas Malin 52c3e61a95 Improved: Use flexible expander to resolve the area target on call back (OFBIZ-12509)
When you use a callback, at this time we haven't to possibility to resolve the area target from the context like this

                <wm:link target="WorkEffortAgreement/delete">
                    ....
                    <wm:set-callback area-target="${useThisTarget}">
                       ...
                    </wm-setcallback>
                </wm:link>
2022-01-24 07:34:09 +01:00
Jacques Le Roux 3b99529c0d Improved: Address SpotBugs issue by avoiding nulls in parameter matches for JMockit Expectations (OFBIZ-11456)
Same than https://github.com/apache/ofbiz-framework/pull/411

Thanks: Daniel
2021-12-13 17:24:02 +01:00
Daniel Watford e163330934 Improved: Address SpotBugs issue by avoiding nulls in parameter matches for JMockit Expectations (OFBIZ-11456) 2021-12-13 15:20:40 +00:00
Jacques Le Roux 8b9fc99d7d Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
In ProductWorker::getProductFeaturesApplIncludeMarketingPackage fixes a possible
null dereferencement (tested too late)

In FileUtil::unZip uses a try-w-resource w/ ZipFile to close it. I crossed an
issue with automated OOTB formatting (clean-up on save in Eclipse). Fixed with
my external default editor (could not find where to change that in
OFBizJavaFormatter.xml

In ServiceArtifactInfo::calledServiceEcaSet fixes a possible null dereferencement
(tested too late), also minor formatting

In MacroScreenRenderer::renderScreenletSubWidget fixes a possible null
dereferencement (tested too late)

in FileUtil
2021-12-10 16:09:42 +01:00
Jacques Le Roux d6c18f2998 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
ModelFormField::isAllChecked can't return null, must be a boolean
2021-12-06 09:44:48 +01:00
Jacques Le Roux 164d39a7fc Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
Removes wrong comment, it's a test class
2021-12-03 12:25:25 +01:00
Jacques Le Roux a7183cba55 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
Add a comment about test methods not used OOTB
2021-12-03 09:34:33 +01:00
Jacques Le Roux 513689da96 Documented: MacroFormRenderer refactoring (OFBIZ-11456)
Adds a FIXME about: SpotBugs reporting:
Argument 1 is definitely null but must not be null
2021-11-30 19:12:33 +01:00
Jacques Le Roux 699c30ed85 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
Fixes possible null dereferencings

For FormRenderer.java it was accidentally removed for OFBIZ-12422
2021-11-30 19:03:24 +01:00
Jacques Le Roux 23177b182d Improved: Search/find in web tools - entity-engine generates an error (OFBIZ-12422)
I blindly followed SpotBugs advice, using a "try with resource" because the
EntityListIterator was not closed. Forgetting that it's done by purpose.

Thanks: Thanks Pierre Smits for report
2021-11-30 10:38:38 +01:00
Jacques Le Roux a3a53b5b72 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
Fixes possible null dereferencings in PackingSession.java and FormRenderer.java

Also a try with resource for FormRenderer because the EntityListIterator was not
closed.

Also removes not used setShipmentBoxTypeId method and shipmentBoxTypeId var in
PackingSession.java
2021-11-29 14:20:07 +01:00
Jacques Le Roux cfb5de4246 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
Fixes possible null dereferencings
2021-11-29 14:00:09 +01:00
Jacques Le Roux 49cae3c73a Improved: Handle remaining checkstyle errors (OFBIZ-12169)
Adds getter and setter to ScreenRenderer class
Adds unused hashCode method to ControllerRequestArtifactInfo class
Makes final UomWorker and ContactHelper classes

Only 10 checkstyle issues now
2021-10-17 15:45:55 +02:00
Jacques Le Roux c85f60279b Improved: Remove Checkstyle warning related to double parenthesis at start of lines (OFBIZ-12340)
At https://markmail.org/message/3mhzlqew3igad3r2 I reported an issue that I was
not able to really qualify. After exchanging with a Checkstyle expert
(see markmail thread).

I was unable to find what in our checkstyle.xml file was wrongly throwing these
warnings. I decided that there was no reason to throw those warnings.

So I decided to put the SuppressionCommentFilter in our checkstyle.xml file and
use CHECKSTYLE_OFF: ALMOST_ALL/CHECKSTYLE_ON: ALMOST_ALL around
the concerned lines as documented here
https://checkstyle.sourceforge.io/config_filters.html#SuppressionCommentFilter_Examples
2021-10-17 15:38:30 +02:00
Daniel Watford dabafa77f9 Improved: Use FTL with_args on macro calls (OFBIZ-12274)
Previous approach to rendering FTL macros was to encode all macro
arguments as a single string and pass to the FTL processor.

New approach is to use FTL's default wrapper to handle passing Java
types to the FTL processor and referencing them from macro calls.

Thanks: Xin Wang for introducing FTL with_args approach and providing
POC.
2021-09-27 10:33:17 +01:00
Gil Portenseigne ab9ca12221 Execute a callback with parameters from the request (OFBIZ-12262)
Transform workEffort creation using modal and callback system to
illustrate this improvement.

A new Attribute `from-event-result` is created for `set-callback`
parameters, to indicate that the callback should be called with a
parameter which value comes from the event result initiated by the link.

In this example, is retrieved from the workeffort creation event the id
needed to display the WorkEffortSummary screen of the new data.

A new pattern is created to encode in CALLBACK JWT token the data that
should be parsed from the event. The parsing occurs in javascript.
2021-09-07 14:56:20 +02:00
Jacques Le Roux 4f14cb96cf Fixed: Use platform specific failed on CompoundWidget (OFBIZ-12283)
Fixes a checkstyle issue
2021-07-23 09:30:25 +02:00
Nicolas Malin c5a1a91fbd Fixed: Correct checkstyle typo 2021-07-23 09:10:09 +02:00
Nicolas Malin 8b5bd93d3a Fixed: Use platform specific failed on CompoundWidget (OFBIZ-12283)
When you use a platform-specific element on CompoundWidget like this :

     <ws:platform-specific>
        <ws:html><ws:html-template location="component ..."/></ws:html>
     </ws:platform-specific>

the ModelScreenWidget failed to resolve the attended type due to the
namespace presence (ws:html != html) and finally failed to rendering the screen

Complete the previous commit where I forgot this part
2021-07-22 21:37:09 +02:00
Nicolas Malin c7e21a7249 Fixed: Use platform specific failed on CompoundWidget (OFBIZ-12283)
When you use a platform-specific element on CompoundWidget like this :

     <ws:platform-specific>
        <ws:html><ws:html-template location="component ..."/></ws:html>
     </ws:platform-specific>

the ModelScreenWidget failed to resolve the attended type due to the
namespace presence (ws:html != html) and finally failed to rendering the screen
2021-07-16 18:10:17 +02:00
Jacques Le Roux 414e4d83ed Fixed: Macro renderLink default height and width not retrieved on menus (OFBIZ-12279)
Menus link defaut parameters for height and width are not considered when the
link is generated. When parameter with empty value is passed to the macro, macro
default values are not retrieved.

To reproduce
you can create a "layered-modal" type link in a menu and click on the link
(without height nor width):
this will generate the link with parameters "data-dialog-height" and
"data-dialog-width" empty

Patch provided
When applied, the MacroMenuRenderer.renderLink  will not send empty values to
the macro so that default value will be retrieved (what is actually done on
MacroFormRenderer.renderLookup)

Thanks: Leila
2021-07-12 12:03:59 +02:00
Nicolas Malin 894408cb0d Fixed: Link request-confirmation not generated on menus (OFBIZ-12278)
Menus link with request-confirmation and confirmation message do not generate the script that open confirmation

When you activate the following menu item :
      <menu-item name="statusToCancelled" title="${uiLabelMap.AccountingPaymentTabStatusToCancelled}">
          <link target="setPaymentStatus" request-confirmation="true" confirmation-message="You want to cancel this payment number ${payment.paymentId}?">
              ....
         </link>
      </menu-item>

OFBiz to not generate the js code link to the request-confirmation attribute because this functionality has been never implemented on java code for MenuRenderer

Thanks to Leila Mekika for raised this issue and solved it
2021-07-09 20:31:56 +02:00
Nicolas Malin d795fd45be Fixed: List parameters forwarded by element callback failed to restore the list (OFBIZ-11812) (OFBIZ-12261)
There is an error when the callback element resolve the list parameters, it check the parameters element as field and not as final variable.

This generate an empty callback link.
2021-07-07 10:17:36 +02:00
Jacques Le Roux 27d9e64d82 Fixed: fixes a chekstyle issue
It was put in with
https://github.com/apache/ofbiz-framework/commit/7120cf7
2021-07-03 19:30:17 +02:00
Nicolas Malin 7120cf7d5f Implemented: Keep paginate list query on dynamic refresh (OFBIZ-12261)
When you display a list with search criteria, pagination information and/or sort parameters, if you update an element of this list with a update area, you loose all of them.

Example:

<form name="ListProductMeters" type="list" list-name="productMeters" target="updateProductMeter" paginate-target="ListProductMeters">
    <actions>
       <entity-condition entity-name="ProductMeter">...
    </actions>
    <auto-fields-service service-name="updateProductMeter"/>
    <field name="meterName"><text size="20"/></field>
    <field name="updateButton"><submit/></field>
    <on-event-update-area event-type="paginate"/>
    <on-event-update-area event-type="sort-column"/>
    <on-event-update-area event-type="submit"/>
</form>

Or this works well if you move an next page sort the list.
I realize the same principle for each event which do a modification of element in the list and after refresh it.

I also introduce the possibility to submit a form on modal (for edition) when you press 'enter' that will refresh the origin list.

Last point, the queryString element use to propage pagination state is also forwarded on callback element to keep this on update the list.

Thanks to Gil Portenseigne is help.
2021-07-02 17:27:21 +02:00
Gil Portenseigne b4e46ff070 Implemented : New child element set-callback on link to control dynamism (OFBIZ-11812)
Refreshment information are controlled by the calling object,
instead of the called form.

This avoid dependency between called form and parent screens.

The set-callback tag generate a jwt encoded UpdateArea widget, that
is transmitted through submits and links until a submit with no
update-area information is met.  This specific submit ends the
process launched by the link, and trigger the refresh action
contained into the JWT token.
2021-06-24 16:13:00 +02:00
Jacques Le Roux cf2f0b378c Fixed: Status change button on Invoice screen is not working (OFBIZ-12248)
Steps:
1. Open URL https://demo-trunk.ofbiz.apache.org/accounting/control/findInvoices
2. View any invoice from the list say [invoice# : 8010]
3. Change the status to Ready / Cancelled

Expected:
Status should be marked to Ready for Posting or Cancelled

Actual Result
The loader is visible but nothing happens

Thanks: Nameet Jain
2021-06-03 11:53:59 +02:00
Daniel Watford d16bef46dc Improved: MacroFormRenderer refactoring of field group open and close elements
(OFBIZ-12124)

Part of the OFBIZ-11456 MacroFormRenderer refactoring effort.

Rather than MacroFormRenderer producing and evaulating FTL strings, it now
uses RenderableFtlElementsBuilder to create RenderableFtlMacroCall objects
which are then passed to an FtlWriter for evaluation.
2021-05-27 11:12:12 +01:00
Nicolas Malin b663660486 Implemented: on-event-update-area on form inherit information from parent form
(OFBIZ-11811) (OFBIZ-11808)

When you write a form, if you want the dynamic interaction and style, you need to implement everything on the form.
The developer must know the style used, different area and rules support by the technology besides the really information/action that the form will do.

   <form name="ListFacility" type="list" list-name="listIt" paginate-target="FindFacility"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
       <actions>...
       <field name="facilityId">....
       <on-event-update-area event-type="sort-column" area-id="search-results" area-target="FacilitySearchResults"/>
       <on-event-update-area event-type="paginate" area-id="search-results" area-target="FacilitySearchResults"/>
   </form>

We can put all information on the theme and all dynamic refresh (for area) are related to the parent form and parent screen. Finally we will obtain :

    <form name="ListFacility" extends="CommonDynamicList" extends-resource="component://common/widget/CommonForms.xml"
          paginate-target="FindFacility">
        <actions>...
        <field name="facilityId">....
    </form>

    <form name="CommonDynamicList" type="list"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
       <on-event-update-area event-type="sort-column"/>
       <on-event-update-area event-type="paginate"/>
   </form>

The target and area to update has been automatically resolved from the parent form and screen.

This commit improve the modelForm and the widget-form.xsd to do that.

Thanks to Gil Portenseigne his help
2021-05-21 17:58:27 +02:00
Jacques Le Roux 75d3367d47 Improved: replaces java.rmi.server.UID by java.util.UUID
Not a big deal but better use java.util.UUID there.
2021-03-23 09:38:03 +01:00
Jacques Le Roux 8243d926d0 Improved: Improves encoding in 3 classes
Fixes an issue put in with commit c54dced51c

There I wrongly replaced internalEncoder in MacroFormRenderer.java by
context.get("simpleEncoder")

While at it uses the pattern used in commit cb9c366 in every place in
modelFormField class
2021-03-07 16:23:21 +01:00
Jacques Le Roux 000473c7ed Improved: Form widget "checkbox" do not persist selected value with multiple options checked (OFBIZ-12154)
I tried to use the form-widgets checkbox on a custom find screen.
But after searching values with option/s checked, no checkbox remains selected.

I found similar kind of ticket OFBIZ-11933.
The checkbox was replaced by usage of the asmselect jQuery plugin

This fixes the bug at the framework level.

jleroux: fixes checkstyle issues: missing spaces after (3) if

Thanks: Nameet Jain
2021-03-03 11:27:47 +01:00
Jacques Le Roux 548cfa8033 Reverted: reverts "Improved: Form widget "checkbox" do not persist selected value with multiple options checked (OFBIZ-12154)"
This reverts commit 6bfae1293a.

There is an issue with checkFieldMacroRendered test
2021-03-02 14:19:38 +01:00
Jacques Le Roux 6bfae1293a Improved: Form widget "checkbox" do not persist selected value with multiple options checked (OFBIZ-12154)
I tried to use the form-widgets checkbox on a custom find screen.
But after searching values with option/s checked, no checkbox remains selected.

I found similar kind of ticket OFBIZ-11933.
The checkbox was replaced by usage of the asmselect jQuery plugin

This fixes the bug at the framework level.

jleroux: fixes checkstyle issues: missing spaces after (3) if

Thanks: Nameet Jain
2021-03-02 12:14:45 +01:00
Nicolas Malin 5229d572df Implemented: Element link can update partial area
(OFBIZ-11810)

   Currently when you want to display an information easily on sub-screen
dynamically (example as related element) is currently not possible without
write specific js code.
   To simplify it, we introduce a new link type: update-area, to indicate
to the theme that we want to refresh  a local area with the call result.

   Example :
       <link target="ListCategoryProductMembers" link-type="update-area" target-window="detail">
           <parameter param-name="productCategoryId"/>
       </link>

For this example we indicate that the display result of target 'ListCategoryProductMembers' is going
on the area identify by 'detail'. Pleasure to the theme to manage it.
2021-02-17 18:11:19 +01:00
Wiebke Pätzold 384572401d Improved: Fixed indentation level (OFBIZ-12169) 2021-02-09 14:12:15 +01:00
Wiebke Pätzold 95d37d2189 Removes and adds whitespaces as suggested by checkstyle (OFBIZ-12169) 2021-02-09 08:46:20 +01:00
Michael Brohl bae3628501 Declare classes final as suggested by checkstyle (OFBIZ-12169)
Helper and Worker classes which are likely to be extended by custom
projects where left as is.
2021-02-08 17:09:56 +01:00
Wiebke Pätzold 2fe5e15a83 Improved: Adds newline at the end of file (OFBIZ-12169) 2021-02-08 16:31:13 +01:00
Jacques Le Roux c54dced51c Improved: Improve description encoding in 2 classes: MacroFormRenderer and renderableFtlFormElementsBuilder (OFBIZ-12159)
Concern MacroFormRenderer::makeHyperlinkByType and renderableFtlFormElementsBuilder::encode
I'm not sure it's useful but it's harmless
2021-01-23 18:18:16 +01:00
Jacques Le Roux cb9c366327 Fixed: Ampersand in Party not displayed correctly (OFBIZ-12140)
In the reported case, ModelFormField::getDescription double HTML encodes the
description when both the entity and the description contain an ampersand.

A solution is to test if the description is already HTML encoded before encoding
it again. If HTML encoded then only String encodes it.

BTW I'm not sure it's useful but it's harmless, the same solution can be applied
to OFBIZ-12026 and similarly in renderableFtlFormElementsBuilder::encode. I'll
do as improvements...

Thanks: Andrew Waters for report and help in analysis
2021-01-23 17:56:15 +01:00
Jacques Le Roux 3f76f86014 Improved: Marked unused HTML renderers as deprecated (OFBIZ-11927)
Upcoming Branch is actually another name for trunk. It's always evolving and
never released. Better put a date when deprecating a Class or method. Else you
have no idea when it was deprecated, apart referring to git-blame.
2021-01-16 10:14:28 +01:00
Daniel Watford 406f51d032 Improved: Marked unused HTML renderers as deprecated
(OFBIZ-11927)
2021-01-14 17:30:03 +00:00
Daniel Watford d40081dc86 Improved: Minor changes to reduce checkstyle warnings count 2021-01-13 14:28:19 +00:00
James Yong 9c7dc7b877 Improved: Rename MultiBlockHtmlTemplateUtil to ScriptLinkHelper (OFBIZ-12134)
Rename + Refactor
2021-01-13 09:26:42 +08:00
Nicolas Malin e0a840a0c4 Implemented: Access to the current screen from any widget element
(OFBIZ-11809)

During the rendering process, an element have no information about the screen which is dependent from. This not really help to automate some refresh treatment and force the developer to know the screen structure where is the element.

To solve this situation we implement a new class, ScreenStack that allow anytime for any element to identify its direct dependency. This help to resolve the unique Id that the screen take and can be used by the theme.

At any time a developer can retrieve the screen reference with uel function screen:id(screenStack)

example:
     <container id="${screen:id(screenStack)}">

The object screenStack is always present during a rendering process.
2021-01-12 17:48:00 +01:00