aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-09 13:35:15 -0800
committerValerio Virgillito2012-02-09 13:35:15 -0800
commitcebd27bd649d01c8b8713651df3878da14b5e9a8 (patch)
tree3d20d838f2f6892a07cf16c4c959e234f96ee60b /js/components/layout
parent666ae3e9119410cbf7fa974274d95336aaff091c (diff)
parent2092acf520e3f346f15e42c76c2f616e7d094c97 (diff)
downloadninja-cebd27bd649d01c8b8713651df3878da14b5e9a8.tar.gz
Merge branch 'Timeline' of https://github.com/imix23ways/ninja-internal into feature-branch
Conflicts: js/helper-classes/RDGE/Materials/FlatMaterial.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/components/layout')
-rw-r--r--js/components/layout/bread-crumb.reel/bread-crumb.js108
1 files changed, 77 insertions, 31 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index 9782d9d1..ead7c764 100644
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -1,13 +1,8 @@
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 1
7var Montage = require("montage/core/core").Montage, 2var Montage = require("montage/core/core").Montage
8 Component = require("montage/ui/component").Component; 3var Component = require("montage/ui/component").Component
9 4
10exports.Breadcrumb = Montage.create(Component, { 5var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
11 6
12 _container:{ 7 _container:{
13 value:null 8 value:null
@@ -16,10 +11,12 @@ exports.Breadcrumb = Montage.create(Component, {
16 11
17 container: { 12 container: {
18 set: function(value) { 13 set: function(value) {
19 if(this._container !== value) { 14 if(this._container !== value) {
20 this._container = value; 15 this._container = value;
21 this.createContainerElements(); 16 this.createContainerElements();
22 } 17 }
18
19
23 }, 20 },
24 get: function() { 21 get: function() {
25 return this._container; 22 return this._container;
@@ -28,83 +25,132 @@ exports.Breadcrumb = Montage.create(Component, {
28 25
29 containerElements: { 26 containerElements: {
30 value: [] 27 value: []
28
31 }, 29 },
32 30
31
33 deserializedFromTemplate : { 32 deserializedFromTemplate : {
34 value: function() { 33 value: function() {
35 this.eventManager.addEventListener( "appLoaded", this, false); 34 this.eventManager.addEventListener( "appLoaded", this, false);
36 this.eventManager.addEventListener( "openDocument", this, false);
37 this.eventManager.addEventListener( "breadCrumbTrail", this, false); 35 this.eventManager.addEventListener( "breadCrumbTrail", this, false);
38 } 36 },
37 enumerable : false
39 }, 38 },
40 39
41 handleAppLoaded : { 40 handleAppLoaded : {
42 value: function() { 41 value: function() {
43 42
43
44 Object.defineBinding(this, "container", { 44 Object.defineBinding(this, "container", {
45 boundObject: this.application.ninja, 45 boundObject: this.application.ninja,
46 boundObjectPropertyPath: "currentSelectedContainer", 46 boundObjectPropertyPath: "currentSelectedContainer",
47 oneway: false 47 oneway: false
48 }); 48 });
49
50 }
51 },
52
53 prepareForDraw: {
54 value: function() {
55
56 }
57 },
58
59 draw: {
60 value: function() {
61
62 }
63 },
64
65 didDraw:{
66 value:function(){
49 } 67 }
50 }, 68 },
51 69
52 createContainerElements: { 70 createContainerElements: {
53 value: function() { 71 value: function() {
72
54 var parentNode; 73 var parentNode;
55 74
56 while(this.containerElements.pop()){ 75 while(this.containerElements.pop()){
57 // To empty the array to get the new parentNode of the new currentLevel 76 // To empty the array to get the new parentNode of the new currentLevel
58 } 77 }
59 78
60 if(this.container.id === "UserContent") { 79 if(this.container.id === "UserContent"){
80
61 this.containerElements.push({selected:false,element:this.container}); 81 this.containerElements.push({selected:false,element:this.container});
62 } else {
63 82
64 parentNode = this.container;
65 83
66 while(parentNode.id !== "UserContent") { 84 }
85 else{
86
87 parentNode= this.container;
88
89 while(parentNode.id!=="UserContent"){
90
67 this.containerElements.unshift ({selected:false,element:parentNode}); 91 this.containerElements.unshift ({selected:false,element:parentNode});
68 parentNode = parentNode.parentNode; 92 parentNode=parentNode.parentNode;
93
69 } 94 }
70 95
71 this.containerElements.unshift({selected:false,element:parentNode}); 96 this.containerElements.unshift({selected:false,element:parentNode});
72 97
73 } 98 }
74 99
75 NJevent('layerBinding',this.container); 100 NJevent('layerBinding',{selected:false ,element:this.container})
101
102
76 } 103 }
77 }, 104 },
78 105
79 106
80 handleBreadCrumbTrail: { 107 handleBreadCrumbTrail: {
81 value: function(event) { 108 value: function(event) {
82 var newLength, revaluatedLength, tmpvalue, i=0; 109
110 var newLength,revaluatedLength,tmpvalue
111 var i=0;
112 if(event.detail.setFlag){
113 this.application.ninja.currentSelectedContainer = event.detail.element;
114 return;
115 }
83 116
84 newLength = this.containerElements.length; 117 newLength = this.containerElements.length;
85 118
86 while(i < newLength ) { 119 while(i < newLength ){
87 if(this.containerElements[i].selected){ 120
88 tmpvalue = i ; 121 if(this.containerElements[i].selected){
89 break; 122
90 } 123 tmpvalue = i ;
124 break;
125
126 }
91 127
92 i++; 128 i++;
93 } 129 }
94 130
95 for(i = newLength -1 ; i >= 1 ; i--) { 131
96 if(tmpvalue!==i) { 132
133 for(i = newLength -1 ; i >= 1 ; i--){
134
135 if(tmpvalue!==i){
136
97 this.containerElements.pop(); 137 this.containerElements.pop();
98 } else { 138 }
139
140 else{
141
99 break; 142 break;
100 } 143 }
144
101 } 145 }
102 146
103 revaluatedLength = this.containerElements.length; 147 revaluatedLength = this.containerElements.length;
104 this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; 148 this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element;
105 149
150
106 } 151 }
107 } 152 }
108 153
109 154
110}); 155});
156