You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/03/11 14:26:10 UTC

svn commit: r1576331 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

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() {



Re: svn commit: r1576331 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Posted by Rong Nguyen <ro...@olbius.com>.
Thank  Jacques and Jacopo,
Now, i have enough knowledge of the structure of the widget code, i will try
in some next contribution :-)



-----
Rong Nguyen

Olbius JSC
Deliver highest business value
http://www.olbius.com/
--
View this message in context: http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1576331-ofbiz-trunk-framework-widget-src-org-ofbiz-widget-form-ModelFormField-java-tp4649080p4649152.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: svn commit: r1576331 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
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, jleroux@apache.org 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() {
>>>
>>>
>>
>>
>

Re: svn commit: r1576331 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
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, jleroux@apache.org 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() {
>>
>>
>
>

Re: svn commit: r1576331 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
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, jleroux@apache.org 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() {
> 
>