Done, while at it, I have also handled the used capacity field

Jacques

Le 11/03/2014 18:15, Jacques Le Roux a écrit :
It's indeed not very good to introduce the web world in the model. I will check 
to see  if there is not a better solution

Jacques

Le 11/03/2014 15:15, Jacopo Cappellato a écrit :
Hi Jacques,

I don't have time to dig into this now but I have the feeling that this is not the right way to go... you have introduced a dependency on javax.servlet.* in a "model" class; also now the passed in FormStringRenderer object is ignored by the method, thus violating the interface contract.
Do you have enough knowledge of the structure of these widget code to be enough 
confident that it is the right solution to the reported problem?

Jacopo


On Mar 11, 2014, at 2:26 PM, [email protected] wrote:

Author: jleroux
Date: Tue Mar 11 13:26:10 2014
New Revision: 1576331

URL: http://svn.apache.org/r1576331
Log:
A slightly modified patch from Rong Nguyen for "View Calendar broken in 
Manufacturing" https://issues.apache.org/jira/browse/OFBIZ-5558

Url: 
https://demo-trunk.ofbiz.apache.org:8443/manufacturing/control/EditCalendarExceptionDay?calendarId=SUPPLIER
Calendar broken

Related with https://issues.apache.org/jira/browse/OFBIZ-4739

jleroux: formatting and some other slight issues fixed in patch

Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1576331&r1=1576330&r2=1576331&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java 
(original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java 
Tue Mar 11 13:26:10 2014
@@ -32,6 +32,9 @@ import java.util.Map;
import java.util.StringTokenizer;
import java.util.TimeZone;

+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import javolution.util.FastList;
import javolution.util.FastMap;

@@ -73,6 +76,7 @@ import org.w3c.dom.Element;

import bsh.EvalError;
import bsh.Interpreter;
+import freemarker.template.TemplateException;

/**
  * Widget Library - Form model class
@@ -3011,7 +3015,14 @@ public class ModelFormField {

         @Override
         public void renderFieldString(Appendable writer, Map<String, Object> 
context, FormStringRenderer formStringRenderer) throws IOException {
-            formStringRenderer.renderDateTimeField(writer, context, this);
+            HttpServletRequest request = (HttpServletRequest) 
context.get("request");
+            HttpServletResponse response = (HttpServletResponse) 
context.get("response");
+            try {
+ MacroFormRenderer renderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen.formrenderer"), request, response);
+                renderer.renderDateTimeField(writer, context, this);
+            } catch (TemplateException e) {
+                Debug.logError("Not rendering content, error on MacroFormRenderer 
creation.", module);
+            }
         }

         public String getType() {





Reply via email to