diff options
author | Jose Antonio Marquez | 2012-02-21 18:04:27 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-21 18:04:27 -0800 |
commit | 25e6a03cf8af4bd0496a8b21c82332d76ddd9fff (patch) | |
tree | 9b4ef3a716139d5259261cae97e8603a1d33a91f /js/components/ui/FilePicker/file-input-field.reel/file-input-field.js | |
parent | 20dc41e571ddec6b781653fac43e2ca34026937d (diff) | |
parent | 2f24dafec79583547fe663d5a387d8ef15aae3bf (diff) | |
download | ninja-25e6a03cf8af4bd0496a8b21c82332d76ddd9fff.tar.gz |
Merge branch 'refs/heads/NinjaInternal' into Color
Diffstat (limited to 'js/components/ui/FilePicker/file-input-field.reel/file-input-field.js')
-rwxr-xr-x | js/components/ui/FilePicker/file-input-field.reel/file-input-field.js | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js deleted file mode 100755 index 235be8ad..00000000 --- a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js +++ /dev/null | |||
@@ -1,120 +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 | |||
10 | var FileInputField = exports.FileInputField = Montage.create(Component, { | ||
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: { | ||
25 | enumerable: false, | ||
26 | value: function() { | ||
27 | var that = this; | ||
28 | this.findDirectory.identifier = "findDirectory"; | ||
29 | this.findDirectory.addEventListener("click", function(evt){that.handleFindDirectoryClick(evt);}, false); | ||
30 | |||
31 | this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); | ||
32 | |||
33 | this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); | ||
34 | } | ||
35 | }, | ||
36 | |||
37 | /** | ||
38 | * Either selectDirectory OR selectFile can be true | ||
39 | * If both are false then the file picker will default to file selection mode | ||
40 | */ | ||
41 | |||
42 | selectDirectory:{ | ||
43 | writable: true, | ||
44 | enumerable:false, | ||
45 | value: false | ||
46 | }, | ||
47 | |||
48 | pickerName:{ | ||
49 | writable: true, | ||
50 | enumerable:false, | ||
51 | value: null | ||
52 | }, | ||
53 | |||
54 | selectFile:{ | ||
55 | writable: true, | ||
56 | enumerable:false, | ||
57 | value: false | ||
58 | }, | ||
59 | |||
60 | |||
61 | handleFindDirectoryClick: { | ||
62 | value: function(evt){ | ||
63 | var openFilePicker = document.createEvent("Events"); | ||
64 | openFilePicker.initEvent("openFilePicker", false, false); | ||
65 | var settings = {}; | ||
66 | if(this.selectDirectory === true){ | ||
67 | settings.inFileMode = false; | ||
68 | settings.pickerName = this.pickerName || "newFileDirectorySelector"; | ||
69 | }else{ | ||
70 | settings.inFileMode = true; | ||
71 | settings.pickerName = this.pickerName || "fileSelector"; | ||
72 | } | ||
73 | settings.callback = this.filePickerCallback.bind(this); | ||
74 | openFilePicker.settings = settings; | ||
75 | this.eventManager.dispatchEvent(openFilePicker); | ||
76 | } | ||
77 | }, | ||
78 | |||
79 | handleNewFileDirectoryOnkeyup:{ | ||
80 | value:function(evt){ | ||
81 | if(this.newFileDirectory.value !== ""){ | ||
82 | var newFileDirectorySetEvent = document.createEvent("Events"); | ||
83 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | ||
84 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | ||
85 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); | ||
86 | } | ||
87 | } | ||
88 | }, | ||
89 | |||
90 | handleFileInputPickerSelectionsDone:{ | ||
91 | value: function(evt){ | ||
92 | var selectedUri = ""; | ||
93 | if(!!evt._event.selectedItems && evt._event.selectedItems.length > 0){ | ||
94 | selectedUri = evt._event.selectedItems[0]; | ||
95 | this.newFileDirectory.value = selectedUri; | ||
96 | |||
97 | var newFileDirectorySetEvent = document.createEvent("Events"); | ||
98 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | ||
99 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | ||
100 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); | ||
101 | } | ||
102 | } | ||
103 | }, | ||
104 | |||
105 | filePickerCallback:{ | ||
106 | value: function(obj){ | ||
107 | var selectedUri = ""; | ||
108 | if(!!obj && obj.uri && obj.uri.length > 0){ | ||
109 | selectedUri = obj.uri[0]; | ||
110 | this.newFileDirectory.value = selectedUri; | ||
111 | |||
112 | var newFileDirectorySetEvent = document.createEvent("Events"); | ||
113 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | ||
114 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | ||
115 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | |||
120 | }); \ No newline at end of file | ||