qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhupend...@apache.org
Subject svn commit: r529669 - /incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
Date Tue, 17 Apr 2007 16:44:02 GMT
Author: bhupendrab
Date: Tue Apr 17 09:43:53 2007
New Revision: 529669

URL: http://svn.apache.org/viewvc?view=rev&rev=529669
Log:
QPID-417

Modified:
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java?view=diff&rev=529669&r1=529668&r2=529669
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
Tue Apr 17 09:43:53 2007
@@ -25,6 +25,8 @@
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -73,6 +75,8 @@
     public static final String PREV  = "Previous";
     public static final String INDEX = "Index";
     
+    private static final Comparator tabularDataComparator = new TabularDataComparator();
+    
     private static List<String> SUPPORTED_ARRAY_DATATYPES = new ArrayList<String>();
     static
     {
@@ -124,6 +128,9 @@
             text.setLayoutData(layoutData);
             return;
         }  
+        
+        Collections.sort(list, tabularDataComparator);
+     
         // Attach the tabular record to be retrieved and shown later when record is traversed
         // using first/next/previous/last buttons
         composite.setData(list);
@@ -581,5 +588,28 @@
         }
 
         return hash;
+    }
+    
+    private static class TabularDataComparator implements java.util.Comparator<Map.Entry>
+    {
+        public int compare(Map.Entry data1, Map.Entry data2)
+        {
+            if (data1.getKey() instanceof List)
+            {
+                String str1 = ((List)data1.getKey()).get(0).toString();                
+                String str2 = ((List)data2.getKey()).get(0).toString();
+                
+                try
+                {
+                    return Long.valueOf(str1).compareTo(Long.valueOf(str2));
+                }
+                catch (Exception ex)
+                {
+                    return -1;
+                }
+            }
+           
+            return -1;
+        }
     }
 }



Mime
View raw message