summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/JCheckBoxTree.java
diff options
context:
space:
mode:
authorSimon Rettberg2016-01-22 11:24:32 +0100
committerSimon Rettberg2016-01-22 11:24:32 +0100
commit1f2b2c4dc433064d91f06c8e0c66db7d70fe934e (patch)
treed8d81880b636459c0718adbac4ed87bf65a4eb90 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/JCheckBoxTree.java
parent[client] Collapse nodes with all children selected when clicking "Apply" (diff)
downloadtutor-module-1f2b2c4dc433064d91f06c8e0c66db7d70fe934e.tar.gz
tutor-module-1f2b2c4dc433064d91f06c8e0c66db7d70fe934e.tar.xz
tutor-module-1f2b2c4dc433064d91f06c8e0c66db7d70fe934e.zip
[client] Only expand first level of tree
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/JCheckBoxTree.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/JCheckBoxTree.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/JCheckBoxTree.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/JCheckBoxTree.java
index 7406ce69..45602a04 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/JCheckBoxTree.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/JCheckBoxTree.java
@@ -93,10 +93,18 @@ public class JCheckBoxTree extends JTree {
public void setModel(TreeModel newModel) {
super.setModel(newModel);
resetCheckingState();
- // expand all nodes
+ // Hack to get rid of leaf nodes with an expand button
+ // first expand all nodes
for (int i = 0; i < this.getRowCount(); i++) {
this.expandRow(i);
}
+ // Now collapse again if it's not first level
+ for (int i = 0; i < this.getRowCount(); i++) {
+ TreePath path = this.getPathForRow(i);
+ if (path.getPathCount() > 1) {
+ this.collapseRow(i);
+ }
+ }
}
// Preselection stuff
public void setCheckedState(List<TreePath> paths, boolean check) {