X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.nattable%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fnattable%2FTreeNode.java;h=529d02f4916c3745ae9e6a56de4b51c296d0f425;hb=d7ce5ab37a70cf207e3bfe0045c0df3f1fb98415;hp=269966c30722b0834b965362a17536c1bda1100e;hpb=20f121685fb470550230a8aafe38731667b4d99c;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/TreeNode.java b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/TreeNode.java index 269966c30..529d02f49 100644 --- a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/TreeNode.java +++ b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/TreeNode.java @@ -118,20 +118,33 @@ public class TreeNode implements IAdaptable { initData(); if (labeler != null) { String key = explorerContext.getGe().getColumns()[column].getKey(); - String s = null; - if (runtimeLabels != null) - s = runtimeLabels.get(key); - if (s == null) - s = labels.get(key); - if (labelDecorators != null && !labelDecorators.isEmpty()) { - int index = 0; - for (LabelDecorator ld : labelDecorators) { - String ds = ld.decorateLabel(s, key, index); - if (ds != null) - s = ds; - } + return getValue(key); + } + return null; + } + + private String getValue(String key) { + String s = null; + if (runtimeLabels != null) + s = runtimeLabels.get(key); + if (s == null) + s = labels.get(key); + if (labelDecorators != null && !labelDecorators.isEmpty()) { + int index = 0; + for (LabelDecorator ld : labelDecorators) { + String ds = ld.decorateLabel(s, key, index); + if (ds != null) + s = ds; } - return s; + } + return s; + } + + public String getValueString(String key) { + if (labels == null) + initData(); + if (labeler != null) { + return getValue(key); } return null; } @@ -282,6 +295,25 @@ public class TreeNode implements IAdaptable { manager = null; } + /** + * Fast dispose is used to wipe the whole tree. + * + * ContextToNodeMap is cleared with one command, so we do not need to remove nodes one by one from the map. + */ + public void fastDispose() { + if (DEBUG) System.out.println("dispose " + this); + parent = null; + for (TreeNode n : children) { + n.fastDispose(); + } + clearCache(); + children.clear(); + context = null; + explorerContext = null; + manager.dispose(); + manager = null; + } + private void clearCache() { if (explorerContext != null) { GECache2 cache = explorerContext.cache;