svn commit: r992682 - in /ofbiz/trunk/framework/webtools: webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy widget/CacheForms.xml

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

svn commit: r992682 - in /ofbiz/trunk/framework/webtools: webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy widget/CacheForms.xml

buscob
Author: buscob
Date: Sat Sep  4 21:19:56 2010
New Revision: 992682

URL: http://svn.apache.org/viewvc?rev=992682&view=rev
Log:
Added column sorting feature to WebTools cache forms.
It should be further improved since at the moment numbers are sorted as strings (10 is sorted before 2).
This is a new pattern that can be used to sort columns in forms where data come from Maps not directly retrieved from Entities.

Modified:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy
    ofbiz/trunk/framework/webtools/widget/CacheForms.xml

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy?rev=992682&r1=992681&r2=992682&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy Sat Sep  4 21:19:56 2010
@@ -18,6 +18,7 @@
  */
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.base.util.UtilFormatOut;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.security.Security;
 
 context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session);
@@ -50,4 +51,9 @@ names.each { cacheName ->
 
         cacheList.add(cache);
 }
-context.cacheList = cacheList;
+sortField = parameters.sortField;
+if (sortField) {
+    context.cacheList = UtilMisc.sortMaps(cacheList, UtilMisc.toList(sortField));
+} else {
+    context.cacheList = cacheList;
+}

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy?rev=992682&r1=992681&r2=992682&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy Sat Sep  4 21:19:56 2010
@@ -19,6 +19,7 @@
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.base.util.cache.CacheLine;
 import org.ofbiz.base.util.UtilFormatOut;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.security.Security;
 
 context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session);
@@ -44,4 +45,9 @@ if (cacheName) {
     }
 }
 context.totalSize = UtilFormatOut.formatQuantity(totalSize);
-context.cacheElementsList = cacheElementsList;
+sortField = parameters.sortField;
+if (sortField) {
+    context.cacheElementsList = UtilMisc.sortMaps(cacheElementsList, UtilMisc.toList(sortField));
+} else {
+    context.cacheElementsList = cacheElementsList;
+}

Modified: ofbiz/trunk/framework/webtools/widget/CacheForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/CacheForms.xml?rev=992682&r1=992681&r2=992682&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/CacheForms.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/CacheForms.xml Sat Sep  4 21:19:56 2010
@@ -21,16 +21,16 @@ under the License.
 <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
 
-    <form name="ListCache" type="list" list-name="cacheList" paginate-target="FindUtilCache" separate-columns="true" odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <field name="cacheName" title="${uiLabelMap.WebtoolsCacheName}"><display/></field>
-        <field name="cacheSize" title="${uiLabelMap.WebtoolsSize}"><display/></field>
-        <field name="hitCount" title="${uiLabelMap.WebtoolsHits}"><display/></field>
-        <field name="misses" title="${uiLabelMap.WebtoolsMisses}"><display description="${missCountTot}/${missCountNotFound}/${missCountExpired}/${missCountSoftRef}"/></field>
-        <field name="removes" title="${uiLabelMap.WebtoolsRemoves}"><display description="${removeHitCount}/${removeMissCount}"/></field>
-        <field name="maxInMemory" title="${uiLabelMap.WebtoolsMaxInMemory}"><display/></field>
-        <field name="expireTime" title="${uiLabelMap.WebtoolsExpireTime}"><display/></field>
-        <field name="useSoftReference" title="${uiLabelMap.WebtoolsUseSoftRef}"><display/></field>
-        <field name="useFileSystemStore" title="${uiLabelMap.WebtoolsUseFileStore}"><display/></field>
+    <form name="ListCache" type="list" list-name="cacheList" paginate-target="FindUtilCache" separate-columns="true" odd-row-style="alternate-row" default-table-style="basic-table hover-bar" header-row-style="header-row-2">
+        <field name="cacheName" title="${uiLabelMap.WebtoolsCacheName}" sort-field="true"><display/></field>
+        <field name="cacheSize" title="${uiLabelMap.WebtoolsSize}" sort-field="true"><display/></field>
+        <field name="hitCount" title="${uiLabelMap.WebtoolsHits}" sort-field="true"><display/></field>
+        <field name="misses" title="${uiLabelMap.WebtoolsMisses}" sort-field="true"><display description="${missCountTot}/${missCountNotFound}/${missCountExpired}/${missCountSoftRef}"/></field>
+        <field name="removes" title="${uiLabelMap.WebtoolsRemoves}" sort-field="true"><display description="${removeHitCount}/${removeMissCount}"/></field>
+        <field name="maxInMemory" title="${uiLabelMap.WebtoolsMaxInMemory}" sort-field="true"><display/></field>
+        <field name="expireTime" title="${uiLabelMap.WebtoolsExpireTime}" sort-field="true"><display/></field>
+        <field name="useSoftReference" title="${uiLabelMap.WebtoolsUseSoftRef}" sort-field="true"><display/></field>
+        <field name="useFileSystemStore" title="${uiLabelMap.WebtoolsUseFileStore}" sort-field="true"><display/></field>
         <field name="administration" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext" use-when="hasUtilCacheEdit">
             <hyperlink description="${uiLabelMap.WebtoolsElements}" target="FindUtilCacheElements">
                 <parameter param-name="UTIL_CACHE_NAME" from-field="cacheName"/>
@@ -48,10 +48,10 @@ under the License.
         </field>
     </form>
 
-    <form name="ListCacheElements" type="list" list-name="cacheElementsList" paginate-target="FindUtilCacheElements" separate-columns="true" odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <field name="elementKey" title="${uiLabelMap.WebtoolsCacheElementKey}"><display/></field>
-        <field name="expireTimeMillis" title="${uiLabelMap.WebtoolsExpireTime}"><display/></field>
-        <field name="lineSize" title="${uiLabelMap.WebtoolsBytes}"><display/></field>
+    <form name="ListCacheElements" type="list" list-name="cacheElementsList" paginate-target="FindUtilCacheElements" separate-columns="true" odd-row-style="alternate-row" default-table-style="basic-table hover-bar" header-row-style="header-row-2">
+        <field name="elementKey" title="${uiLabelMap.WebtoolsCacheElementKey}" sort-field="true"><display/></field>
+        <field name="expireTimeMillis" title="${uiLabelMap.WebtoolsExpireTime}" sort-field="true"><display/></field>
+        <field name="lineSize" title="${uiLabelMap.WebtoolsBytes}" sort-field="true"><display/></field>
 
         <field name="administration" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext" use-when="hasUtilCacheEdit">
             <hyperlink description="${uiLabelMap.CommonRemove}" target="FindUtilCacheElementsRemoveElement">