You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Adrian Crum (JIRA)" <ji...@apache.org> on 2008/02/15 21:12:08 UTC

[jira] Updated: (OFBIZ-1648) Sandbox: Improved Screen Widgets, adding 3rd party rendering library support

     [ https://issues.apache.org/jira/browse/OFBIZ-1648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum updated OFBIZ-1648:
-------------------------------

    Attachment: widget_improvements.patch

The attached patch might look like a major refactoring, but it's not. I made a few simple changes, but those changes affected a lot of files.

My goal is to make the screen widgets more flexible and more easily extended and enhanced. So, I made the following changes:

Model Widgets
-------------
1. Have the model widget base class (ModelWidget.java) implement a basic interface (WidgetModel.java) so that the interface can be passed around instead of a reference to the concrete class.

2. Added the generic renderWidgetString(Writer writer, Map<String, Object> context, WidgetStringRenderer stringRenderer) method to each model class and mapped their existing render methods to it. The problem with the existing model widgets is they each have their own method name for the rendering function, and those methods threw different exceptions. That makes it impossible to interact with the various model widgets in a generic way. This change fixes that.

The WidgetStringRenderer argument is a generic interface that each widget rendering interface extends from. Model widgets cast the WidgetStringRenderer argument into the appropriate interface for their use.

3. Added get/set methods for model widget subwidgets. This hasn't been fully implemented. The basic idea is to have the capability for container widgets to query subwidgets - even in contained screens, etc.

4. Added a static factory method to ModelWidget for creating rendering class instances. This lays the groundwork for 3rd party rendering libraries. The method looks up the rendering class type in widgetRenderingClasses.properties, and creates an instance of the specified class.

One of the things I hope to avoid in adding support for 3rd party rendering libraries is having us paint ourselves into a corner. Right now the patch is set up to use the existing HtmlXxxRenderer classes. If someone wanted to add Dojo support for instance, they can write the classes for it and update widgetRenderingClasses.properties to use the new classes. If years later the support for Dojo drops off, all we have to do is revert the widgetRenderingClasses.properties file back to the original HtmlXxxxRenderer classes.

5. Cleaned up some compiler warnings.

HTML Rendering Classes
----------------------
Added a generic interface (WidgetStringRenderer.java) that all of the rendering interfaces extend from.

--------------

If you apply this patch and run OFBiz, nothing should happen differently. All functionality has remained the same.

This patch is a rough draft. I'll wait for comments/suggestions, then I'll clean it up and commit it if there are no objections.


> Sandbox: Improved Screen Widgets, adding 3rd party rendering library support
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-1648
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1648
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Adrian Crum
>            Priority: Minor
>         Attachments: widget_improvements.patch
>
>
> Discuss screen widget modifications and enhancements that will make the screen widgets more robust. Everyone is welcome to review and comment.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.