optimization to make 'select all' available for tree tables: merge select events as they were in table

This commit is contained in:
Anna Kozlova
2014-10-02 12:44:02 +02:00
parent fb5a39d38a
commit 40c3bfec2c
@@ -28,8 +28,10 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
@@ -283,15 +285,19 @@ public class TreeTable extends JBTable {
clearSelection();
if (min != -1 && max != -1) {
List<TreePath> selectionPaths = new ArrayList<TreePath>();
for (int counter = min; counter <= max; counter++) {
if (listSelectionModel.isSelectedIndex(counter)) {
TreePath selPath = myTree.getPathForRow(counter);
if (selPath != null) {
addSelectionPath(selPath);
selectionPaths.add(selPath);
}
}
}
if (!selectionPaths.isEmpty()) {
addSelectionPaths(selectionPaths.toArray(new TreePath[selectionPaths.size()]));
}
}
}
finally {