aboutsummaryrefslogtreecommitdiff
path: root/js/components/treeview/ninja-leaf.reel
diff options
context:
space:
mode:
authorArmen Kesablyan2012-02-07 16:51:14 -0800
committerArmen Kesablyan2012-02-07 16:51:14 -0800
commit8110e01dc5093ac6baf621103dcaa5f769e5be92 (patch)
treeecf339e3097b6ba25d81cbe44d913ee67591bf4b /js/components/treeview/ninja-leaf.reel
parent5f506542d28e12b707c3bfa41b53383519838477 (diff)
parent668510892537eaaeb2e11520831d87b44b2489b7 (diff)
downloadninja-8110e01dc5093ac6baf621103dcaa5f769e5be92.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Diffstat (limited to 'js/components/treeview/ninja-leaf.reel')
-rw-r--r--js/components/treeview/ninja-leaf.reel/ninja-leaf.css28
-rw-r--r--js/components/treeview/ninja-leaf.reel/ninja-leaf.html43
-rw-r--r--js/components/treeview/ninja-leaf.reel/ninja-leaf.js41
3 files changed, 112 insertions, 0 deletions
diff --git a/js/components/treeview/ninja-leaf.reel/ninja-leaf.css b/js/components/treeview/ninja-leaf.reel/ninja-leaf.css
new file mode 100644
index 00000000..b2f427b5
--- /dev/null
+++ b/js/components/treeview/ninja-leaf.reel/ninja-leaf.css
@@ -0,0 +1,28 @@
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.treeRoot .leaf-label {
8 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAIAAAD9iXMrAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1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p2Dw96VVX9L%2FJ93wRrmkZJIKrZcRyK%2Bs25p5%2BU8pK4KCakMAzxL4oCJIqivu8Nw0DDu25ZFtW3ritIkiS0tGVZtm1%2F6rZtu4yr67osSyJBEJx3ybKsbVukOecU4zh2XRfKMAzTNJmYpWxgPM%2BzEIIxRrzrOs%2FzdMyVvyAxTdPxAJFzv%2BeBbz8cfN93kDzPb55ZewkwAF0Ddf6ATSsHAAAAAElFTkSuQmCC);
9 background-position: 3px center;
10 background-repeat: no-repeat;
11 border-bottom: 1px solid #505050;
12 cursor: pointer;
13 padding: 3px 0 4px;
14}
15/* First level */
16.branch .leaf-label {
17 padding-left: 25px;
18}
19/* Second level */
20.branch .branch .leaf-label {
21 background-position: 25px center;
22 padding-left: 45px;
23}
24/* Third level */
25.branch .branch .branch .leaf-label {
26 background-position: 45px center;
27 padding-left: 65px;
28} \ No newline at end of file
diff --git a/js/components/treeview/ninja-leaf.reel/ninja-leaf.html b/js/components/treeview/ninja-leaf.reel/ninja-leaf.html
new file mode 100644
index 00000000..bd8e8acd
--- /dev/null
+++ b/js/components/treeview/ninja-leaf.reel/ninja-leaf.html
@@ -0,0 +1,43 @@
1<!DOCTYPE html>
2<!-- <copyright>
3This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
4No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
5(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
6</copyright> -->
7<html lang="en">
8<head>
9 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
10 <link href="ninja-leaf.css" rel="stylesheet" type="text/css" />
11 <script type="text/montage-serialization">
12 {
13 "owner": {
14 "module" : "js/components/treeview/ninja-leaf.reel",
15 "name" : "Leaf",
16 "properties" : {
17 "element" : {"#" : "leaf"},
18 "label" : { "@" : "textComponent" }
19 }
20 },
21 "textComponent" : {
22 "module" : "montage/ui/dynamic-text.reel",
23 "name" : "DynamicText",
24 "properties" : {
25 "element" : { "#" : "label" }
26 },
27 "bindings" : {
28 "value" : {
29 "boundObject" : {"@": "owner"},
30 "boundObjectPropertyPath": "_labelText",
31 "oneway": true
32 }
33 }
34 }
35 }
36 </script>
37</head>
38<body>
39 <div id="leaf" class="leaf">
40 <div id="label" class="leaf-label"></div>
41 </div>
42</body>
43</html> \ No newline at end of file
diff --git a/js/components/treeview/ninja-leaf.reel/ninja-leaf.js b/js/components/treeview/ninja-leaf.reel/ninja-leaf.js
new file mode 100644
index 00000000..bd566b26
--- /dev/null
+++ b/js/components/treeview/ninja-leaf.reel/ninja-leaf.js
@@ -0,0 +1,41 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component;
9 TreeNode = require("js/components/treeview/tree-node").TreeNode;
10
11exports.Leaf = Montage.create(TreeNode, {
12 hasTemplate: {
13 value: true
14 },
15 templateDidLoad : {
16 value: function() {
17 this.needsDraw = true;
18 }
19 },
20 prepareForDraw: {
21 value : function() {
22 this.activationEvent = this.activationEvent || 'click';
23 this.label._element.addEventListener(this.activationEvent, this.handleNodeActivation.bind(this), false);
24 }
25 },
26 handleNodeActivation: {
27 value: function(e) {
28 console.log(this.sourceObject);
29 this.treeView.contentController.delegate.applyPresetSelection(this.sourceObject);
30 }
31 },
32 draw : {
33 value : function() {
34 if(this.sourceObject[this.labelKey]) {
35 this._labelText = this.sourceObject[this.labelKey];
36 }
37 }
38 }
39
40
41});