X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.nattable%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fnattable%2FGETreeRowModel.java;h=762b47ce008ab29f1e96d8ed520ba402d0e685d5;hp=ebfb962db7a129cf7af9cdc93e7f64f433d2585c;hb=145a2884933f2ffdd48d6835729e58f1152d274e;hpb=bd5bc6e45f700e755b61bd112631796631330ecb diff --git a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GETreeRowModel.java b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GETreeRowModel.java index ebfb962db..762b47ce0 100644 --- a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GETreeRowModel.java +++ b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GETreeRowModel.java @@ -22,7 +22,7 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet; public class GETreeRowModel implements ITreeRowModel{ //private final HashSet parentIndexes = new HashSet(); //private final TIntHashSet parentIndexes = new TIntHashSet(1000, 0.8f); - private final IntOpenHashSet parentIndexes = new IntOpenHashSet(); + private final IntOpenHashSet expandedIndexes = new IntOpenHashSet(); private final Collection listeners = new HashSet(); @@ -59,11 +59,11 @@ public class GETreeRowModel implements ITreeRowModel{ } public boolean isCollapsed(int index) { - return this.parentIndexes.contains(index); + return !this.expandedIndexes.contains(index); } public void clear() { - this.parentIndexes.clear(); + this.expandedIndexes.clear(); } @Override @@ -73,16 +73,18 @@ public class GETreeRowModel implements ITreeRowModel{ @Override public List collapse(int index) { - this.parentIndexes.add(index); + this.expandedIndexes.remove(index); notifyListeners(); - return getChildIndexes(index); + List list = getChildIndexes(index); + //this.parentIndexes.addAll(list); + return list; } @Override public List expand(int index) { - this.parentIndexes.remove(index); + this.expandedIndexes.add(index); notifyListeners(); List children = getExpandedChildIndexes(index); return children; @@ -90,7 +92,6 @@ public class GETreeRowModel implements ITreeRowModel{ @Override public List collapseAll() { - // TODO Auto-generated method stub return null; } @@ -195,7 +196,7 @@ public class GETreeRowModel implements ITreeRowModel{ int index = this.treeData.indexOf(child); if (index >= 0) { result.add(index); - if (!parentIndexes.contains(index)) + if (expandedIndexes.contains(index)) result.addAll(getExpandedChildIndexes(index)); } else { result.addAll(getExpandedChildIndexes(child)); @@ -211,7 +212,7 @@ public class GETreeRowModel implements ITreeRowModel{ int index = this.treeData.indexOf(child); if (index >= 0) { result.add(index); - if (!parentIndexes.contains(index)) + if (expandedIndexes.contains(index)) result.addAll(getExpandedChildIndexes(index)); } else { result.addAll(getExpandedChildIndexes(child));