From 217e697079eb709a3d139a0206f782e04530be67 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 11 Mar 2016 17:26:00 -0800 Subject: [PATCH] [Tree] Display selection state --- platform/commonUI/general/bundle.js | 3 ++- platform/commonUI/general/src/ui/TreeNodeView.js | 10 ++++++++++ platform/commonUI/general/src/ui/TreeView.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/platform/commonUI/general/bundle.js b/platform/commonUI/general/bundle.js index 8e810aec20..d86801e2ea 100644 --- a/platform/commonUI/general/bundle.js +++ b/platform/commonUI/general/bundle.js @@ -394,7 +394,8 @@ define([ }, { "key": "mctTree", - "implementation": MCTTree + "implementation": MCTTree, + "depends": [ '$parse' ] } ], "constants": [ diff --git a/platform/commonUI/general/src/ui/TreeNodeView.js b/platform/commonUI/general/src/ui/TreeNodeView.js index d6637b6722..9481bfdf9e 100644 --- a/platform/commonUI/general/src/ui/TreeNodeView.js +++ b/platform/commonUI/general/src/ui/TreeNodeView.js @@ -76,6 +76,16 @@ define([ } }; + function getIdPath(domainObject) { + function getId(domainObject) { + return domainObject.getId(); + } + + return domainObject ? + domainObject.getCapability('context').getPath().map(getId) : + []; + } + TreeNodeView.prototype.value = function (domainObject) { var activeIdPath = getIdPath(this.activeObject), selectedIdPath = getIdPath(domainObject); diff --git a/platform/commonUI/general/src/ui/TreeView.js b/platform/commonUI/general/src/ui/TreeView.js index a0c635322e..120c3230c8 100644 --- a/platform/commonUI/general/src/ui/TreeView.js +++ b/platform/commonUI/general/src/ui/TreeView.js @@ -92,7 +92,7 @@ define([ TreeView.prototype.updateNodeViewSelection = function () { this.nodeViews.forEach(function (nodeView) { nodeView.value(this.selectedObject); - }); + }.bind(this)); }; TreeView.prototype.value = function (domainObject) {