svn commit: r729402 - in /ofbiz/trunk/framework/widget/src/org/ofbiz/widget: ModelWidget.java html/HtmlScreenRenderer.java

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

svn commit: r729402 - in /ofbiz/trunk/framework/widget/src/org/ofbiz/widget: ModelWidget.java html/HtmlScreenRenderer.java

jleroux@apache.org
Author: jleroux
Date: Thu Dec 25 00:30:30 2008
New Revision: 729402

URL: http://svn.apache.org/viewvc?rev=729402&view=rev
Log:
Fix an issue introduced in  r725053. This commit managed  "multi-pagination in a page" see https://issues.apache.org/jira/browse/OFBIZ-1935
This is a quick fix. I wonder if we should keep the screenlet navigation-form-name attribute (at least as is). This for 2 reasons:
. Less informations/features than with default (pages numbers, ability to jump to any page)
. The last button does not always work (try with widget.form.defaultViewSize=2 when listing invoices)

On the other hand it's cool to have all informations in the screenlet. But then we should extend it to work for the 2 points above

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

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java?rev=729402&r1=729401&r2=729402&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java Thu Dec 25 00:30:30 2008
@@ -23,6 +23,7 @@
 import org.w3c.dom.Element;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
 
 /**
  * Widget Library - Widget model class. ModelWidget is a base class that is
@@ -130,8 +131,13 @@
     public void incrementPaginatorNumber(Map<String, Object> context) {    
         Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
         if (globalCtx != null) {
-            Integer paginateNumberInt = Integer.valueOf(getPaginatorNumber(context) + 1);
-            globalCtx.put("PAGINATOR_NUMBER", paginateNumberInt);
+            Boolean NO_PAGINATOR = (Boolean) globalCtx.get("NO_PAGINATOR");
+            if (UtilValidate.isNotEmpty(NO_PAGINATOR)) {
+                globalCtx.remove("NO_PAGINATOR");
+            } else {
+                Integer paginateNumberInt = Integer.valueOf(getPaginatorNumber(context) + 1);
+                globalCtx.put("PAGINATOR_NUMBER", paginateNumberInt);
+            }
         }    
     }
     

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=729402&r1=729401&r2=729402&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Thu Dec 25 00:30:30 2008
@@ -246,7 +246,7 @@
         }
 
         // get the parametrized pagination index and size fields
-        int paginatoNumber = modelForm.getPaginatorNumber(context);
+        int paginatorNumber = modelForm.getPaginatorNumber(context);
         String viewIndexParam = modelForm.getPaginateIndexField(context);
         String viewSizeParam = modelForm.getPaginateSizeField(context);
 
@@ -272,8 +272,8 @@
         }
 
         // for legacy support, the viewSizeParam is VIEW_SIZE and viewIndexParam is VIEW_INDEX when the fields are "viewSize" and "viewIndex"
-        if (viewIndexParam.equals("viewIndex" + "_" + paginatoNumber)) viewIndexParam = "VIEW_INDEX" + "_" + paginatoNumber;
-        if (viewSizeParam.equals("viewSize" + "_" + paginatoNumber)) viewSizeParam = "VIEW_SIZE" + "_" + paginatoNumber;
+        if (viewIndexParam.equals("viewIndex" + "_" + paginatorNumber)) viewIndexParam = "VIEW_INDEX" + "_" + paginatorNumber;
+        if (viewSizeParam.equals("viewSize" + "_" + paginatorNumber)) viewSizeParam = "VIEW_SIZE" + "_" + paginatorNumber;
 
         ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
         RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
@@ -285,7 +285,7 @@
         }
         String queryString = UtilHttp.urlEncodeArgs(inputFields);
         // strip legacy viewIndex/viewSize params from the query string
-        queryString = UtilHttp.stripViewParamsFromQueryString(queryString, "" + paginatoNumber);
+        queryString = UtilHttp.stripViewParamsFromQueryString(queryString, "" + paginatorNumber);
         // strip parametrized index/size params from the query string
         HashSet<String> paramNames = new HashSet<String>();
         paramNames.add(viewIndexParam);
@@ -382,6 +382,8 @@
             HttpServletRequest request = (HttpServletRequest) context.get("request");
             HttpServletResponse response = (HttpServletResponse) context.get("response");
             if (request != null && response != null) {
+                Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
+                globalCtx.put("NO_PAGINATOR", true);
                 FormStringRenderer savedRenderer = (FormStringRenderer) context.get("formStringRenderer");
                 HtmlFormRenderer renderer = new HtmlFormRenderer(request, response);
                 renderer.setRenderPagination(false);