[jira] [Commented] (OFBIZ-11907) WidgetWorker should not write generated html to Appendable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-11907) WidgetWorker should not write generated html to Appendable

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-11907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17169033#comment-17169033 ]

ASF subversion and git services commented on OFBIZ-11907:
---------------------------------------------------------

Commit 9f3e52e7ab5f1aa32d30875d5ab9100e008f00bf in ofbiz-framework's branch refs/heads/trunk from Daniel Watford
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=9f3e52e ]

Improved: WidgetWorker should not write generated html to Appendable (OFBIZ-11907) (#221)

* Improved: WidgetWorker should not write generated html to Appendable

(OFBIZ-11907)

Refactoring of WidgetWorker so that it generates URI and JSoup Element
objects to represent created URLs, hidden forms and anchor tags. This
replaces the previous approach where WidgetWorker would write string
representations of the URLS, hidden forms and anchor tags directly to an
Appendable object passed to it.

Callers to WidgetWorker have been modified to render the new objects
created by WidgetWorker to their relevant I/O.

* Improved: Handle spaces in link targets when building URIs

(OFBIZ-11907)

Corrected handling of spaces in target values passed to WidgetWorker
when bulding URIs. Spaces are URL encoded as %20.

> WidgetWorker should not write generated html to Appendable
> ----------------------------------------------------------
>
>                 Key: OFBIZ-11907
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-11907
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework/widget
>            Reporter: Daniel Watford
>            Assignee: Daniel Watford
>            Priority: Minor
>
> WidgetWorker is used to create URLs, anchor links and hidden forms (to support hidden-form links). 
> WidgetWorker doesn't just generate these elements but it also writes those elements to an Appendable object normally passed to it from classes like MacroScreenRenderer and MacroFormRenderer.
> Requiring that an Appendable is passed to WidgetWorker unnecessarily forces behaviour onto the calling classes, when all that is really required is for the WidgetWorker to create the elements it has been asked. Calling classes can write the created elements to I/O as they see fit.
> Further, WidgetWorker produces HTML elements rendered to string. By doing this WidgetWorker has assumed knowledge about how the elements are to be used (i.e. within an FTL macro parameter call) and has to apply appropriate encoding.
> Rather than rendering a string, WidgetWorker should create data structures, such as JSoup's elements, to represent the requested elements. The calling classes can then decide how/where to render the elements.
> The above changes are deemed necessary to allow the refactoring of MacroFormRenderer to proceed, as otherwise MacroFormRenderer will have to ensure knowledge of where elements are to be rendered is maintained in order for this information to be passed to WidgetWorker. This is not in-line with the refactoring efforts targeting MacroFormRenderer.
> This changes will reduce the responsibilities of WidgetWorker. It shall be responsible for creating data structures to represent requested elements, without needing to know how to render those elements to a string or other I/O channel.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)