diff options
author | Pierre Frisch | 2011-12-22 07:25:50 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-01-27 11:18:17 -0800 |
commit | b89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch) | |
tree | 0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /js/components/layout/bread-crumb.reel | |
parent | 2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff) | |
download | ninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz |
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'js/components/layout/bread-crumb.reel')
-rw-r--r-- | js/components/layout/bread-crumb.reel/bread-crumb.css | 27 | ||||
-rw-r--r-- | js/components/layout/bread-crumb.reel/bread-crumb.html | 70 | ||||
-rw-r--r-- | js/components/layout/bread-crumb.reel/bread-crumb.js | 110 |
3 files changed, 207 insertions, 0 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.css b/js/components/layout/bread-crumb.reel/bread-crumb.css new file mode 100644 index 00000000..f84c6e80 --- /dev/null +++ b/js/components/layout/bread-crumb.reel/bread-crumb.css | |||
@@ -0,0 +1,27 @@ | |||
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 | .bread_crumb{ | ||
8 | border-style: double; | ||
9 | height: 26px; | ||
10 | } | ||
11 | .breadcrumbtrail{ | ||
12 | -webkit-box-flex: 0; | ||
13 | } | ||
14 | .bread_crumb_button{ | ||
15 | background-color: #575757; | ||
16 | float: left; | ||
17 | width: 40px; | ||
18 | height: 20px; | ||
19 | margin-left: 5px; | ||
20 | margin-top: 3px; | ||
21 | |||
22 | font-family: 'Droid Sans', sans-serif; | ||
23 | font-size: 12px; | ||
24 | text-shadow: 1px 1px 1px black; | ||
25 | |||
26 | color: white; | ||
27 | } \ No newline at end of file | ||
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.html b/js/components/layout/bread-crumb.reel/bread-crumb.html new file mode 100644 index 00000000..67328479 --- /dev/null +++ b/js/components/layout/bread-crumb.reel/bread-crumb.html | |||
@@ -0,0 +1,70 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- <copyright> | ||
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
4 | No 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 rel="stylesheet" type="text/css" href="bread-crumb.css"> | ||
11 | |||
12 | |||
13 | <script type="text/montage-serialization"> | ||
14 | { | ||
15 | "owner": { | ||
16 | "module": "js/components/layout/bread-crumb.reel", | ||
17 | "name": "Breadcrumb", | ||
18 | "properties": { | ||
19 | "element": {"#": "breadcrumb_trail"}, | ||
20 | "button" : {"@":"breadCrumbButton"}, | ||
21 | "stylerepetition" : {"@":"repetition1"} | ||
22 | |||
23 | } | ||
24 | }, | ||
25 | |||
26 | "breadCrumbButton": { | ||
27 | "module": "js/components/layout/bread-crumb-button.reel", | ||
28 | "name": "BreadcrumbButton", | ||
29 | "properties": { | ||
30 | "element": {"#": "breadcrumb_button"} | ||
31 | }, | ||
32 | "bindings": { | ||
33 | "data": { | ||
34 | "boundObject": {"@": "repetition1"}, | ||
35 | "boundObjectPropertyPath": "objectAtCurrentIteration", | ||
36 | "oneway": true | ||
37 | } | ||
38 | } | ||
39 | }, | ||
40 | |||
41 | "repetition1": { | ||
42 | "module": "montage/ui/repetition.reel", | ||
43 | "name": "Repetition", | ||
44 | "properties": { | ||
45 | "element": {"#": "breadcrumb_container"} | ||
46 | }, | ||
47 | "bindings": { | ||
48 | "objects": { | ||
49 | "boundObject": {"@": "owner"}, | ||
50 | "boundObjectPropertyPath": "containerElements", | ||
51 | "oneway": true | ||
52 | } | ||
53 | } | ||
54 | } | ||
55 | |||
56 | |||
57 | } | ||
58 | </script> | ||
59 | |||
60 | </head> | ||
61 | <body> | ||
62 | |||
63 | <div id="breadcrumb_trail" class="breadcrumbtrail"> | ||
64 | <div id="breadcrumb_container" class="bread_crumb"> | ||
65 | <div id="breadcrumb_button" class="toolbutton"></div> | ||
66 | </div> | ||
67 | </div> | ||
68 | |||
69 | </body> | ||
70 | </html> \ No newline at end of file | ||
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js new file mode 100644 index 00000000..9782d9d1 --- /dev/null +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -0,0 +1,110 @@ | |||
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/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.Breadcrumb = Montage.create(Component, { | ||
11 | |||
12 | _container:{ | ||
13 | value:null | ||
14 | }, | ||
15 | |||
16 | |||
17 | container: { | ||
18 | set: function(value) { | ||
19 | if(this._container !== value) { | ||
20 | this._container = value; | ||
21 | this.createContainerElements(); | ||
22 | } | ||
23 | }, | ||
24 | get: function() { | ||
25 | return this._container; | ||
26 | } | ||
27 | }, | ||
28 | |||
29 | containerElements: { | ||
30 | value: [] | ||
31 | }, | ||
32 | |||
33 | deserializedFromTemplate : { | ||
34 | value: function() { | ||
35 | this.eventManager.addEventListener( "appLoaded", this, false); | ||
36 | this.eventManager.addEventListener( "openDocument", this, false); | ||
37 | this.eventManager.addEventListener( "breadCrumbTrail", this, false); | ||
38 | } | ||
39 | }, | ||
40 | |||
41 | handleAppLoaded : { | ||
42 | value: function() { | ||
43 | |||
44 | Object.defineBinding(this, "container", { | ||
45 | boundObject: this.application.ninja, | ||
46 | boundObjectPropertyPath: "currentSelectedContainer", | ||
47 | oneway: false | ||
48 | }); | ||
49 | } | ||
50 | }, | ||
51 | |||
52 | createContainerElements: { | ||
53 | value: function() { | ||
54 | var parentNode; | ||
55 | |||
56 | while(this.containerElements.pop()){ | ||
57 | // To empty the array to get the new parentNode of the new currentLevel | ||
58 | } | ||
59 | |||
60 | if(this.container.id === "UserContent") { | ||
61 | this.containerElements.push({selected:false,element:this.container}); | ||
62 | } else { | ||
63 | |||
64 | parentNode = this.container; | ||
65 | |||
66 | while(parentNode.id !== "UserContent") { | ||
67 | this.containerElements.unshift ({selected:false,element:parentNode}); | ||
68 | parentNode = parentNode.parentNode; | ||
69 | } | ||
70 | |||
71 | this.containerElements.unshift({selected:false,element:parentNode}); | ||
72 | |||
73 | } | ||
74 | |||
75 | NJevent('layerBinding',this.container); | ||
76 | } | ||
77 | }, | ||
78 | |||
79 | |||
80 | handleBreadCrumbTrail: { | ||
81 | value: function(event) { | ||
82 | var newLength, revaluatedLength, tmpvalue, i=0; | ||
83 | |||
84 | newLength = this.containerElements.length; | ||
85 | |||
86 | while(i < newLength ) { | ||
87 | if(this.containerElements[i].selected){ | ||
88 | tmpvalue = i ; | ||
89 | break; | ||
90 | } | ||
91 | |||
92 | i++; | ||
93 | } | ||
94 | |||
95 | for(i = newLength -1 ; i >= 1 ; i--) { | ||
96 | if(tmpvalue!==i) { | ||
97 | this.containerElements.pop(); | ||
98 | } else { | ||
99 | break; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | revaluatedLength = this.containerElements.length; | ||
104 | this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; | ||
105 | |||
106 | } | ||
107 | } | ||
108 | |||
109 | |||
110 | }); | ||