geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1351782 - in /geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main: java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java webapp/WEB-INF/view/obrmanager/OBRManager.jsp
Date Tue, 19 Jun 2012 17:31:57 GMT
Author: gawor
Date: Tue Jun 19 17:31:57 2012
New Revision: 1351782

URL: http://svn.apache.org/viewvc?rev=1351782&view=rev
Log:
GERONIMO-6360: Sort resources by symbolic name and version

Modified:
    geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
    geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp

Modified: geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java?rev=1351782&r1=1351781&r2=1351782&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
(original)
+++ geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
Tue Jun 19 17:31:57 2012
@@ -54,6 +54,7 @@ import org.apache.geronimo.system.server
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -442,6 +443,15 @@ public class OBRManagerPortlet extends B
         
         @Override
         public int compare(Resource resource1, Resource resource2) {
+            int rs = compareSymbolicNames(resource1, resource2);
+            if (rs == 0) {
+                return compareVersions(resource2, resource1);
+            } else {
+                return rs;
+            }
+        }
+        
+        private int compareSymbolicNames(Resource resource1, Resource resource2) {
             String name1 = resource1.getSymbolicName();
             String name2 = resource2.getSymbolicName();
             if (name1 == null) {
@@ -457,6 +467,21 @@ public class OBRManagerPortlet extends B
             }
         }
         
+        private int compareVersions(Resource resource1, Resource resource2) {
+            Version version1 = resource1.getVersion();
+            Version version2 = resource2.getVersion();
+            if (version1 == null) {
+                if (version2 == null) {
+                    return 0;
+                } else {
+                    return 1;                    
+                }
+            } else if (version2 == null) {
+                return -1;
+            } else {
+                return version1.compareTo(version2);
+            }
+        }
     }
 
     /*

Modified: geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp?rev=1351782&r1=1351781&r2=1351782&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
(original)
+++ geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
Tue Jun 19 17:31:57 2012
@@ -121,7 +121,7 @@
 <c:if test="${resources!=null}">
 <table width="100%" class="TableLine" summary="Bundle List" border="0">
     <tr class="DarkBackground">
-        <th>Symbolic Name</th>
+        <th>Symbolic Name and Version</th>
     </tr>
     <c:set var="backgroundClass" value='MediumBackground'/>
 
@@ -134,10 +134,10 @@
             <c:set var="backgroundClass" value='MediumBackground'/>
         </c:otherwise>
     </c:choose>
-    <tr class="${backgroundClass}" onmouseover="highlightBgColor(this)" onmouseout="recoverBgColor(this)"
onclick="showHideById('${resourceInfo.id}')">
+    <tr class="${backgroundClass}" onmouseover="highlightBgColor(this)" onmouseout="recoverBgColor(this)">
         <!-- bundle symbolicName -->
-        <td>
-            <div style="cursor:pointer;clear:both;" onmouseover="highlightBgColor(this)"
onmouseout="recoverBgColor(this)" onclick="showHideById('${resourceInfo.id}">${resourceInfo.symbolicName}</div>
+        <td onclick="showHideById('${resourceInfo.id}')">
+            <div style="cursor:pointer;clear:both;" onmouseover="highlightBgColor(this)"
onmouseout="recoverBgColor(this)">${resourceInfo.symbolicName} (${resourceInfo.version})</div>
             <div id="${resourceInfo.id}" style="background-color:#F0F8FF;display:none">
                 <table width="100%" class="TableLine" cellpadding="3">
                     <!-- bundle id -->



Mime
View raw message