From 57562aace901f12215895133dc1e7a6fd4daf2a2 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Thu, 2 Feb 2012 14:58:21 -0800 Subject: Tree Controller - Clean out unused code --- js/controllers/tree-controller.js | 48 ++++++--------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) (limited to 'js') diff --git a/js/controllers/tree-controller.js b/js/controllers/tree-controller.js index 45e4c4ba..2b2e910c 100644 --- a/js/controllers/tree-controller.js +++ b/js/controllers/tree-controller.js @@ -53,37 +53,15 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / value: function() { var self = this; - ///// Declare function to initialize controller for each node - ///// that is a branch - - function initController(array, depth) { - var controller = Montage.create(ArrayController, { - content : { value: array }, - delegate : { value: self }, - isSelectionEnabled : { value: true }}); - - if(depth === 0) { - self.rootController = controller; - } - - self.branchControllers.push({ - depth : depth, - controller : controller - - }); - } - ///// Recursive function that finds all branch nodes and initializes - ///// an array controller + ///// sets the tree node type to "branch" or "leaf" function walk(node, init, depth) { - var children = node[self.branchKey]; - - if(children) { - //init(children, depth); + var branch = node[self.branchKey]; - children.forEach(function(child) { - walk(child, init, ++depth); + if(branch) { + branch.forEach(function(node) { + walk(node, init, ++depth); }); node['treeNodeType'] = 'branch'; @@ -92,7 +70,7 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } } - walk(this._root, initController, 0); + walk(this._root, 0); } }, @@ -119,10 +97,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } }, - lazyLoad : { - value: false - }, - branchControllers: { value: [] }, @@ -160,7 +134,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / this._content = value; - //TODO for right now assume that any content change invalidates the selection completely; we'll need to address this of course this.selectedObjects = null; if (this.rootKey) { @@ -173,7 +146,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / this.root = value; } - } }, @@ -208,12 +180,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } } - }, - - insertChildBefore : { value : function() {} }, - - insertChildAfter : { value : function() {} } - - + } }); -- cgit v1.2.3