aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Guzman2012-02-02 14:58:21 -0800
committerEric Guzman2012-02-06 10:07:00 -0800
commit5c5f4eabdc4befe3fb6da44bc8ad5fef20642f21 (patch)
tree1381f21f592ee269abbb441346a4cbe084b33a33
parentcbcc9dcadaf62b3b0aef380f022bf6c365785627 (diff)
downloadninja-5c5f4eabdc4befe3fb6da44bc8ad5fef20642f21.tar.gz
Tree Controller - Clean out unused code
-rw-r--r--js/controllers/tree-controller.js48
1 files changed, 7 insertions, 41 deletions
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, /
53 value: function() { 53 value: function() {
54 var self = this; 54 var self = this;
55 55
56 ///// Declare function to initialize controller for each node
57 ///// that is a branch
58
59 function initController(array, depth) {
60 var controller = Montage.create(ArrayController, {
61 content : { value: array },
62 delegate : { value: self },
63 isSelectionEnabled : { value: true }});
64
65 if(depth === 0) {
66 self.rootController = controller;
67 }
68
69 self.branchControllers.push({
70 depth : depth,
71 controller : controller
72
73 });
74 }
75
76 ///// Recursive function that finds all branch nodes and initializes 56 ///// Recursive function that finds all branch nodes and initializes
77 ///// an array controller 57 ///// sets the tree node type to "branch" or "leaf"
78 58
79 function walk(node, init, depth) { 59 function walk(node, init, depth) {
80 var children = node[self.branchKey]; 60 var branch = node[self.branchKey];
81
82 if(children) {
83 //init(children, depth);
84 61
85 children.forEach(function(child) { 62 if(branch) {
86 walk(child, init, ++depth); 63 branch.forEach(function(node) {
64 walk(node, init, ++depth);
87 }); 65 });
88 66
89 node['treeNodeType'] = 'branch'; 67 node['treeNodeType'] = 'branch';
@@ -92,7 +70,7 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, /
92 } 70 }
93 } 71 }
94 72
95 walk(this._root, initController, 0); 73 walk(this._root, 0);
96 74
97 } 75 }
98 }, 76 },
@@ -119,10 +97,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, /
119 } 97 }
120 }, 98 },
121 99
122 lazyLoad : {
123 value: false
124 },
125
126 branchControllers: { 100 branchControllers: {
127 value: [] 101 value: []
128 }, 102 },
@@ -160,7 +134,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, /
160 134
161 this._content = value; 135 this._content = value;
162 136
163 //TODO for right now assume that any content change invalidates the selection completely; we'll need to address this of course
164 this.selectedObjects = null; 137 this.selectedObjects = null;
165 138
166 if (this.rootKey) { 139 if (this.rootKey) {
@@ -173,7 +146,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, /
173 this.root = value; 146 this.root = value;
174 } 147 }
175 148
176
177 } 149 }
178 }, 150 },
179 151
@@ -208,12 +180,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, /
208 } 180 }
209 181
210 } 182 }
211 }, 183 }
212
213 insertChildBefore : { value : function() {} },
214
215 insertChildAfter : { value : function() {} }
216
217
218 184
219}); 185});