diff options
author | Valerio Virgillito | 2012-02-06 14:09:29 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-06 14:09:29 -0800 |
commit | 07e5839e0ec6da2eb71056ff18b90226af213eef (patch) | |
tree | bfc93091f03f2c2383ccfe3ec73dd85bf0a0ccf3 /js/components/treeview/branch.reel/branch.js | |
parent | 671a27069db6a121507c2b342653aede685cff67 (diff) | |
parent | c83b0d9bf3f37ae8569e8afc51dbcba9ed003929 (diff) | |
download | ninja-07e5839e0ec6da2eb71056ff18b90226af213eef.tar.gz |
Merge pull request #16 from ericguzman/TreeComponents
Tree components
Diffstat (limited to 'js/components/treeview/branch.reel/branch.js')
-rw-r--r-- | js/components/treeview/branch.reel/branch.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/js/components/treeview/branch.reel/branch.js b/js/components/treeview/branch.reel/branch.js new file mode 100644 index 00000000..892da71a --- /dev/null +++ b/js/components/treeview/branch.reel/branch.js | |||
@@ -0,0 +1,48 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage").Montage, | ||
8 | Component = require("montage/ui/component").Component, | ||
9 | TreeNode = require("js/components/treeview/tree-node").TreeNode; | ||
10 | |||
11 | var Branch = exports.Branch = Montage.create(TreeNode, { | ||
12 | hasTemplate:{ | ||
13 | value:true | ||
14 | }, | ||
15 | repetition:{ | ||
16 | value: null | ||
17 | }, | ||
18 | prepareForDraw : { | ||
19 | value: function() { | ||
20 | this.label._element.addEventListener('click', this, false); | ||
21 | |||
22 | this.treeView.contentController.addBranchController(this.arrayController); | ||
23 | } | ||
24 | }, | ||
25 | draw:{ | ||
26 | value: function () { | ||
27 | |||
28 | if (this.sourceObject[this.labelKey]) { | ||
29 | this._labelText = this.sourceObject[this.labelKey]; | ||
30 | } else { | ||
31 | console.log("Label key unknown"); | ||
32 | } | ||
33 | |||
34 | } | ||
35 | }, | ||
36 | handleClick : { | ||
37 | value: function(e) { | ||
38 | e.preventDefault(); | ||
39 | this.toggleExpand(); | ||
40 | |||
41 | } | ||
42 | }, | ||
43 | collapseClass : { | ||
44 | value: 'collapse' | ||
45 | } | ||
46 | |||
47 | |||
48 | }); | ||