aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/bread-crumb.reel
diff options
context:
space:
mode:
authorAnanya Sen2012-02-10 16:05:27 -0800
committerAnanya Sen2012-02-10 16:05:27 -0800
commitf3dc624fa464a79fd8e8cec1ddd16ed2109bda23 (patch)
treef716757dab75d7626297893c7f4aca3596d606de /js/components/layout/bread-crumb.reel
parentc48eeb01bd726895dc577d8b843b2a75883eee07 (diff)
downloadninja-f3dc624fa464a79fd8e8cec1ddd16ed2109bda23.tar.gz
Revert "Merge from /joseeight/ninja-internal/tree/FileIO"
This reverts commit c48eeb01bd726895dc577d8b843b2a75883eee07. Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/components/layout/bread-crumb.reel')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js108
1 files changed, 31 insertions, 77 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index ead7c764..9782d9d1 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -1,8 +1,13 @@
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> */
1 6
2var Montage = require("montage/core/core").Montage 7var Montage = require("montage/core/core").Montage,
3var Component = require("montage/ui/component").Component 8 Component = require("montage/ui/component").Component;
4 9
5var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { 10exports.Breadcrumb = Montage.create(Component, {
6 11
7 _container:{ 12 _container:{
8 value:null 13 value:null
@@ -11,12 +16,10 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
11 16
12 container: { 17 container: {
13 set: function(value) { 18 set: function(value) {
14 if(this._container !== value) { 19 if(this._container !== value) {
15 this._container = value; 20 this._container = value;
16 this.createContainerElements(); 21 this.createContainerElements();
17 } 22 }
18
19
20 }, 23 },
21 get: function() { 24 get: function() {
22 return this._container; 25 return this._container;
@@ -25,132 +28,83 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
25 28
26 containerElements: { 29 containerElements: {
27 value: [] 30 value: []
28
29 }, 31 },
30 32
31
32 deserializedFromTemplate : { 33 deserializedFromTemplate : {
33 value: function() { 34 value: function() {
34 this.eventManager.addEventListener( "appLoaded", this, false); 35 this.eventManager.addEventListener( "appLoaded", this, false);
36 this.eventManager.addEventListener( "openDocument", this, false);
35 this.eventManager.addEventListener( "breadCrumbTrail", this, false); 37 this.eventManager.addEventListener( "breadCrumbTrail", this, false);
36 }, 38 }
37 enumerable : false
38 }, 39 },
39 40
40 handleAppLoaded : { 41 handleAppLoaded : {
41 value: function() { 42 value: function() {
42 43
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(){
67 } 49 }
68 }, 50 },
69 51
70 createContainerElements: { 52 createContainerElements: {
71 value: function() { 53 value: function() {
72
73 var parentNode; 54 var parentNode;
74 55
75 while(this.containerElements.pop()){ 56 while(this.containerElements.pop()){
76 // To empty the array to get the new parentNode of the new currentLevel 57 // To empty the array to get the new parentNode of the new currentLevel
77 } 58 }
78 59
79 if(this.container.id === "UserContent"){ 60 if(this.container.id === "UserContent") {
80
81 this.containerElements.push({selected:false,element:this.container}); 61 this.containerElements.push({selected:false,element:this.container});
62 } else {
82 63
64 parentNode = this.container;
83 65
84 } 66 while(parentNode.id !== "UserContent") {
85 else{
86
87 parentNode= this.container;
88
89 while(parentNode.id!=="UserContent"){
90
91 this.containerElements.unshift ({selected:false,element:parentNode}); 67 this.containerElements.unshift ({selected:false,element:parentNode});
92 parentNode=parentNode.parentNode; 68 parentNode = parentNode.parentNode;
93
94 } 69 }
95 70
96 this.containerElements.unshift({selected:false,element:parentNode}); 71 this.containerElements.unshift({selected:false,element:parentNode});
97 72
98 } 73 }
99 74
100 NJevent('layerBinding',{selected:false ,element:this.container}) 75 NJevent('layerBinding',this.container);
101
102
103 } 76 }
104 }, 77 },
105 78
106 79
107 handleBreadCrumbTrail: { 80 handleBreadCrumbTrail: {
108 value: function(event) { 81 value: function(event) {
109 82 var newLength, revaluatedLength, tmpvalue, i=0;
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 }
116 83
117 newLength = this.containerElements.length; 84 newLength = this.containerElements.length;
118 85
119 while(i < newLength ){ 86 while(i < newLength ) {
120 87 if(this.containerElements[i].selected){
121 if(this.containerElements[i].selected){ 88 tmpvalue = i ;
122 89 break;
123 tmpvalue = i ; 90 }
124 break;
125
126 }
127 91
128 i++; 92 i++;
129 } 93 }
130 94
131 95 for(i = newLength -1 ; i >= 1 ; i--) {
132 96 if(tmpvalue!==i) {
133 for(i = newLength -1 ; i >= 1 ; i--){
134
135 if(tmpvalue!==i){
136
137 this.containerElements.pop(); 97 this.containerElements.pop();
138 } 98 } else {
139
140 else{
141
142 break; 99 break;
143 } 100 }
144
145 } 101 }
146 102
147 revaluatedLength = this.containerElements.length; 103 revaluatedLength = this.containerElements.length;
148 this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; 104 this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element;
149 105
150
151 } 106 }
152 } 107 }
153 108
154 109
155}); 110});
156