jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1778822 - /jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableSorter.java
Date Sat, 14 Jan 2017 20:07:51 GMT
Author: pmouawad
Date: Sat Jan 14 20:07:50 2017
New Revision: 1778822

URL: http://svn.apache.org/viewvc?rev=1778822&view=rev
Log:
Bug 52962 - Allow sorting by columns for View Results in Table, Summary Report, Aggregate
Report and Aggregate Graph
Based on a contribution by Logan Mauzaize (logan.mauzaize at gmail.com) and Maxime Chassagneux
This commint and this previous one 
http://svn.apache.org/viewvc?rev=1778767&view=rev
closes #245
Bugzilla Id: 52962
Bugzilla Id: 52962

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableSorter.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableSorter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableSorter.java?rev=1778822&r1=1778821&r2=1778822&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableSorter.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableSorter.java Sat Jan 14 20:07:50
2017
@@ -26,7 +26,6 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.Objects;
 import java.util.function.Function;
-import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
 import javax.swing.RowSorter;
@@ -88,7 +87,9 @@ public class ObjectTableSorter extends R
         this.model = model;
 
         this.valueComparators = new Comparator<?>[this.model.getColumnCount()];
-        IntStream.range(0, this.valueComparators.length).forEach(i -> this.setValueComparator(i,
null));
+        for (int i = 0; i < valueComparators.length; i++) {
+            this.setValueComparator(i, null);
+        }
 
         setFallbackComparator(null);
     }
@@ -330,6 +331,9 @@ public class ObjectTableSorter extends R
         return Comparator.comparing(getValueAt, comparator);
     }
 
+    /**
+     * Sort table
+     */
     protected void sort() {
         if (comparator == null) {
             comparator = Stream.concat(
@@ -342,15 +346,23 @@ public class ObjectTableSorter extends R
         }
 
         viewToModel.clear();
-        viewToModel.ensureCapacity(model.getRowCount());
-        IntStream.range(0, model.getRowCount()).mapToObj(i -> new Row(i)).forEach(viewToModel::add);
+        int rowCount = model.getRowCount();
+        viewToModel.ensureCapacity(rowCount);
+        for (int i = 0; i < rowCount; i++) {
+            viewToModel.add(new Row(i));
+        }
         Collections.sort(viewToModel, comparator);
 
         updateModelToView();
     }
 
+    /**
+     * fill in modelToView list with index of view
+     */
     protected void updateModelToView() {
         modelToView = new int[viewToModel.size()];
-        IntStream.range(0, viewToModel.size()).forEach(viewIndex -> modelToView[viewToModel.get(viewIndex).getIndex()]
= viewIndex);
+        for(int i=0; i<viewToModel.size();i++) {
+            modelToView[viewToModel.get(i).getIndex()] = i;
+        }
     }
 }



Mime
View raw message