diff options
Diffstat (limited to 'js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js')
-rw-r--r-- | js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js | 1019 |
1 files changed, 0 insertions, 1019 deletions
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js deleted file mode 100644 index 299d44f5..00000000 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js +++ /dev/null | |||
@@ -1,1019 +0,0 @@ | |||
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 | iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"), | ||
10 | filePickerControllerModule = require("js/components/ui/FilePicker/file-picker-controller"), | ||
11 | treeModule = require("js/components/ui/tree-basic/tree.reel"); | ||
12 | |||
13 | var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | ||
14 | |||
15 | popup:{ | ||
16 | enumerable: false, | ||
17 | writable: true, | ||
18 | value: null | ||
19 | }, | ||
20 | |||
21 | mainContentData:{ | ||
22 | enumerable:false, | ||
23 | writable:true, | ||
24 | value:null | ||
25 | }, | ||
26 | |||
27 | _firstTime: { | ||
28 | enumerable: false, | ||
29 | value: true | ||
30 | }, | ||
31 | |||
32 | firstTime:{ | ||
33 | get: function(){}, | ||
34 | set: function(){} | ||
35 | }, | ||
36 | |||
37 | pickerCallback:{ | ||
38 | enumerable:false, | ||
39 | writable:true, | ||
40 | value:null | ||
41 | }, | ||
42 | |||
43 | selectedItems:{//passed to pickerCallback on click of OK | ||
44 | enumerable:false, | ||
45 | writable:true, | ||
46 | value:[] | ||
47 | }, | ||
48 | |||
49 | /** | ||
50 | * store a reference to the currently selected node... for single selection | ||
51 | */ | ||
52 | currentSelectedNode:{ | ||
53 | enumerable:false, | ||
54 | writable:true, | ||
55 | value:null | ||
56 | }, | ||
57 | |||
58 | currentURI:{ | ||
59 | enumerable:false, | ||
60 | writable:true, | ||
61 | value:null | ||
62 | }, | ||
63 | |||
64 | iconsViewDrawnOnce:{ | ||
65 | enumerable:false, | ||
66 | writable:true, | ||
67 | value:false | ||
68 | }, | ||
69 | |||
70 | /** | ||
71 | * for tree view only | ||
72 | * will store folder uri vs tree instance map | ||
73 | */ | ||
74 | treeRefHash:{ | ||
75 | enumerable:false, | ||
76 | writable:true, | ||
77 | value:{ | ||
78 | |||
79 | } | ||
80 | }, | ||
81 | |||
82 | selectedPickerView:{ | ||
83 | enumerable:false, | ||
84 | writable:true, | ||
85 | value:null | ||
86 | }, | ||
87 | |||
88 | /** | ||
89 | * Contains the different Views and their update handlers | ||
90 | */ | ||
91 | pickerViews:{ | ||
92 | enumerable:false, | ||
93 | writable:true, | ||
94 | value: function(){ | ||
95 | var that = this; | ||
96 | return { | ||
97 | "iconView":that.updateIconView, | ||
98 | "treeView":that.updateTreeView | ||
99 | } | ||
100 | } | ||
101 | }, | ||
102 | |||
103 | pickerModel:{ | ||
104 | enumerable:false, | ||
105 | writable:true, | ||
106 | value:null | ||
107 | }, | ||
108 | |||
109 | willDraw: { | ||
110 | enumerable: false, | ||
111 | value: function() { | ||
112 | |||
113 | } | ||
114 | }, | ||
115 | draw: { | ||
116 | enumerable: false, | ||
117 | value: function() { | ||
118 | this.filterVal.innerHTML = this.pickerModel.currentFilter; | ||
119 | |||
120 | if(this.pickerModel.fatalError !== null){ | ||
121 | this.error.innerHTML = this.pickerModel.fatalError; | ||
122 | } | ||
123 | |||
124 | } | ||
125 | }, | ||
126 | didDraw: { | ||
127 | enumerable: false, | ||
128 | value: function() { | ||
129 | |||
130 | var that = this; | ||
131 | this.iconList = null; | ||
132 | this.newContent = null; | ||
133 | this.spanEl = null; | ||
134 | |||
135 | this.addIdentifiers(); | ||
136 | |||
137 | var topLevelDirs = this.pickerModel.topLevelDirectories; | ||
138 | var leftNav = this.leftNav; | ||
139 | //draw left nav | ||
140 | if(!!topLevelDirs | ||
141 | && (typeof topLevelDirs === "object") | ||
142 | && ('splice' in topLevelDirs) | ||
143 | && ('join' in topLevelDirs) | ||
144 | &&(topLevelDirs.length > 0)){ | ||
145 | |||
146 | topLevelDirs.forEach(function(dirObj){ | ||
147 | var newDiv = document.createElement("div"); | ||
148 | newDiv.className = "driversList"; | ||
149 | newDiv.innerHTML = dirObj.name; | ||
150 | leftNav.appendChild(newDiv); | ||
151 | if(dirObj.uri === this.pickerModel.currentRoot){ | ||
152 | newDiv.classList.add("highlighted"); | ||
153 | } | ||
154 | |||
155 | newDiv.addEventListener("click", function(evt){that.handleTopLevelDirectoryClicks(evt, dirObj);}, false); | ||
156 | }, that); | ||
157 | }else{ | ||
158 | console.error("need at least 1 valid top level directory"); | ||
159 | } | ||
160 | |||
161 | //Draw icon view list | ||
162 | //TODO: check the default view and draw the appropriate view | ||
163 | if(this.mainContentData !== null){ | ||
164 | |||
165 | this.currentURI = this.pickerModel.currentRoot; | ||
166 | |||
167 | //draw the IconsList if icons view container is on | ||
168 | if(this.iconViewContainer.style.display === "block"){ | ||
169 | this.iconList = iconsListModule.IconsList.create(); | ||
170 | //console.log(this.mainContentData); | ||
171 | this.iconList.iconsViewDataObject = this.mainContentData; | ||
172 | this.iconList.element = this.iconViewContainer; | ||
173 | this.iconList.needsDraw = true; | ||
174 | this.iconsViewDrawnOnce = true; | ||
175 | this.selectedPickerView = "iconView"; | ||
176 | |||
177 | if(!this.iconView.classList.contains("viewSelected")){ | ||
178 | this.iconView.classList.add("viewSelected") | ||
179 | } | ||
180 | if(this.treeView.classList.contains("viewSelected")){ | ||
181 | this.treeView.classList.remove("viewSelected"); | ||
182 | } | ||
183 | |||
184 | }else if(this.treeViewContainer.style.display === "block"){ | ||
185 | //else draw the Tree if tree view container is on | ||
186 | this.renderTree(this.treeViewContainer, this.currentURI); | ||
187 | this.selectedPickerView = "treeView"; | ||
188 | |||
189 | if(!this.treeView.classList.contains("viewSelected")){ | ||
190 | this.treeView.classList.add("viewSelected") | ||
191 | } | ||
192 | if(this.iconView.classList.contains("viewSelected")){ | ||
193 | this.iconView.classList.remove("viewSelected"); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | this.updateAddressBar(this.pickerModel.currentRoot); | ||
198 | this.pickerModel.storeHistory(this.pickerModel.currentRoot);//populate history | ||
199 | |||
200 | this.updateMetadata(this.currentURI); | ||
201 | } | ||
202 | |||
203 | this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data | ||
204 | this.element.addEventListener("selectedItem", function(evt){that.handlePickerNavSelectedItem(evt);}, false);//for single selection only | ||
205 | this.element.addEventListener("showMetadata", function(evt){that.handlePickerNavShowMetadata(evt);}, false);//show metadata on hover of icon | ||
206 | this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon | ||
207 | //this.addressGo.addEventListener("click", this, false); | ||
208 | this.addressBarUri.addEventListener("keydown", this, false); |