src/share/classes/sun/tools/jconsole/inspector/TableSorter.java

Print this page
rev 5340 : 7017818: NLS: JConsoleResources.java cannot be handled by translation team
Reviewed-by: duke


  77 
  78     @Override
  79     public void removeTableModelListener(TableModelListener l) {
  80         evtListenerList.remove(l);
  81         super.removeTableModelListener(l);
  82     }
  83 
  84     private void removeListeners() {
  85         for(TableModelListener tnl : evtListenerList)
  86             super.removeTableModelListener(tnl);
  87     }
  88 
  89     private void restoreListeners() {
  90         for(TableModelListener tnl : evtListenerList)
  91             super.addTableModelListener(tnl);
  92     }
  93 
  94     @SuppressWarnings("unchecked")
  95     private int compare(Object o1, Object o2) {
  96         // take care of the case where both o1 & o2 are null. Needed to keep
  97         // the method symetric. Without this quickSort gives surprising results.
  98         if (o1 == o2)
  99             return 0;
 100         if (o1==null)
 101             return 1;
 102         if (o2==null)
 103             return -1;
 104         //two object of the same class and that are comparable
 105         else if ((o1.getClass().equals(o2.getClass())) &&
 106                  (o1 instanceof Comparable)) {
 107             return (((Comparable) o1).compareTo(o2));
 108         }
 109         else {
 110             return o1.toString().compareTo(o2.toString());
 111         }
 112     }
 113 
 114     private void sort(int column, boolean isAscending) {
 115         final XMBeanAttributes attrs =
 116                 (tableView instanceof XMBeanAttributes)
 117                 ?(XMBeanAttributes) tableView




  77 
  78     @Override
  79     public void removeTableModelListener(TableModelListener l) {
  80         evtListenerList.remove(l);
  81         super.removeTableModelListener(l);
  82     }
  83 
  84     private void removeListeners() {
  85         for(TableModelListener tnl : evtListenerList)
  86             super.removeTableModelListener(tnl);
  87     }
  88 
  89     private void restoreListeners() {
  90         for(TableModelListener tnl : evtListenerList)
  91             super.addTableModelListener(tnl);
  92     }
  93 
  94     @SuppressWarnings("unchecked")
  95     private int compare(Object o1, Object o2) {
  96         // take care of the case where both o1 & o2 are null. Needed to keep
  97         // the method symmetric. Without this quickSort gives surprising results.
  98         if (o1 == o2)
  99             return 0;
 100         if (o1==null)
 101             return 1;
 102         if (o2==null)
 103             return -1;
 104         //two object of the same class and that are comparable
 105         else if ((o1.getClass().equals(o2.getClass())) &&
 106                  (o1 instanceof Comparable)) {
 107             return (((Comparable) o1).compareTo(o2));
 108         }
 109         else {
 110             return o1.toString().compareTo(o2.toString());
 111         }
 112     }
 113 
 114     private void sort(int column, boolean isAscending) {
 115         final XMBeanAttributes attrs =
 116                 (tableView instanceof XMBeanAttributes)
 117                 ?(XMBeanAttributes) tableView