aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-21 22:36:54 -0800
committerValerio Virgillito2012-02-21 22:36:54 -0800
commit067ebae166ff82ae113a91517dfa59e7de5ae3d3 (patch)
treedc3bca23a3562c260262e2c772cf9c0d11e4debd /js/io/ui
parentf86577d5083aeed2de7a932fe4147e9002e91554 (diff)
downloadninja-067ebae166ff82ae113a91517dfa59e7de5ae3d3.tar.gz
cleanup - using montage functions handlers and using the NJevent
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/io/ui')
-rwxr-xr-xjs/io/ui/file-picker/file-input-field.reel/file-input-field.js21
-rwxr-xr-xjs/io/ui/file-picker/file-picker-controller.js22
2 files changed, 14 insertions, 29 deletions
diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
index 235be8ad..651fd7fa 100755
--- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
+++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js
@@ -9,24 +9,13 @@ var Montage = require("montage/core/core").Montage,
9 9
10var FileInputField = exports.FileInputField = Montage.create(Component, { 10var FileInputField = exports.FileInputField = Montage.create(Component, {
11 11
12 hasReel: {
13 value: true
14 },
15
16 willDraw: {
17 enumerable: false,
18 value: function() {}
19 },
20 draw: {
21 enumerable: false,
22 value: function() {}
23 },
24 didDraw: { 12 didDraw: {
25 enumerable: false, 13 enumerable: false,
26 value: function() { 14 value: function() {
27 var that = this; 15 var that = this;
28 this.findDirectory.identifier = "findDirectory"; 16 this.findDirectory.identifier = "findDirectory";
29 this.findDirectory.addEventListener("click", function(evt){that.handleFindDirectoryClick(evt);}, false); 17
18 this.findDirectory.addEventListener("click", this, false);
30 19
31 this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); 20 this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false);
32 21
@@ -60,8 +49,6 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
60 49
61 handleFindDirectoryClick: { 50 handleFindDirectoryClick: {
62 value: function(evt){ 51 value: function(evt){
63 var openFilePicker = document.createEvent("Events");
64 openFilePicker.initEvent("openFilePicker", false, false);
65 var settings = {}; 52 var settings = {};
66 if(this.selectDirectory === true){ 53 if(this.selectDirectory === true){
67 settings.inFileMode = false; 54 settings.inFileMode = false;
@@ -71,8 +58,8 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
71 settings.pickerName = this.pickerName || "fileSelector"; 58 settings.pickerName = this.pickerName || "fileSelector";
72 } 59 }
73 settings.callback = this.filePickerCallback.bind(this); 60 settings.callback = this.filePickerCallback.bind(this);
74 openFilePicker.settings = settings; 61
75 this.eventManager.dispatchEvent(openFilePicker); 62 NJevent("openFilePicker", settings);
76 } 63 }
77 }, 64 },
78 65
diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js
index 5e4d0be8..3b19de83 100755
--- a/js/io/ui/file-picker/file-picker-controller.js
+++ b/js/io/ui/file-picker/file-picker-controller.js
@@ -19,16 +19,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
19 writable:false, 19 writable:false,
20 enumerable:true, 20 enumerable:true,
21 value:function(){ 21 value:function(){
22 var that = this; 22 this.eventManager.addEventListener("openFilePicker", this, false);
23
24 this.eventManager.addEventListener("openFilePicker", function(evt){
25 var settings;
26 if(typeof evt._event.settings !== "undefined"){
27 settings = evt._event.settings;
28 }
29 that.showFilePicker(settings);
30 }, false);
31
32 } 23 }
33 }, 24 },
34 25
@@ -37,6 +28,12 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
37 value: "filePicker" 28 value: "filePicker"
38 }, 29 },
39 30
31 handleOpenFilePicker: {
32 value: function(evt) {
33 this.showFilePicker(evt.detail);
34 }
35 },
36
40 /** 37 /**
41 *this function is used to create an instance of a file picker 38 *this function is used to create an instance of a file picker
42 * 39 *
@@ -128,7 +125,9 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
128 } 125 }
129 126
130 if(!!storedUri){ 127 if(!!storedUri){
131 aModel.currentRoot = unescape(storedUri); 128 // This is depracated -- use decodeURI instead
129 //aModel.currentRoot = unescape(storedUri);
130 aModel.currentRoot = decodeURI(storedUri);
132 } 131 }
133 132
134 if(!!allFileFilters){aModel.fileFilters = allFileFilters;} 133 if(!!allFileFilters){aModel.fileFilters = allFileFilters;}
@@ -137,7 +136,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
137 if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;} 136 if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;}
138 137
139 138
140
141 //logic: get file content data onDemand from the REST api for the default or last opened root. Cache the data in page [in local cache ? dirty fs? ]. Filter on client side to reduce network calls. 139 //logic: get file content data onDemand from the REST api for the default or last opened root. Cache the data in page [in local cache ? dirty fs? ]. Filter on client side to reduce network calls.
142 this.openFilePickerAsModal(callback, aModel); 140 this.openFilePickerAsModal(callback, aModel);
143 141