svn commit: r560947 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java

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

svn commit: r560947 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java

jacopoc
Author: jacopoc
Date: Mon Jul 30 05:35:59 2007
New Revision: 560947

URL: http://svn.apache.org/viewvc?view=rev&rev=560947
Log:
""

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java?view=diff&rev=560947&r1=560946&r2=560947
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java Mon Jul 30 05:35:59 2007
@@ -22,6 +22,7 @@
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 
+import javax.servlet.ServletContext;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -29,16 +30,25 @@
 
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilJ2eeCompat;
+import org.ofbiz.webapp.view.ViewHandler;
 import org.ofbiz.webapp.view.ViewHandlerException;
 import org.xml.sax.SAXException;
 
 import org.ofbiz.widget.screen.ScreenWidgetViewHandler;
 import org.ofbiz.widget.text.TextFormRenderer;
+import org.ofbiz.widget.text.TextScreenRenderer;
 
-public class ScreenTextViewHandler extends ScreenWidgetViewHandler {
+public class ScreenTextViewHandler implements ViewHandler {
     
     public static final String module = ScreenTextViewHandler.class.getName();
-    
+
+    protected ServletContext servletContext = null;
+    protected TextScreenRenderer textScreenRenderer = new TextScreenRenderer();
+
+    public void init(ServletContext context) throws ViewHandlerException {
+        this.servletContext = context;
+    }
+
     public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
         Writer writer = null;
         try {
@@ -54,11 +64,13 @@
                 writer = response.getWriter();
             }
 
-            ScreenRenderer screens = new ScreenRenderer(writer, null, htmlScreenRenderer);
+            ScreenRenderer screens = new ScreenRenderer(writer, null, textScreenRenderer);
             screens.populateContextForRequest(request, response, servletContext);
             // this is the object used to render forms from their definitions
             screens.getContext().put("formStringRenderer", new TextFormRenderer(request, response));
             screens.render(page);
+            writer.flush();
+
         } catch (IOException e) {
             throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e);
         } catch (SAXException e) {