ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bibr...@apache.org
Subject svn commit: r885724 - in /ofbiz/trunk/framework/widget/src/org/ofbiz/widget: form/MacroFormRenderer.java form/ModelForm.java html/HtmlFormRenderer.java html/HtmlScreenRenderer.java screen/MacroScreenRenderer.java
Date Tue, 01 Dec 2009 10:32:39 GMT
Author: bibryam
Date: Tue Dec  1 10:32:39 2009
New Revision: 885724

URL: http://svn.apache.org/viewvc?rev=885724&view=rev
Log:
Applied patch from https://issues.apache.org/jira/browse/OFBIZ-3254 - Setting viewSize and
viewIndex in screen context for List Forms do not work.
 
Thanks to Mridul Pathak for the contribution.

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=885724&r1=885723&r2=885724&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Tue Dec
 1 10:32:39 2009
@@ -1957,8 +1957,8 @@
 
         // get the parameterized pagination index and size fields
         int paginatorNumber = modelForm.getPaginatorNumber(context);
-        String viewIndexParam = modelForm.getPaginateIndexField(context);
-        String viewSizeParam = modelForm.getPaginateSizeField(context);
+        String viewIndexParam = modelForm.getMultiPaginateIndexField(context);
+        String viewSizeParam = modelForm.getMultiPaginateSizeField(context);
 
         int viewIndex = modelForm.getViewIndex(context);
         int viewSize = modelForm.getViewSize(context);

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=885724&r1=885723&r2=885724&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Tue Dec  1 10:32:39
2009
@@ -2180,28 +2180,42 @@
         if (UtilValidate.isEmpty(field)) {
             field = DEFAULT_PAG_INDEX_FIELD;
         }
+        return field;
+    }
+    
+    public String getMultiPaginateIndexField(Map<String, Object> context) {
+        String field = this.paginateIndexField.expandString(context);
+        if (UtilValidate.isEmpty(field)) {
+            field = DEFAULT_PAG_INDEX_FIELD;
+        }
         //  append the paginator number
         field = field + "_" + getPaginatorNumber(context);
         return field;
     }
 
     public int getPaginateIndex(Map<String, Object> context) {
-        String field = this.getPaginateIndexField(context);
+        String field = this.getMultiPaginateIndexField(context);
 
         int viewIndex = 0;
         try {
             Object value = context.get(field);
 
             if (value == null) {
-            // try parameters.VIEW_INDEX as that is an old OFBiz convention
-            Map<String, Object> parameters = UtilGenerics.cast(context.get("parameters"));
-            if (parameters != null) {
-                value = parameters.get("VIEW_INDEX" + "_" + getPaginatorNumber(context));
+                // try parameters.VIEW_INDEX as that is an old OFBiz convention
+                Map<String, Object> parameters = UtilGenerics.cast(context.get("parameters"));
+                if (parameters != null) {
+                    value = parameters.get("VIEW_INDEX" + "_" + getPaginatorNumber(context));
 
-                if (value == null) {
-                    value = parameters.get(field);
+                    if (value == null) {
+                        value = parameters.get(field);
+                    }
                 }
             }
+            
+            // try paginate index field without paginator number
+            if (value == null) {
+                field = this.getPaginateIndexField(context);
+                value = context.get(field);
             }
 
             if (value instanceof Integer) {
@@ -2221,13 +2235,21 @@
         if (UtilValidate.isEmpty(field)) {
             field = DEFAULT_PAG_SIZE_FIELD;
         }
+        return field;
+    }
+    
+    public String getMultiPaginateSizeField(Map<String, Object> context) {
+        String field = this.paginateSizeField.expandString(context);
+        if (UtilValidate.isEmpty(field)) {
+            field = DEFAULT_PAG_SIZE_FIELD;
+        }
         //  append the paginator number
         field = field + "_" + getPaginatorNumber(context);
         return field;
     }
 
     public int getPaginateSize(Map<String, Object> context) {
-        String field = this.getPaginateSizeField(context);
+        String field = this.getMultiPaginateSizeField(context);
 
         int viewSize = this.defaultViewSize;
         try {
@@ -2244,6 +2266,12 @@
                     }
                 }
             }
+            
+            // try the page size field without paginator number
+            if (value == null) {
+                field = this.getPaginateSizeField(context);
+                value = context.get(field);
+            }
 
             if (value instanceof Integer) {
                 viewSize = ((Integer) value).intValue();

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=885724&r1=885723&r2=885724&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 Tue Dec 
1 10:32:39 2009
@@ -2287,8 +2287,8 @@
 
         // get the parameterized pagination index and size fields
         int paginatorNumber = modelForm.getPaginatorNumber(context);
-        String viewIndexParam = modelForm.getPaginateIndexField(context);
-        String viewSizeParam = modelForm.getPaginateSizeField(context);
+        String viewIndexParam = modelForm.getMultiPaginateIndexField(context);
+        String viewSizeParam = modelForm.getMultiPaginateSizeField(context);
 
         int viewIndex = modelForm.getViewIndex(context);
         int viewSize = modelForm.getViewSize(context);

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=885724&r1=885723&r2=885724&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 Tue Dec
 1 10:32:39 2009
@@ -262,8 +262,8 @@
 
         // get the parametrized pagination index and size fields
         int paginatorNumber = modelForm.getPaginatorNumber(context);
-        String viewIndexParam = modelForm.getPaginateIndexField(context);
-        String viewSizeParam = modelForm.getPaginateSizeField(context);
+        String viewIndexParam = modelForm.getMultiPaginateIndexField(context);
+        String viewSizeParam = modelForm.getMultiPaginateSizeField(context);
 
         int viewIndex = modelForm.getViewIndex(context);
         int viewSize = modelForm.getViewSize(context);

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=885724&r1=885723&r2=885724&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Tue
Dec  1 10:32:39 2009
@@ -721,8 +721,8 @@
 
         // get the parametrized pagination index and size fields
         int paginatorNumber = modelForm.getPaginatorNumber(context);
-        String viewIndexParam = modelForm.getPaginateIndexField(context);
-        String viewSizeParam = modelForm.getPaginateSizeField(context);
+        String viewIndexParam = modelForm.getMultiPaginateIndexField(context);
+        String viewSizeParam = modelForm.getMultiPaginateSizeField(context);
 
         int viewIndex = modelForm.getViewIndex(context);
         int viewSize = modelForm.getViewSize(context);



Mime
View raw message