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>
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
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
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
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
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
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.
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.
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
This prevented to run the stable demo, hence the next, weirdly the trunk had
not this problem. Anyway better safe than sorry... Maybe related to Gradle
version or rather libs loaded?
The reason why the stable (and old) demos were not running is because the
EntitySaxReaderTests did not pass
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
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
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
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.
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.
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.
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
(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.
(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
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
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
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
(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.
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
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.
(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.
fields
(OFBIZ-11900)
New RenderableFtl elements to represent pre-rendered FTL strings and FTL
macro calls. RenderableFtl elements are able to render themselves to
strings which are processed as an FTL template by the FtlWriter class.
For labels, display fields and text fields, MacroFormRenderer no longer
generates FTL to write to a template itself, but instead calls
RenderableFtlFormElementsBuilder to create corresponding RenderableFtl
elements which are then processed by FtlWriter. This is a WIP to reduce
complexity in MacroFormRenderer.