Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
b970af53
by Tony Chemit at 2021-01-31T12:11:45+01:00
2 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/selection/SelectionTree.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/selection/actions/SelectUnselect.java
Changes:
| ... | ... | @@ -43,7 +43,7 @@ public class SelectionTree extends JXTree { |
| 43 | 43 |
setCellRenderer(new SelectionTreeCellRenderer());
|
| 44 | 44 |
setRootVisible(false);
|
| 45 | 45 |
setRowHeight(30);
|
| 46 |
- getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
|
| 46 |
+ getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
|
|
| 47 | 47 |
setMinimumSize(UIHelper.newMinDimension());
|
| 48 | 48 |
setToggleClickCount(100);
|
| 49 | 49 |
}
|
| ... | ... | @@ -32,6 +32,7 @@ import org.apache.logging.log4j.Logger; |
| 32 | 32 |
import javax.swing.ActionMap;
|
| 33 | 33 |
import javax.swing.InputMap;
|
| 34 | 34 |
import javax.swing.KeyStroke;
|
| 35 |
+import javax.swing.tree.TreePath;
|
|
| 35 | 36 |
import java.awt.event.ActionEvent;
|
| 36 | 37 |
import java.awt.event.MouseAdapter;
|
| 37 | 38 |
import java.awt.event.MouseEvent;
|
| ... | ... | @@ -104,13 +105,16 @@ public class SelectUnselect extends SelectionTreePaneActionSupport { |
| 104 | 105 |
}
|
| 105 | 106 |
|
| 106 | 107 |
protected void selectUnSelect(SelectionTree tree) {
|
| 107 |
- Object selectedRow = tree.getLastSelectedPathComponent();
|
|
| 108 |
- if (selectedRow == null) {
|
|
| 109 |
- return;
|
|
| 110 |
- }
|
|
| 108 |
+ TreePath[] selectionPath = tree.getSelectionPaths();
|
|
| 111 | 109 |
|
| 112 |
- SelectionTreeNodeSupport<?> node = (SelectionTreeNodeSupport<?>) selectedRow;
|
|
| 113 |
- tree.getTreeModel().setValueAt(node, !node.isSelected());
|
|
| 110 |
+ for (TreePath treePath : selectionPath) {
|
|
| 111 |
+ Object selectedRow = treePath.getLastPathComponent();
|
|
| 112 |
+ if (selectedRow == null) {
|
|
| 113 |
+ return;
|
|
| 114 |
+ }
|
|
| 115 |
+ SelectionTreeNodeSupport<?> node = (SelectionTreeNodeSupport<?>) selectedRow;
|
|
| 116 |
+ tree.getTreeModel().setValueAt(node, !node.isSelected());
|
|
| 117 |
+ }
|
|
| 114 | 118 |
}
|
| 115 | 119 |
|
| 116 | 120 |
public void setExcludeKeyStrokes(KeyStroke... keyStrokes) {
|