You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2010/04/07 05:51:03 UTC

svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Author: lektran
Date: Wed Apr  7 03:51:02 2010
New Revision: 931422

URL: http://svn.apache.org/viewvc?rev=931422&view=rev
Log:
Remove some unnecessary casts

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
@@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
         if (shortDateInput) {
             size = maxlength = 10;
             if (uiLabelMap != null) {
-                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
+                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
             }
         } else if ("time".equals(dateTimeField.getType())) {
             size = maxlength = 8;
             if (uiLabelMap != null) {
-                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
+                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
             }
         } else {
             if (uiLabelMap != null) {
-                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
+                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
             }
         }
         writer.append(" title=\"");
@@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
 
         // search for a localized label for the icon
         if (uiLabelMap != null) {
-            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
+            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
         }
 
         // add calendar pop-up button and seed data IF this is not a "time" type date-time
@@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
         if ("date".equals(dateFindField.getType())) {
             size = maxlength = 10;
             if (uiLabelMap != null) {
-                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
+                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
             }
         } else if ("time".equals(dateFindField.getType())) {
             size = maxlength = 8;
             if (uiLabelMap != null) {
-                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
+                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
             }
         } else {
             if (uiLabelMap != null) {
-                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
+                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
             }
         }
         writer.append(" title=\"");
@@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
 
         // search for a localized label for the icon
         if (uiLabelMap != null) {
-            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
+            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
         }
 
         // add calendar pop-up button and seed data IF this is not a "time" type date-find
@@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
         if (uiLabelMap == null) {
             Debug.logWarning("Could not find uiLabelMap in context", module);
         } else {
-            pageLabel = (String) uiLabelMap.get("CommonPage");
+            pageLabel = uiLabelMap.get("CommonPage");
             Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
             commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
         }



Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Adam Heath <do...@brainfood.com>.
Bob Morley wrote:
> Ultimately, it may be good for the Ofbiz project to firmly define what they
> consider public API and what is considered internal framework.  (Perhaps
> this has been done and it is all considered public API)  But knowing the
> clear definition of what our end-users can expect the concrete interface is
> would allow us more freedom under the covers and as a well behaving
> application, what should not be changed without a higher level of end-user
> impact analysis.

I feel the same.  UtilCache is a public api, but
CacheLine/CacheLineTable are internal.  As such, my recent changes did
major work, without care as to how others might be using the latter
two classes.


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 7/04/2010, at 12:03 AM, Bob Morley wrote:

> 
> 
> Scott Gray-2 wrote:
>> 
>> On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:
>>> I think it is now time to remove the HtmlFormRenderer and
>>> HtmlScreenRenderer (and the corresponding ViewHandler); they are no more
>>> used...
>> 
> 
> My personal view is this is a big +1 ... however, is there going to be a
> conversation regarding proper project management and if these should be
> depreciated for a release before they are removed?

It can certainly be deprecated instead of removed, the key thing is to remove the burden that we have to implement any new widget feature twice, once for the Macro renderers and then again for the Htmls.

> As an end-user I know these being dropped would cause us a major issue (as
> we have extended them quite radically).  However, as a developer I would
> have deemed that they are part of the infrastructure in Ofbiz (as opposed to
> the public API) and we were taking our own risk by relying on their
> existence in our code.  

Unless you have a branch revision prior to the last release branch, then it is quite unfortunate that you chose to reactivate and modify the wrong renderer.

Regards
Scott

Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Bob Morley <rm...@emforium.com>.

Scott Gray-2 wrote:
> 
> On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:
>> I think it is now time to remove the HtmlFormRenderer and
>> HtmlScreenRenderer (and the corresponding ViewHandler); they are no more
>> used...
> 

My personal view is this is a big +1 ... however, is there going to be a
conversation regarding proper project management and if these should be
depreciated for a release before they are removed?

As an end-user I know these being dropped would cause us a major issue (as
we have extended them quite radically).  However, as a developer I would
have deemed that they are part of the infrastructure in Ofbiz (as opposed to
the public API) and we were taking our own risk by relying on their
existence in our code.  

Ultimately, it may be good for the Ofbiz project to firmly define what they
consider public API and what is considered internal framework.  (Perhaps
this has been done and it is all considered public API)  But knowing the
clear definition of what our end-users can expect the concrete interface is
would allow us more freedom under the covers and as a well behaving
application, what should not be changed without a higher level of end-user
impact analysis.
-- 
View this message in context: http://n4.nabble.com/Re-svn-commit-r931422-ofbiz-trunk-framework-widget-src-org-ofbiz-widget-html-HtmlFormRenderer-java-tp1753868p1753897.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
excellent, thank you Scott.

On Apr 9, 2010, at 1:52 AM, Scott Gray wrote:

> Fixed in r932171 and r932172
> 
> The problem was that the content component's ContentMapFacade tries to use a StringWriter to render it's content and if that content contains any screens or forms then the StringWriter was ignored by the macro renderers which always used the writer passed in when they were created which is usually the response writer.  That caused any screens and forms rendered via a ContentMapFacade object to be written to the response *before* anything using the StringWriter.
> 
> I tried simply passing the correct writer to the executeMacro calls but is was too slow because a new Environment object was created and processed for every macro so I ended up making it so that we have a single Environment for each writer.
> 
> Regards
> Scott
> 
> On 8/04/2010, at 1:29 PM, Scott Gray wrote:
> 
>> I wouldn't worry too much, I have to fix it before I can proceed with what I was working on (a bug in form rendering).
>> 
>> But there is definitely some bugs in how the macro render works, I guess it's only showing up because I'm dealing with a fairly complicated mix of content, screens, forms and templates.
>> 
>> Regards
>> Scott
>> 
>> On 8/04/2010, at 1:00 PM, Jacopo Cappellato wrote:
>> 
>>> Hmmm, I am sorry to hear this; if I find out some free time I will do the same.
>>> 
>>> Thanks for testing it by the way.
>>> 
>>> Jacopo
>>> 
>>> On Apr 8, 2010, at 7:56 PM, Scott Gray wrote:
>>> 
>>>> Thanks Jacopo, I've applied the patch and unfortunately it isn't working properly but I'll keep digging and get it figured out.
>>>> 
>>>> So far the problem seems to be that if I try to render content with a SCREEN_COMBINED dataResourceTypeId from within a freemarker template (using ${thisContent} for example) then the content is sent to the response before the template that is rendering it :-/
>>>> 
>>>> Regards
>>>> Scott
>>>> 
>>>> On 7/04/2010, at 4:32 AM, Jacopo Cappellato wrote:
>>>> 
>>>>> Here is the patch:
>>>>> 
>>>>> Index: applications/content/src/org/ofbiz/content/cms/CmsEvents.java
>>>>> ===================================================================
>>>>> --- applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(revision 931438)
>>>>> +++ applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(working copy)
>>>>> @@ -33,12 +33,15 @@
>>>>> import javax.servlet.http.HttpServletResponse;
>>>>> import javax.servlet.http.HttpSession;
>>>>> 
>>>>> +import freemarker.template.TemplateException;
>>>>> +
>>>>> import org.ofbiz.base.util.Debug;
>>>>> import org.ofbiz.base.util.GeneralException;
>>>>> import org.ofbiz.base.util.GeneralRuntimeException;
>>>>> import org.ofbiz.base.util.UtilHttp;
>>>>> import org.ofbiz.base.util.UtilJ2eeCompat;
>>>>> import org.ofbiz.base.util.UtilMisc;
>>>>> +import org.ofbiz.base.util.UtilProperties;
>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>> import org.ofbiz.base.util.collections.MapStack;
>>>>> import org.ofbiz.content.content.ContentWorker;
>>>>> @@ -49,7 +52,8 @@
>>>>> import org.ofbiz.service.LocalDispatcher;
>>>>> import org.ofbiz.webapp.control.RequestHandler;
>>>>> import org.ofbiz.webapp.website.WebSiteWorker;
>>>>> -import org.ofbiz.widget.html.HtmlFormRenderer;
>>>>> +import org.ofbiz.widget.form.FormStringRenderer;
>>>>> +import org.ofbiz.widget.form.MacroFormRenderer;
>>>>> import org.ofbiz.widget.screen.ScreenRenderer;
>>>>> 
>>>>> 
>>>>> @@ -249,7 +253,6 @@
>>>>>             // create the template map
>>>>>             MapStack<String> templateMap = MapStack.create();
>>>>>             ScreenRenderer.populateContextForRequest(templateMap, null, request, response, servletContext);
>>>>> -                templateMap.put("formStringRenderer", new HtmlFormRenderer(request, response));
>>>>>             templateMap.put("statusCode", statusCode);
>>>>> 
>>>>>             // make the link prefix
>>>>> @@ -276,6 +279,9 @@
>>>>>                 } else {
>>>>>                     writer = response.getWriter();
>>>>>                 }
>>>>> +                    // TODO: replace "screen" to support dynamic rendering of different output
>>>>> +                    FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".formrenderer"), writer, request, response);
>>>>> +                    templateMap.put("formStringRenderer", formStringRenderer);
>>>>> 
>>>>>                 // render
>>>>>                 if (UtilValidate.isEmpty(mapKey)) {
>>>>> @@ -284,6 +290,8 @@
>>>>>                     ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, writer, mapKey, templateMap, locale, "text/html", true);
>>>>>                 }
>>>>> 
>>>>> +                } catch (TemplateException e) {
>>>>> +                    throw new GeneralRuntimeException("Error creating form renderer", e);
>>>>>             } catch (IOException e) {
>>>>>                 throw new GeneralRuntimeException("Error in the response writer/output stream: " + e.toString(), e);
>>>>>             } catch (GeneralException e) {
>>>>> Index: applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
>>>>> ===================================================================
>>>>> --- applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(revision 931438)
>>>>> +++ applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(working copy)
>>>>> @@ -70,10 +70,10 @@
>>>>> import org.ofbiz.entity.GenericValue;
>>>>> import org.ofbiz.service.GenericServiceException;
>>>>> import org.ofbiz.service.LocalDispatcher;
>>>>> -import org.ofbiz.widget.html.HtmlScreenRenderer;
>>>>> import org.ofbiz.widget.screen.ModelScreen;
>>>>> import org.ofbiz.widget.screen.ScreenFactory;
>>>>> import org.ofbiz.widget.screen.ScreenRenderer;
>>>>> +import org.ofbiz.widget.screen.MacroScreenRenderer;
>>>>> import org.ofbiz.widget.screen.ScreenStringRenderer;
>>>>> import org.w3c.dom.Document;
>>>>> import org.xml.sax.SAXException;
>>>>> @@ -692,7 +692,9 @@
>>>>>                 // get the screen renderer; or create a new one
>>>>>                 ScreenRenderer screens = (ScreenRenderer) context.get("screens");
>>>>>                 if (screens == null) {
>>>>> -                        screens = new ScreenRenderer(out, context, new HtmlScreenRenderer());
>>>>> +                        // TODO: replace "screen" to support dynamic rendering of different output
>>>>> +                        ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".name"), UtilProperties.getPropertyValue("widget", "screen" + ".screenrenderer"), out);
>>>>> +                        screens = new ScreenRenderer(out, context, screenStringRenderer);
>>>>>                     screens.getContext().put("screens", screens);
>>>>>                 }
>>>>>                 // render the screen
>>>>> @@ -718,6 +720,8 @@
>>>>>                 throw new GeneralException("Error rendering Screen template", e);
>>>>>             } catch (ParserConfigurationException e) {
>>>>>                 throw new GeneralException("Error rendering Screen template", e);
>>>>> +                } catch (TemplateException e) {
>>>>> +                    throw new GeneralException("Error creating Screen renderer", e);
>>>>>             }
>>>>>         } else {
>>>>>             throw new GeneralException("The dataTemplateTypeId [" + dataTemplateTypeId + "] is not yet supported");
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On Apr 7, 2010, at 12:29 PM, Jacopo Cappellato wrote:
>>>>> 
>>>>>> Thank you Scott.
>>>>>> The attached patch (not tested and that probably needs some minor cleanup) should remove the dependencies.
>>>>>> I hope it helps
>>>>>> 
>>>>>> Jacopo
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Apr 7, 2010, at 7:03 AM, Scott Gray wrote:
>>>>>> 
>>>>>>> Big plus one :-)
>>>>>>> 
>>>>>>> I think content component may still be using some of the html renderer stuff though, I'll try and make a point to deal with that within the next week or so.
>>>>>>> 
>>>>>>> Regards
>>>>>>> Scott
>>>>>>> 
>>>>>>> HotWax Media
>>>>>>> http://www.hotwaxmedia.com
>>>>>>> 
>>>>>>> On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:
>>>>>>> 
>>>>>>>> I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...
>>>>>>>> 
>>>>>>>> Jacopo
>>>>>>>> 
>>>>>>>> On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:
>>>>>>>> 
>>>>>>>>> Author: lektran
>>>>>>>>> Date: Wed Apr  7 03:51:02 2010
>>>>>>>>> New Revision: 931422
>>>>>>>>> 
>>>>>>>>> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
>>>>>>>>> Log:
>>>>>>>>> Remove some unnecessary casts
>>>>>>>>> 
>>>>>>>>> Modified:
>>>>>>>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>>>>>> 
>>>>>>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
>>>>>>>>> ==============================================================================
>>>>>>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
>>>>>>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
>>>>>>>>> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>>>>>>>>> if (shortDateInput) {
>>>>>>>>>     size = maxlength = 10;
>>>>>>>>>     if (uiLabelMap != null) {
>>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>>>>>     }
>>>>>>>>> } else if ("time".equals(dateTimeField.getType())) {
>>>>>>>>>     size = maxlength = 8;
>>>>>>>>>     if (uiLabelMap != null) {
>>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>>>>>     }
>>>>>>>>> } else {
>>>>>>>>>     if (uiLabelMap != null) {
>>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>>>>>     }
>>>>>>>>> }
>>>>>>>>> writer.append(" title=\"");
>>>>>>>>> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>>>> 
>>>>>>>>> // search for a localized label for the icon
>>>>>>>>> if (uiLabelMap != null) {
>>>>>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>>>>> }
>>>>>>>>> 
>>>>>>>>> // add calendar pop-up button and seed data IF this is not a "time" type date-time
>>>>>>>>> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>>>>>>>>> if ("date".equals(dateFindField.getType())) {
>>>>>>>>>     size = maxlength = 10;
>>>>>>>>>     if (uiLabelMap != null) {
>>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>>>>>     }
>>>>>>>>> } else if ("time".equals(dateFindField.getType())) {
>>>>>>>>>     size = maxlength = 8;
>>>>>>>>>     if (uiLabelMap != null) {
>>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>>>>>     }
>>>>>>>>> } else {
>>>>>>>>>     if (uiLabelMap != null) {
>>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>>>>>     }
>>>>>>>>> }
>>>>>>>>> writer.append(" title=\"");
>>>>>>>>> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>>>> 
>>>>>>>>> // search for a localized label for the icon
>>>>>>>>> if (uiLabelMap != null) {
>>>>>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>>>>> }
>>>>>>>>> 
>>>>>>>>> // add calendar pop-up button and seed data IF this is not a "time" type date-find
>>>>>>>>> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>>>> if (uiLabelMap == null) {
>>>>>>>>>     Debug.logWarning("Could not find uiLabelMap in context", module);
>>>>>>>>> } else {
>>>>>>>>> -            pageLabel = (String) uiLabelMap.get("CommonPage");
>>>>>>>>> +            pageLabel = uiLabelMap.get("CommonPage");
>>>>>>>>>     Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>>>>>>>>>     commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>>>>>>>>> }
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Fixed in r932171 and r932172

The problem was that the content component's ContentMapFacade tries to use a StringWriter to render it's content and if that content contains any screens or forms then the StringWriter was ignored by the macro renderers which always used the writer passed in when they were created which is usually the response writer.  That caused any screens and forms rendered via a ContentMapFacade object to be written to the response *before* anything using the StringWriter.

I tried simply passing the correct writer to the executeMacro calls but is was too slow because a new Environment object was created and processed for every macro so I ended up making it so that we have a single Environment for each writer.

Regards
Scott

On 8/04/2010, at 1:29 PM, Scott Gray wrote:

> I wouldn't worry too much, I have to fix it before I can proceed with what I was working on (a bug in form rendering).
> 
> But there is definitely some bugs in how the macro render works, I guess it's only showing up because I'm dealing with a fairly complicated mix of content, screens, forms and templates.
> 
> Regards
> Scott
> 
> On 8/04/2010, at 1:00 PM, Jacopo Cappellato wrote:
> 
>> Hmmm, I am sorry to hear this; if I find out some free time I will do the same.
>> 
>> Thanks for testing it by the way.
>> 
>> Jacopo
>> 
>> On Apr 8, 2010, at 7:56 PM, Scott Gray wrote:
>> 
>>> Thanks Jacopo, I've applied the patch and unfortunately it isn't working properly but I'll keep digging and get it figured out.
>>> 
>>> So far the problem seems to be that if I try to render content with a SCREEN_COMBINED dataResourceTypeId from within a freemarker template (using ${thisContent} for example) then the content is sent to the response before the template that is rendering it :-/
>>> 
>>> Regards
>>> Scott
>>> 
>>> On 7/04/2010, at 4:32 AM, Jacopo Cappellato wrote:
>>> 
>>>> Here is the patch:
>>>> 
>>>> Index: applications/content/src/org/ofbiz/content/cms/CmsEvents.java
>>>> ===================================================================
>>>> --- applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(revision 931438)
>>>> +++ applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(working copy)
>>>> @@ -33,12 +33,15 @@
>>>> import javax.servlet.http.HttpServletResponse;
>>>> import javax.servlet.http.HttpSession;
>>>> 
>>>> +import freemarker.template.TemplateException;
>>>> +
>>>> import org.ofbiz.base.util.Debug;
>>>> import org.ofbiz.base.util.GeneralException;
>>>> import org.ofbiz.base.util.GeneralRuntimeException;
>>>> import org.ofbiz.base.util.UtilHttp;
>>>> import org.ofbiz.base.util.UtilJ2eeCompat;
>>>> import org.ofbiz.base.util.UtilMisc;
>>>> +import org.ofbiz.base.util.UtilProperties;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> import org.ofbiz.base.util.collections.MapStack;
>>>> import org.ofbiz.content.content.ContentWorker;
>>>> @@ -49,7 +52,8 @@
>>>> import org.ofbiz.service.LocalDispatcher;
>>>> import org.ofbiz.webapp.control.RequestHandler;
>>>> import org.ofbiz.webapp.website.WebSiteWorker;
>>>> -import org.ofbiz.widget.html.HtmlFormRenderer;
>>>> +import org.ofbiz.widget.form.FormStringRenderer;
>>>> +import org.ofbiz.widget.form.MacroFormRenderer;
>>>> import org.ofbiz.widget.screen.ScreenRenderer;
>>>> 
>>>> 
>>>> @@ -249,7 +253,6 @@
>>>>              // create the template map
>>>>              MapStack<String> templateMap = MapStack.create();
>>>>              ScreenRenderer.populateContextForRequest(templateMap, null, request, response, servletContext);
>>>> -                templateMap.put("formStringRenderer", new HtmlFormRenderer(request, response));
>>>>              templateMap.put("statusCode", statusCode);
>>>> 
>>>>              // make the link prefix
>>>> @@ -276,6 +279,9 @@
>>>>                  } else {
>>>>                      writer = response.getWriter();
>>>>                  }
>>>> +                    // TODO: replace "screen" to support dynamic rendering of different output
>>>> +                    FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".formrenderer"), writer, request, response);
>>>> +                    templateMap.put("formStringRenderer", formStringRenderer);
>>>> 
>>>>                  // render
>>>>                  if (UtilValidate.isEmpty(mapKey)) {
>>>> @@ -284,6 +290,8 @@
>>>>                      ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, writer, mapKey, templateMap, locale, "text/html", true);
>>>>                  }
>>>> 
>>>> +                } catch (TemplateException e) {
>>>> +                    throw new GeneralRuntimeException("Error creating form renderer", e);
>>>>              } catch (IOException e) {
>>>>                  throw new GeneralRuntimeException("Error in the response writer/output stream: " + e.toString(), e);
>>>>              } catch (GeneralException e) {
>>>> Index: applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
>>>> ===================================================================
>>>> --- applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(revision 931438)
>>>> +++ applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(working copy)
>>>> @@ -70,10 +70,10 @@
>>>> import org.ofbiz.entity.GenericValue;
>>>> import org.ofbiz.service.GenericServiceException;
>>>> import org.ofbiz.service.LocalDispatcher;
>>>> -import org.ofbiz.widget.html.HtmlScreenRenderer;
>>>> import org.ofbiz.widget.screen.ModelScreen;
>>>> import org.ofbiz.widget.screen.ScreenFactory;
>>>> import org.ofbiz.widget.screen.ScreenRenderer;
>>>> +import org.ofbiz.widget.screen.MacroScreenRenderer;
>>>> import org.ofbiz.widget.screen.ScreenStringRenderer;
>>>> import org.w3c.dom.Document;
>>>> import org.xml.sax.SAXException;
>>>> @@ -692,7 +692,9 @@
>>>>                  // get the screen renderer; or create a new one
>>>>                  ScreenRenderer screens = (ScreenRenderer) context.get("screens");
>>>>                  if (screens == null) {
>>>> -                        screens = new ScreenRenderer(out, context, new HtmlScreenRenderer());
>>>> +                        // TODO: replace "screen" to support dynamic rendering of different output
>>>> +                        ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".name"), UtilProperties.getPropertyValue("widget", "screen" + ".screenrenderer"), out);
>>>> +                        screens = new ScreenRenderer(out, context, screenStringRenderer);
>>>>                      screens.getContext().put("screens", screens);
>>>>                  }
>>>>                  // render the screen
>>>> @@ -718,6 +720,8 @@
>>>>                  throw new GeneralException("Error rendering Screen template", e);
>>>>              } catch (ParserConfigurationException e) {
>>>>                  throw new GeneralException("Error rendering Screen template", e);
>>>> +                } catch (TemplateException e) {
>>>> +                    throw new GeneralException("Error creating Screen renderer", e);
>>>>              }
>>>>          } else {
>>>>              throw new GeneralException("The dataTemplateTypeId [" + dataTemplateTypeId + "] is not yet supported");
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On Apr 7, 2010, at 12:29 PM, Jacopo Cappellato wrote:
>>>> 
>>>>> Thank you Scott.
>>>>> The attached patch (not tested and that probably needs some minor cleanup) should remove the dependencies.
>>>>> I hope it helps
>>>>> 
>>>>> Jacopo
>>>>> 
>>>>> 
>>>>> 
>>>>> On Apr 7, 2010, at 7:03 AM, Scott Gray wrote:
>>>>> 
>>>>>> Big plus one :-)
>>>>>> 
>>>>>> I think content component may still be using some of the html renderer stuff though, I'll try and make a point to deal with that within the next week or so.
>>>>>> 
>>>>>> Regards
>>>>>> Scott
>>>>>> 
>>>>>> HotWax Media
>>>>>> http://www.hotwaxmedia.com
>>>>>> 
>>>>>> On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:
>>>>>> 
>>>>>>> I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...
>>>>>>> 
>>>>>>> Jacopo
>>>>>>> 
>>>>>>> On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:
>>>>>>> 
>>>>>>>> Author: lektran
>>>>>>>> Date: Wed Apr  7 03:51:02 2010
>>>>>>>> New Revision: 931422
>>>>>>>> 
>>>>>>>> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
>>>>>>>> Log:
>>>>>>>> Remove some unnecessary casts
>>>>>>>> 
>>>>>>>> Modified:
>>>>>>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>>>>> 
>>>>>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
>>>>>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
>>>>>>>> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>>>>>>>>  if (shortDateInput) {
>>>>>>>>      size = maxlength = 10;
>>>>>>>>      if (uiLabelMap != null) {
>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>>>>      }
>>>>>>>>  } else if ("time".equals(dateTimeField.getType())) {
>>>>>>>>      size = maxlength = 8;
>>>>>>>>      if (uiLabelMap != null) {
>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>>>>      }
>>>>>>>>  } else {
>>>>>>>>      if (uiLabelMap != null) {
>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>>>>      }
>>>>>>>>  }
>>>>>>>>  writer.append(" title=\"");
>>>>>>>> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>>> 
>>>>>>>>  // search for a localized label for the icon
>>>>>>>>  if (uiLabelMap != null) {
>>>>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>>>>  }
>>>>>>>> 
>>>>>>>>  // add calendar pop-up button and seed data IF this is not a "time" type date-time
>>>>>>>> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>>>>>>>>  if ("date".equals(dateFindField.getType())) {
>>>>>>>>      size = maxlength = 10;
>>>>>>>>      if (uiLabelMap != null) {
>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>>>>      }
>>>>>>>>  } else if ("time".equals(dateFindField.getType())) {
>>>>>>>>      size = maxlength = 8;
>>>>>>>>      if (uiLabelMap != null) {
>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>>>>      }
>>>>>>>>  } else {
>>>>>>>>      if (uiLabelMap != null) {
>>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>>>>      }
>>>>>>>>  }
>>>>>>>>  writer.append(" title=\"");
>>>>>>>> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>>> 
>>>>>>>>  // search for a localized label for the icon
>>>>>>>>  if (uiLabelMap != null) {
>>>>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>>>>  }
>>>>>>>> 
>>>>>>>>  // add calendar pop-up button and seed data IF this is not a "time" type date-find
>>>>>>>> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>>>  if (uiLabelMap == null) {
>>>>>>>>      Debug.logWarning("Could not find uiLabelMap in context", module);
>>>>>>>>  } else {
>>>>>>>> -            pageLabel = (String) uiLabelMap.get("CommonPage");
>>>>>>>> +            pageLabel = uiLabelMap.get("CommonPage");
>>>>>>>>      Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>>>>>>>>      commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>>>>>>>>  }
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
I wouldn't worry too much, I have to fix it before I can proceed with what I was working on (a bug in form rendering).

But there is definitely some bugs in how the macro render works, I guess it's only showing up because I'm dealing with a fairly complicated mix of content, screens, forms and templates.

Regards
Scott

On 8/04/2010, at 1:00 PM, Jacopo Cappellato wrote:

> Hmmm, I am sorry to hear this; if I find out some free time I will do the same.
> 
> Thanks for testing it by the way.
> 
> Jacopo
> 
> On Apr 8, 2010, at 7:56 PM, Scott Gray wrote:
> 
>> Thanks Jacopo, I've applied the patch and unfortunately it isn't working properly but I'll keep digging and get it figured out.
>> 
>> So far the problem seems to be that if I try to render content with a SCREEN_COMBINED dataResourceTypeId from within a freemarker template (using ${thisContent} for example) then the content is sent to the response before the template that is rendering it :-/
>> 
>> Regards
>> Scott
>> 
>> On 7/04/2010, at 4:32 AM, Jacopo Cappellato wrote:
>> 
>>> Here is the patch:
>>> 
>>> Index: applications/content/src/org/ofbiz/content/cms/CmsEvents.java
>>> ===================================================================
>>> --- applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(revision 931438)
>>> +++ applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(working copy)
>>> @@ -33,12 +33,15 @@
>>> import javax.servlet.http.HttpServletResponse;
>>> import javax.servlet.http.HttpSession;
>>> 
>>> +import freemarker.template.TemplateException;
>>> +
>>> import org.ofbiz.base.util.Debug;
>>> import org.ofbiz.base.util.GeneralException;
>>> import org.ofbiz.base.util.GeneralRuntimeException;
>>> import org.ofbiz.base.util.UtilHttp;
>>> import org.ofbiz.base.util.UtilJ2eeCompat;
>>> import org.ofbiz.base.util.UtilMisc;
>>> +import org.ofbiz.base.util.UtilProperties;
>>> import org.ofbiz.base.util.UtilValidate;
>>> import org.ofbiz.base.util.collections.MapStack;
>>> import org.ofbiz.content.content.ContentWorker;
>>> @@ -49,7 +52,8 @@
>>> import org.ofbiz.service.LocalDispatcher;
>>> import org.ofbiz.webapp.control.RequestHandler;
>>> import org.ofbiz.webapp.website.WebSiteWorker;
>>> -import org.ofbiz.widget.html.HtmlFormRenderer;
>>> +import org.ofbiz.widget.form.FormStringRenderer;
>>> +import org.ofbiz.widget.form.MacroFormRenderer;
>>> import org.ofbiz.widget.screen.ScreenRenderer;
>>> 
>>> 
>>> @@ -249,7 +253,6 @@
>>>               // create the template map
>>>               MapStack<String> templateMap = MapStack.create();
>>>               ScreenRenderer.populateContextForRequest(templateMap, null, request, response, servletContext);
>>> -                templateMap.put("formStringRenderer", new HtmlFormRenderer(request, response));
>>>               templateMap.put("statusCode", statusCode);
>>> 
>>>               // make the link prefix
>>> @@ -276,6 +279,9 @@
>>>                   } else {
>>>                       writer = response.getWriter();
>>>                   }
>>> +                    // TODO: replace "screen" to support dynamic rendering of different output
>>> +                    FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".formrenderer"), writer, request, response);
>>> +                    templateMap.put("formStringRenderer", formStringRenderer);
>>> 
>>>                   // render
>>>                   if (UtilValidate.isEmpty(mapKey)) {
>>> @@ -284,6 +290,8 @@
>>>                       ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, writer, mapKey, templateMap, locale, "text/html", true);
>>>                   }
>>> 
>>> +                } catch (TemplateException e) {
>>> +                    throw new GeneralRuntimeException("Error creating form renderer", e);
>>>               } catch (IOException e) {
>>>                   throw new GeneralRuntimeException("Error in the response writer/output stream: " + e.toString(), e);
>>>               } catch (GeneralException e) {
>>> Index: applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
>>> ===================================================================
>>> --- applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(revision 931438)
>>> +++ applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(working copy)
>>> @@ -70,10 +70,10 @@
>>> import org.ofbiz.entity.GenericValue;
>>> import org.ofbiz.service.GenericServiceException;
>>> import org.ofbiz.service.LocalDispatcher;
>>> -import org.ofbiz.widget.html.HtmlScreenRenderer;
>>> import org.ofbiz.widget.screen.ModelScreen;
>>> import org.ofbiz.widget.screen.ScreenFactory;
>>> import org.ofbiz.widget.screen.ScreenRenderer;
>>> +import org.ofbiz.widget.screen.MacroScreenRenderer;
>>> import org.ofbiz.widget.screen.ScreenStringRenderer;
>>> import org.w3c.dom.Document;
>>> import org.xml.sax.SAXException;
>>> @@ -692,7 +692,9 @@
>>>                   // get the screen renderer; or create a new one
>>>                   ScreenRenderer screens = (ScreenRenderer) context.get("screens");
>>>                   if (screens == null) {
>>> -                        screens = new ScreenRenderer(out, context, new HtmlScreenRenderer());
>>> +                        // TODO: replace "screen" to support dynamic rendering of different output
>>> +                        ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".name"), UtilProperties.getPropertyValue("widget", "screen" + ".screenrenderer"), out);
>>> +                        screens = new ScreenRenderer(out, context, screenStringRenderer);
>>>                       screens.getContext().put("screens", screens);
>>>                   }
>>>                   // render the screen
>>> @@ -718,6 +720,8 @@
>>>                   throw new GeneralException("Error rendering Screen template", e);
>>>               } catch (ParserConfigurationException e) {
>>>                   throw new GeneralException("Error rendering Screen template", e);
>>> +                } catch (TemplateException e) {
>>> +                    throw new GeneralException("Error creating Screen renderer", e);
>>>               }
>>>           } else {
>>>               throw new GeneralException("The dataTemplateTypeId [" + dataTemplateTypeId + "] is not yet supported");
>>> 
>>> 
>>> 
>>> 
>>> On Apr 7, 2010, at 12:29 PM, Jacopo Cappellato wrote:
>>> 
>>>> Thank you Scott.
>>>> The attached patch (not tested and that probably needs some minor cleanup) should remove the dependencies.
>>>> I hope it helps
>>>> 
>>>> Jacopo
>>>> 
>>>> 
>>>> 
>>>> On Apr 7, 2010, at 7:03 AM, Scott Gray wrote:
>>>> 
>>>>> Big plus one :-)
>>>>> 
>>>>> I think content component may still be using some of the html renderer stuff though, I'll try and make a point to deal with that within the next week or so.
>>>>> 
>>>>> Regards
>>>>> Scott
>>>>> 
>>>>> HotWax Media
>>>>> http://www.hotwaxmedia.com
>>>>> 
>>>>> On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:
>>>>> 
>>>>>> I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...
>>>>>> 
>>>>>> Jacopo
>>>>>> 
>>>>>> On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:
>>>>>> 
>>>>>>> Author: lektran
>>>>>>> Date: Wed Apr  7 03:51:02 2010
>>>>>>> New Revision: 931422
>>>>>>> 
>>>>>>> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
>>>>>>> Log:
>>>>>>> Remove some unnecessary casts
>>>>>>> 
>>>>>>> Modified:
>>>>>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>>>> 
>>>>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
>>>>>>> ==============================================================================
>>>>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
>>>>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
>>>>>>> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>>>>>>>   if (shortDateInput) {
>>>>>>>       size = maxlength = 10;
>>>>>>>       if (uiLabelMap != null) {
>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>>>       }
>>>>>>>   } else if ("time".equals(dateTimeField.getType())) {
>>>>>>>       size = maxlength = 8;
>>>>>>>       if (uiLabelMap != null) {
>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>>>       }
>>>>>>>   } else {
>>>>>>>       if (uiLabelMap != null) {
>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>>>       }
>>>>>>>   }
>>>>>>>   writer.append(" title=\"");
>>>>>>> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>> 
>>>>>>>   // search for a localized label for the icon
>>>>>>>   if (uiLabelMap != null) {
>>>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>>>   }
>>>>>>> 
>>>>>>>   // add calendar pop-up button and seed data IF this is not a "time" type date-time
>>>>>>> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>>>>>>>   if ("date".equals(dateFindField.getType())) {
>>>>>>>       size = maxlength = 10;
>>>>>>>       if (uiLabelMap != null) {
>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>>>       }
>>>>>>>   } else if ("time".equals(dateFindField.getType())) {
>>>>>>>       size = maxlength = 8;
>>>>>>>       if (uiLabelMap != null) {
>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>>>       }
>>>>>>>   } else {
>>>>>>>       if (uiLabelMap != null) {
>>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>>>       }
>>>>>>>   }
>>>>>>>   writer.append(" title=\"");
>>>>>>> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>> 
>>>>>>>   // search for a localized label for the icon
>>>>>>>   if (uiLabelMap != null) {
>>>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>>>   }
>>>>>>> 
>>>>>>>   // add calendar pop-up button and seed data IF this is not a "time" type date-find
>>>>>>> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>>   if (uiLabelMap == null) {
>>>>>>>       Debug.logWarning("Could not find uiLabelMap in context", module);
>>>>>>>   } else {
>>>>>>> -            pageLabel = (String) uiLabelMap.get("CommonPage");
>>>>>>> +            pageLabel = uiLabelMap.get("CommonPage");
>>>>>>>       Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>>>>>>>       commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>>>>>>>   }
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
Hmmm, I am sorry to hear this; if I find out some free time I will do the same.

Thanks for testing it by the way.

Jacopo

On Apr 8, 2010, at 7:56 PM, Scott Gray wrote:

> Thanks Jacopo, I've applied the patch and unfortunately it isn't working properly but I'll keep digging and get it figured out.
> 
> So far the problem seems to be that if I try to render content with a SCREEN_COMBINED dataResourceTypeId from within a freemarker template (using ${thisContent} for example) then the content is sent to the response before the template that is rendering it :-/
> 
> Regards
> Scott
> 
> On 7/04/2010, at 4:32 AM, Jacopo Cappellato wrote:
> 
>> Here is the patch:
>> 
>> Index: applications/content/src/org/ofbiz/content/cms/CmsEvents.java
>> ===================================================================
>> --- applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(revision 931438)
>> +++ applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(working copy)
>> @@ -33,12 +33,15 @@
>> import javax.servlet.http.HttpServletResponse;
>> import javax.servlet.http.HttpSession;
>> 
>> +import freemarker.template.TemplateException;
>> +
>> import org.ofbiz.base.util.Debug;
>> import org.ofbiz.base.util.GeneralException;
>> import org.ofbiz.base.util.GeneralRuntimeException;
>> import org.ofbiz.base.util.UtilHttp;
>> import org.ofbiz.base.util.UtilJ2eeCompat;
>> import org.ofbiz.base.util.UtilMisc;
>> +import org.ofbiz.base.util.UtilProperties;
>> import org.ofbiz.base.util.UtilValidate;
>> import org.ofbiz.base.util.collections.MapStack;
>> import org.ofbiz.content.content.ContentWorker;
>> @@ -49,7 +52,8 @@
>> import org.ofbiz.service.LocalDispatcher;
>> import org.ofbiz.webapp.control.RequestHandler;
>> import org.ofbiz.webapp.website.WebSiteWorker;
>> -import org.ofbiz.widget.html.HtmlFormRenderer;
>> +import org.ofbiz.widget.form.FormStringRenderer;
>> +import org.ofbiz.widget.form.MacroFormRenderer;
>> import org.ofbiz.widget.screen.ScreenRenderer;
>> 
>> 
>> @@ -249,7 +253,6 @@
>>                // create the template map
>>                MapStack<String> templateMap = MapStack.create();
>>                ScreenRenderer.populateContextForRequest(templateMap, null, request, response, servletContext);
>> -                templateMap.put("formStringRenderer", new HtmlFormRenderer(request, response));
>>                templateMap.put("statusCode", statusCode);
>> 
>>                // make the link prefix
>> @@ -276,6 +279,9 @@
>>                    } else {
>>                        writer = response.getWriter();
>>                    }
>> +                    // TODO: replace "screen" to support dynamic rendering of different output
>> +                    FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".formrenderer"), writer, request, response);
>> +                    templateMap.put("formStringRenderer", formStringRenderer);
>> 
>>                    // render
>>                    if (UtilValidate.isEmpty(mapKey)) {
>> @@ -284,6 +290,8 @@
>>                        ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, writer, mapKey, templateMap, locale, "text/html", true);
>>                    }
>> 
>> +                } catch (TemplateException e) {
>> +                    throw new GeneralRuntimeException("Error creating form renderer", e);
>>                } catch (IOException e) {
>>                    throw new GeneralRuntimeException("Error in the response writer/output stream: " + e.toString(), e);
>>                } catch (GeneralException e) {
>> Index: applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
>> ===================================================================
>> --- applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(revision 931438)
>> +++ applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(working copy)
>> @@ -70,10 +70,10 @@
>> import org.ofbiz.entity.GenericValue;
>> import org.ofbiz.service.GenericServiceException;
>> import org.ofbiz.service.LocalDispatcher;
>> -import org.ofbiz.widget.html.HtmlScreenRenderer;
>> import org.ofbiz.widget.screen.ModelScreen;
>> import org.ofbiz.widget.screen.ScreenFactory;
>> import org.ofbiz.widget.screen.ScreenRenderer;
>> +import org.ofbiz.widget.screen.MacroScreenRenderer;
>> import org.ofbiz.widget.screen.ScreenStringRenderer;
>> import org.w3c.dom.Document;
>> import org.xml.sax.SAXException;
>> @@ -692,7 +692,9 @@
>>                    // get the screen renderer; or create a new one
>>                    ScreenRenderer screens = (ScreenRenderer) context.get("screens");
>>                    if (screens == null) {
>> -                        screens = new ScreenRenderer(out, context, new HtmlScreenRenderer());
>> +                        // TODO: replace "screen" to support dynamic rendering of different output
>> +                        ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".name"), UtilProperties.getPropertyValue("widget", "screen" + ".screenrenderer"), out);
>> +                        screens = new ScreenRenderer(out, context, screenStringRenderer);
>>                        screens.getContext().put("screens", screens);
>>                    }
>>                    // render the screen
>> @@ -718,6 +720,8 @@
>>                    throw new GeneralException("Error rendering Screen template", e);
>>                } catch (ParserConfigurationException e) {
>>                    throw new GeneralException("Error rendering Screen template", e);
>> +                } catch (TemplateException e) {
>> +                    throw new GeneralException("Error creating Screen renderer", e);
>>                }
>>            } else {
>>                throw new GeneralException("The dataTemplateTypeId [" + dataTemplateTypeId + "] is not yet supported");
>> 
>> 
>> 
>> 
>> On Apr 7, 2010, at 12:29 PM, Jacopo Cappellato wrote:
>> 
>>> Thank you Scott.
>>> The attached patch (not tested and that probably needs some minor cleanup) should remove the dependencies.
>>> I hope it helps
>>> 
>>> Jacopo
>>> 
>>> 
>>> 
>>> On Apr 7, 2010, at 7:03 AM, Scott Gray wrote:
>>> 
>>>> Big plus one :-)
>>>> 
>>>> I think content component may still be using some of the html renderer stuff though, I'll try and make a point to deal with that within the next week or so.
>>>> 
>>>> Regards
>>>> Scott
>>>> 
>>>> HotWax Media
>>>> http://www.hotwaxmedia.com
>>>> 
>>>> On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:
>>>> 
>>>>> I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...
>>>>> 
>>>>> Jacopo
>>>>> 
>>>>> On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:
>>>>> 
>>>>>> Author: lektran
>>>>>> Date: Wed Apr  7 03:51:02 2010
>>>>>> New Revision: 931422
>>>>>> 
>>>>>> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
>>>>>> Log:
>>>>>> Remove some unnecessary casts
>>>>>> 
>>>>>> Modified:
>>>>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>>> 
>>>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
>>>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
>>>>>> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>>>>>>    if (shortDateInput) {
>>>>>>        size = maxlength = 10;
>>>>>>        if (uiLabelMap != null) {
>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>>        }
>>>>>>    } else if ("time".equals(dateTimeField.getType())) {
>>>>>>        size = maxlength = 8;
>>>>>>        if (uiLabelMap != null) {
>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>>        }
>>>>>>    } else {
>>>>>>        if (uiLabelMap != null) {
>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>>        }
>>>>>>    }
>>>>>>    writer.append(" title=\"");
>>>>>> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
>>>>>> 
>>>>>>    // search for a localized label for the icon
>>>>>>    if (uiLabelMap != null) {
>>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>>    }
>>>>>> 
>>>>>>    // add calendar pop-up button and seed data IF this is not a "time" type date-time
>>>>>> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>>>>>>    if ("date".equals(dateFindField.getType())) {
>>>>>>        size = maxlength = 10;
>>>>>>        if (uiLabelMap != null) {
>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>>        }
>>>>>>    } else if ("time".equals(dateFindField.getType())) {
>>>>>>        size = maxlength = 8;
>>>>>>        if (uiLabelMap != null) {
>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>>        }
>>>>>>    } else {
>>>>>>        if (uiLabelMap != null) {
>>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>>        }
>>>>>>    }
>>>>>>    writer.append(" title=\"");
>>>>>> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
>>>>>> 
>>>>>>    // search for a localized label for the icon
>>>>>>    if (uiLabelMap != null) {
>>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>>    }
>>>>>> 
>>>>>>    // add calendar pop-up button and seed data IF this is not a "time" type date-find
>>>>>> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>>>>>>    if (uiLabelMap == null) {
>>>>>>        Debug.logWarning("Could not find uiLabelMap in context", module);
>>>>>>    } else {
>>>>>> -            pageLabel = (String) uiLabelMap.get("CommonPage");
>>>>>> +            pageLabel = uiLabelMap.get("CommonPage");
>>>>>>        Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>>>>>>        commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>>>>>>    }
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Thanks Jacopo, I've applied the patch and unfortunately it isn't working properly but I'll keep digging and get it figured out.

So far the problem seems to be that if I try to render content with a SCREEN_COMBINED dataResourceTypeId from within a freemarker template (using ${thisContent} for example) then the content is sent to the response before the template that is rendering it :-/

Regards
Scott

On 7/04/2010, at 4:32 AM, Jacopo Cappellato wrote:

> Here is the patch:
> 
> Index: applications/content/src/org/ofbiz/content/cms/CmsEvents.java
> ===================================================================
> --- applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(revision 931438)
> +++ applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(working copy)
> @@ -33,12 +33,15 @@
> import javax.servlet.http.HttpServletResponse;
> import javax.servlet.http.HttpSession;
> 
> +import freemarker.template.TemplateException;
> +
> import org.ofbiz.base.util.Debug;
> import org.ofbiz.base.util.GeneralException;
> import org.ofbiz.base.util.GeneralRuntimeException;
> import org.ofbiz.base.util.UtilHttp;
> import org.ofbiz.base.util.UtilJ2eeCompat;
> import org.ofbiz.base.util.UtilMisc;
> +import org.ofbiz.base.util.UtilProperties;
> import org.ofbiz.base.util.UtilValidate;
> import org.ofbiz.base.util.collections.MapStack;
> import org.ofbiz.content.content.ContentWorker;
> @@ -49,7 +52,8 @@
> import org.ofbiz.service.LocalDispatcher;
> import org.ofbiz.webapp.control.RequestHandler;
> import org.ofbiz.webapp.website.WebSiteWorker;
> -import org.ofbiz.widget.html.HtmlFormRenderer;
> +import org.ofbiz.widget.form.FormStringRenderer;
> +import org.ofbiz.widget.form.MacroFormRenderer;
> import org.ofbiz.widget.screen.ScreenRenderer;
> 
> 
> @@ -249,7 +253,6 @@
>                 // create the template map
>                 MapStack<String> templateMap = MapStack.create();
>                 ScreenRenderer.populateContextForRequest(templateMap, null, request, response, servletContext);
> -                templateMap.put("formStringRenderer", new HtmlFormRenderer(request, response));
>                 templateMap.put("statusCode", statusCode);
> 
>                 // make the link prefix
> @@ -276,6 +279,9 @@
>                     } else {
>                         writer = response.getWriter();
>                     }
> +                    // TODO: replace "screen" to support dynamic rendering of different output
> +                    FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".formrenderer"), writer, request, response);
> +                    templateMap.put("formStringRenderer", formStringRenderer);
> 
>                     // render
>                     if (UtilValidate.isEmpty(mapKey)) {
> @@ -284,6 +290,8 @@
>                         ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, writer, mapKey, templateMap, locale, "text/html", true);
>                     }
> 
> +                } catch (TemplateException e) {
> +                    throw new GeneralRuntimeException("Error creating form renderer", e);
>                 } catch (IOException e) {
>                     throw new GeneralRuntimeException("Error in the response writer/output stream: " + e.toString(), e);
>                 } catch (GeneralException e) {
> Index: applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
> ===================================================================
> --- applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(revision 931438)
> +++ applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(working copy)
> @@ -70,10 +70,10 @@
> import org.ofbiz.entity.GenericValue;
> import org.ofbiz.service.GenericServiceException;
> import org.ofbiz.service.LocalDispatcher;
> -import org.ofbiz.widget.html.HtmlScreenRenderer;
> import org.ofbiz.widget.screen.ModelScreen;
> import org.ofbiz.widget.screen.ScreenFactory;
> import org.ofbiz.widget.screen.ScreenRenderer;
> +import org.ofbiz.widget.screen.MacroScreenRenderer;
> import org.ofbiz.widget.screen.ScreenStringRenderer;
> import org.w3c.dom.Document;
> import org.xml.sax.SAXException;
> @@ -692,7 +692,9 @@
>                     // get the screen renderer; or create a new one
>                     ScreenRenderer screens = (ScreenRenderer) context.get("screens");
>                     if (screens == null) {
> -                        screens = new ScreenRenderer(out, context, new HtmlScreenRenderer());
> +                        // TODO: replace "screen" to support dynamic rendering of different output
> +                        ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".name"), UtilProperties.getPropertyValue("widget", "screen" + ".screenrenderer"), out);
> +                        screens = new ScreenRenderer(out, context, screenStringRenderer);
>                         screens.getContext().put("screens", screens);
>                     }
>                     // render the screen
> @@ -718,6 +720,8 @@
>                     throw new GeneralException("Error rendering Screen template", e);
>                 } catch (ParserConfigurationException e) {
>                     throw new GeneralException("Error rendering Screen template", e);
> +                } catch (TemplateException e) {
> +                    throw new GeneralException("Error creating Screen renderer", e);
>                 }
>             } else {
>                 throw new GeneralException("The dataTemplateTypeId [" + dataTemplateTypeId + "] is not yet supported");
> 
> 
> 
> 
> On Apr 7, 2010, at 12:29 PM, Jacopo Cappellato wrote:
> 
>> Thank you Scott.
>> The attached patch (not tested and that probably needs some minor cleanup) should remove the dependencies.
>> I hope it helps
>> 
>> Jacopo
>> 
>> 
>> 
>> On Apr 7, 2010, at 7:03 AM, Scott Gray wrote:
>> 
>>> Big plus one :-)
>>> 
>>> I think content component may still be using some of the html renderer stuff though, I'll try and make a point to deal with that within the next week or so.
>>> 
>>> Regards
>>> Scott
>>> 
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>> 
>>> On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:
>>> 
>>>> I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...
>>>> 
>>>> Jacopo
>>>> 
>>>> On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:
>>>> 
>>>>> Author: lektran
>>>>> Date: Wed Apr  7 03:51:02 2010
>>>>> New Revision: 931422
>>>>> 
>>>>> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
>>>>> Log:
>>>>> Remove some unnecessary casts
>>>>> 
>>>>> Modified:
>>>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>> 
>>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
>>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
>>>>> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>>>>>     if (shortDateInput) {
>>>>>         size = maxlength = 10;
>>>>>         if (uiLabelMap != null) {
>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>         }
>>>>>     } else if ("time".equals(dateTimeField.getType())) {
>>>>>         size = maxlength = 8;
>>>>>         if (uiLabelMap != null) {
>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>         }
>>>>>     } else {
>>>>>         if (uiLabelMap != null) {
>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>         }
>>>>>     }
>>>>>     writer.append(" title=\"");
>>>>> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
>>>>> 
>>>>>     // search for a localized label for the icon
>>>>>     if (uiLabelMap != null) {
>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>     }
>>>>> 
>>>>>     // add calendar pop-up button and seed data IF this is not a "time" type date-time
>>>>> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>>>>>     if ("date".equals(dateFindField.getType())) {
>>>>>         size = maxlength = 10;
>>>>>         if (uiLabelMap != null) {
>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>>         }
>>>>>     } else if ("time".equals(dateFindField.getType())) {
>>>>>         size = maxlength = 8;
>>>>>         if (uiLabelMap != null) {
>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>>         }
>>>>>     } else {
>>>>>         if (uiLabelMap != null) {
>>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>>         }
>>>>>     }
>>>>>     writer.append(" title=\"");
>>>>> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
>>>>> 
>>>>>     // search for a localized label for the icon
>>>>>     if (uiLabelMap != null) {
>>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>>     }
>>>>> 
>>>>>     // add calendar pop-up button and seed data IF this is not a "time" type date-find
>>>>> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>>>>>     if (uiLabelMap == null) {
>>>>>         Debug.logWarning("Could not find uiLabelMap in context", module);
>>>>>     } else {
>>>>> -            pageLabel = (String) uiLabelMap.get("CommonPage");
>>>>> +            pageLabel = uiLabelMap.get("CommonPage");
>>>>>         Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>>>>>         commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>>>>>     }
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
Here is the patch:

Index: applications/content/src/org/ofbiz/content/cms/CmsEvents.java
===================================================================
--- applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(revision 931438)
+++ applications/content/src/org/ofbiz/content/cms/CmsEvents.java	(working copy)
@@ -33,12 +33,15 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import freemarker.template.TemplateException;
+
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.GeneralRuntimeException;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilJ2eeCompat;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.collections.MapStack;
 import org.ofbiz.content.content.ContentWorker;
@@ -49,7 +52,8 @@
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.webapp.control.RequestHandler;
 import org.ofbiz.webapp.website.WebSiteWorker;
-import org.ofbiz.widget.html.HtmlFormRenderer;
+import org.ofbiz.widget.form.FormStringRenderer;
+import org.ofbiz.widget.form.MacroFormRenderer;
 import org.ofbiz.widget.screen.ScreenRenderer;
 
 
@@ -249,7 +253,6 @@
                 // create the template map
                 MapStack<String> templateMap = MapStack.create();
                 ScreenRenderer.populateContextForRequest(templateMap, null, request, response, servletContext);
-                templateMap.put("formStringRenderer", new HtmlFormRenderer(request, response));
                 templateMap.put("statusCode", statusCode);
 
                 // make the link prefix
@@ -276,6 +279,9 @@
                     } else {
                         writer = response.getWriter();
                     }
+                    // TODO: replace "screen" to support dynamic rendering of different output
+                    FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".formrenderer"), writer, request, response);
+                    templateMap.put("formStringRenderer", formStringRenderer);
 
                     // render
                     if (UtilValidate.isEmpty(mapKey)) {
@@ -284,6 +290,8 @@
                         ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, writer, mapKey, templateMap, locale, "text/html", true);
                     }
 
+                } catch (TemplateException e) {
+                    throw new GeneralRuntimeException("Error creating form renderer", e);
                 } catch (IOException e) {
                     throw new GeneralRuntimeException("Error in the response writer/output stream: " + e.toString(), e);
                 } catch (GeneralException e) {
Index: applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
===================================================================
--- applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(revision 931438)
+++ applications/content/src/org/ofbiz/content/data/DataResourceWorker.java	(working copy)
@@ -70,10 +70,10 @@
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.widget.html.HtmlScreenRenderer;
 import org.ofbiz.widget.screen.ModelScreen;
 import org.ofbiz.widget.screen.ScreenFactory;
 import org.ofbiz.widget.screen.ScreenRenderer;
+import org.ofbiz.widget.screen.MacroScreenRenderer;
 import org.ofbiz.widget.screen.ScreenStringRenderer;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
@@ -692,7 +692,9 @@
                     // get the screen renderer; or create a new one
                     ScreenRenderer screens = (ScreenRenderer) context.get("screens");
                     if (screens == null) {
-                        screens = new ScreenRenderer(out, context, new HtmlScreenRenderer());
+                        // TODO: replace "screen" to support dynamic rendering of different output
+                        ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", "screen" + ".name"), UtilProperties.getPropertyValue("widget", "screen" + ".screenrenderer"), out);
+                        screens = new ScreenRenderer(out, context, screenStringRenderer);
                         screens.getContext().put("screens", screens);
                     }
                     // render the screen
@@ -718,6 +720,8 @@
                     throw new GeneralException("Error rendering Screen template", e);
                 } catch (ParserConfigurationException e) {
                     throw new GeneralException("Error rendering Screen template", e);
+                } catch (TemplateException e) {
+                    throw new GeneralException("Error creating Screen renderer", e);
                 }
             } else {
                 throw new GeneralException("The dataTemplateTypeId [" + dataTemplateTypeId + "] is not yet supported");




On Apr 7, 2010, at 12:29 PM, Jacopo Cappellato wrote:

> Thank you Scott.
> The attached patch (not tested and that probably needs some minor cleanup) should remove the dependencies.
> I hope it helps
> 
> Jacopo
> 
> 
> 
> On Apr 7, 2010, at 7:03 AM, Scott Gray wrote:
> 
>> Big plus one :-)
>> 
>> I think content component may still be using some of the html renderer stuff though, I'll try and make a point to deal with that within the next week or so.
>> 
>> Regards
>> Scott
>> 
>> HotWax Media
>> http://www.hotwaxmedia.com
>> 
>> On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:
>> 
>>> I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...
>>> 
>>> Jacopo
>>> 
>>> On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:
>>> 
>>>> Author: lektran
>>>> Date: Wed Apr  7 03:51:02 2010
>>>> New Revision: 931422
>>>> 
>>>> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
>>>> Log:
>>>> Remove some unnecessary casts
>>>> 
>>>> Modified:
>>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>> 
>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
>>>> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>>>>      if (shortDateInput) {
>>>>          size = maxlength = 10;
>>>>          if (uiLabelMap != null) {
>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>          }
>>>>      } else if ("time".equals(dateTimeField.getType())) {
>>>>          size = maxlength = 8;
>>>>          if (uiLabelMap != null) {
>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>          }
>>>>      } else {
>>>>          if (uiLabelMap != null) {
>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>          }
>>>>      }
>>>>      writer.append(" title=\"");
>>>> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
>>>> 
>>>>      // search for a localized label for the icon
>>>>      if (uiLabelMap != null) {
>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>      }
>>>> 
>>>>      // add calendar pop-up button and seed data IF this is not a "time" type date-time
>>>> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>>>>      if ("date".equals(dateFindField.getType())) {
>>>>          size = maxlength = 10;
>>>>          if (uiLabelMap != null) {
>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>>>          }
>>>>      } else if ("time".equals(dateFindField.getType())) {
>>>>          size = maxlength = 8;
>>>>          if (uiLabelMap != null) {
>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>>>          }
>>>>      } else {
>>>>          if (uiLabelMap != null) {
>>>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>>>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>>>          }
>>>>      }
>>>>      writer.append(" title=\"");
>>>> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
>>>> 
>>>>      // search for a localized label for the icon
>>>>      if (uiLabelMap != null) {
>>>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>>>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>>>      }
>>>> 
>>>>      // add calendar pop-up button and seed data IF this is not a "time" type date-find
>>>> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>>>>      if (uiLabelMap == null) {
>>>>          Debug.logWarning("Could not find uiLabelMap in context", module);
>>>>      } else {
>>>> -            pageLabel = (String) uiLabelMap.get("CommonPage");
>>>> +            pageLabel = uiLabelMap.get("CommonPage");
>>>>          Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>>>>          commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>>>>      }
>>>> 
>>>> 
>>> 
>> 
> 


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
Thank you Scott.
The attached patch (not tested and that probably needs some minor cleanup) should remove the dependencies.
I hope it helps

Jacopo


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Big plus one :-)

I think content component may still be using some of the html renderer stuff though, I'll try and make a point to deal with that within the next week or so.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 6/04/2010, at 10:59 PM, Jacopo Cappellato wrote:

> I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...
> 
> Jacopo
> 
> On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:
> 
>> Author: lektran
>> Date: Wed Apr  7 03:51:02 2010
>> New Revision: 931422
>> 
>> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
>> Log:
>> Remove some unnecessary casts
>> 
>> Modified:
>>   ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>> 
>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
>> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>>        if (shortDateInput) {
>>            size = maxlength = 10;
>>            if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>            }
>>        } else if ("time".equals(dateTimeField.getType())) {
>>            size = maxlength = 8;
>>            if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>            }
>>        } else {
>>            if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>            }
>>        }
>>        writer.append(" title=\"");
>> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
>> 
>>        // search for a localized label for the icon
>>        if (uiLabelMap != null) {
>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>        }
>> 
>>        // add calendar pop-up button and seed data IF this is not a "time" type date-time
>> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>>        if ("date".equals(dateFindField.getType())) {
>>            size = maxlength = 10;
>>            if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>            }
>>        } else if ("time".equals(dateFindField.getType())) {
>>            size = maxlength = 8;
>>            if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>            }
>>        } else {
>>            if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>            }
>>        }
>>        writer.append(" title=\"");
>> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
>> 
>>        // search for a localized label for the icon
>>        if (uiLabelMap != null) {
>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>        }
>> 
>>        // add calendar pop-up button and seed data IF this is not a "time" type date-find
>> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>>        if (uiLabelMap == null) {
>>            Debug.logWarning("Could not find uiLabelMap in context", module);
>>        } else {
>> -            pageLabel = (String) uiLabelMap.get("CommonPage");
>> +            pageLabel = uiLabelMap.get("CommonPage");
>>            Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>>            commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>>        }
>> 
>> 
> 


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...

Jacopo

On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:

> Author: lektran
> Date: Wed Apr  7 03:51:02 2010
> New Revision: 931422
> 
> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
> Log:
> Remove some unnecessary casts
> 
> Modified:
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
> 
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>         if (shortDateInput) {
>             size = maxlength = 10;
>             if (uiLabelMap != null) {
> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>             }
>         } else if ("time".equals(dateTimeField.getType())) {
>             size = maxlength = 8;
>             if (uiLabelMap != null) {
> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>             }
>         } else {
>             if (uiLabelMap != null) {
> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>             }
>         }
>         writer.append(" title=\"");
> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
> 
>         // search for a localized label for the icon
>         if (uiLabelMap != null) {
> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>         }
> 
>         // add calendar pop-up button and seed data IF this is not a "time" type date-time
> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>         if ("date".equals(dateFindField.getType())) {
>             size = maxlength = 10;
>             if (uiLabelMap != null) {
> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>             }
>         } else if ("time".equals(dateFindField.getType())) {
>             size = maxlength = 8;
>             if (uiLabelMap != null) {
> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>             }
>         } else {
>             if (uiLabelMap != null) {
> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>             }
>         }
>         writer.append(" title=\"");
> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
> 
>         // search for a localized label for the icon
>         if (uiLabelMap != null) {
> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>         }
> 
>         // add calendar pop-up button and seed data IF this is not a "time" type date-find
> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>         if (uiLabelMap == null) {
>             Debug.logWarning("Could not find uiLabelMap in context", module);
>         } else {
> -            pageLabel = (String) uiLabelMap.get("CommonPage");
> +            pageLabel = uiLabelMap.get("CommonPage");
>             Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>             commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>         }
> 
> 


Re: svn commit: r931422 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by BJ Freeman <bj...@free-man.net>.
I have two live sights that use these.
I see them as a way to extend the ecommerce to be like normals webpages
of already existing sites while integrating the sites into ofbiz
it has been a selling point. on past conversion sites.


=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation <http://www.businessesnetwork.com/automation/viewforum.php?f=93>
Specialtymarket.com <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


Jacopo Cappellato sent the following on 4/6/2010 9:59 PM:
> I think it is now time to remove the HtmlFormRenderer and HtmlScreenRenderer (and the corresponding ViewHandler); they are no more used...
> 
> Jacopo
> 
> On Apr 7, 2010, at 5:51 AM, lektran@apache.org wrote:
> 
>> Author: lektran
>> Date: Wed Apr  7 03:51:02 2010
>> New Revision: 931422
>>
>> URL: http://svn.apache.org/viewvc?rev=931422&view=rev
>> Log:
>> Remove some unnecessary casts
>>
>> Modified:
>>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>>
>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931422&r1=931421&r2=931422&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr  7 03:51:02 2010
>> @@ -550,16 +550,16 @@ public class HtmlFormRenderer extends Ht
>>         if (shortDateInput) {
>>             size = maxlength = 10;
>>             if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>             }
>>         } else if ("time".equals(dateTimeField.getType())) {
>>             size = maxlength = 8;
>>             if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>             }
>>         } else {
>>             if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>             }
>>         }
>>         writer.append(" title=\"");
>> @@ -595,7 +595,7 @@ public class HtmlFormRenderer extends Ht
>>
>>         // search for a localized label for the icon
>>         if (uiLabelMap != null) {
>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>         }
>>
>>         // add calendar pop-up button and seed data IF this is not a "time" type date-time
>> @@ -2018,16 +2018,16 @@ public class HtmlFormRenderer extends Ht
>>         if ("date".equals(dateFindField.getType())) {
>>             size = maxlength = 10;
>>             if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDate");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDate");
>>             }
>>         } else if ("time".equals(dateFindField.getType())) {
>>             size = maxlength = 8;
>>             if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatTime");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatTime");
>>             }
>>         } else {
>>             if (uiLabelMap != null) {
>> -                localizedInputTitle = (String) uiLabelMap.get("CommonFormatDateTime");
>> +                localizedInputTitle = uiLabelMap.get("CommonFormatDateTime");
>>             }
>>         }
>>         writer.append(" title=\"");
>> @@ -2056,7 +2056,7 @@ public class HtmlFormRenderer extends Ht
>>
>>         // search for a localized label for the icon
>>         if (uiLabelMap != null) {
>> -            localizedIconTitle = (String) uiLabelMap.get("CommonViewCalendar");
>> +            localizedIconTitle = uiLabelMap.get("CommonViewCalendar");
>>         }
>>
>>         // add calendar pop-up button and seed data IF this is not a "time" type date-find
>> @@ -2334,7 +2334,7 @@ public class HtmlFormRenderer extends Ht
>>         if (uiLabelMap == null) {
>>             Debug.logWarning("Could not find uiLabelMap in context", module);
>>         } else {
>> -            pageLabel = (String) uiLabelMap.get("CommonPage");
>> +            pageLabel = uiLabelMap.get("CommonPage");
>>             Map<String, Integer> messageMap = UtilMisc.toMap("lowCount", Integer.valueOf(lowIndex + 1), "highCount", Integer.valueOf(lowIndex + actualPageSize), "total", Integer.valueOf(listSize));
>>             commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale"));
>>         }
>>
>>
> 
>