diff options
author | John Mayhew | 2012-04-02 16:28:39 -0700 |
---|---|---|
committer | John Mayhew | 2012-04-02 16:28:39 -0700 |
commit | b4155fb4c33675a8a7cd37473513718043fdf0ba (patch) | |
tree | 3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/io/ui/save-as-dialog.reel/save-as-dialog.js | |
parent | 5ba9aeac94c86049423fd5d4b37b277263939c13 (diff) | |
parent | c6de22bf42be90b403491b5f87b1818d9020310c (diff) | |
download | ninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts:
js/helper-classes/RDGE/rdge-compiled.js
js/helper-classes/RDGE/runtime/GLRuntime.js
js/helper-classes/RDGE/src/core/script/MeshManager.js
js/helper-classes/RDGE/src/core/script/engine.js
js/helper-classes/RDGE/src/core/script/fx/ssao.js
js/helper-classes/RDGE/src/core/script/init_state.js
js/helper-classes/RDGE/src/core/script/run_state.js
js/helper-classes/RDGE/src/core/script/scenegraphNodes.js
js/helper-classes/RDGE/src/core/script/utilities.js
js/helper-classes/RDGE/src/tools/compile-rdge-core.bat
js/helper-classes/RDGE/src/tools/compile-rdge-core.sh
js/helper-classes/RDGE/src/tools/rdge-compiled.js
js/lib/drawing/world.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/deform-material.js
js/lib/rdge/materials/flat-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/linear-gradient-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-blur-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/relief-tunnel-material.js
js/lib/rdge/materials/square-tunnel-material.js
js/lib/rdge/materials/star-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/tunnel-material.js
js/lib/rdge/materials/twist-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/uber-material.js
js/lib/rdge/materials/water-material.js
js/lib/rdge/materials/z-invert-material.js
js/preloader/Preloader.js
Diffstat (limited to 'js/io/ui/save-as-dialog.reel/save-as-dialog.js')
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.js | 63 |
1 files changed, 58 insertions, 5 deletions
diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js index 0a322b99..c5ed8d33 100644 --- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js +++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js | |||
@@ -55,18 +55,42 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
55 | this.fileInputField.newFileDirectory.value = this.folderUri; | 55 | this.fileInputField.newFileDirectory.value = this.folderUri; |
56 | 56 | ||
57 | this.newFileName.addEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false); | 57 | this.newFileName.addEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false); |
58 | this.newFileName.addEventListener("paste", this, false); | ||
58 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); | 59 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); |
59 | 60 | ||
60 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); | 61 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); |
61 | this.cancelButton.addEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); | 62 | this.cancelButton.addEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); |
62 | 63 | ||
64 | this.newFileName.focus(); | ||
65 | this.newFileName.select(); | ||
66 | |||
63 | this.enableOk(); | 67 | this.enableOk(); |
68 | |||
69 | this.element.addEventListener("keyup", function(evt){ | ||
70 | if(evt.keyCode == 27) {//ESC key | ||
71 | if(self.application.ninja.newFileController.saveAsDialog !== null){ | ||
72 | self.handleCancelButtonAction(); | ||
73 | } | ||
74 | }else if((evt.keyCode == 13) && !(evt.ctrlKey || evt.metaKey)){//ENTER key | ||
75 | if((self.application.ninja.newFileController.saveAsDialog !== null) | ||
76 | && !self.okButton.hasAttribute("disabled")){ | ||
77 | |||
78 | self.handleOkButtonAction(); | ||
79 | } | ||
80 | } | ||
81 | }, true); | ||
82 | |||
64 | } | 83 | } |
65 | }, | 84 | }, |
66 | 85 | ||
67 | handleNewFileDirectorySet:{ | 86 | handleNewFileDirectorySet:{ |
68 | value:function(evt){ | 87 | value:function(evt){ |
69 | if(!!evt._event.newFileDirectory){ | 88 | if(evt.keyCode === 13){ |
89 | if(!this.okButton.hasAttribute("disabled")) this.handleOkButtonAction(evt); | ||
90 | }else if(evt.keyCode === 27){ | ||
91 | this.handleCancelButtonAction(evt); | ||
92 | } | ||
93 | else if(!!evt._event.newFileDirectory){ | ||
70 | this.folderUri = evt._event.newFileDirectory; | 94 | this.folderUri = evt._event.newFileDirectory; |
71 | if(this.isValidUri(this.folderUri)){ | 95 | if(this.isValidUri(this.folderUri)){ |
72 | this.enableOk(); | 96 | this.enableOk(); |
@@ -75,6 +99,14 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
75 | } | 99 | } |
76 | }, | 100 | }, |
77 | 101 | ||
102 | handlePaste:{ | ||
103 | value:function(evt){ | ||
104 | evt.preventDefault(); | ||
105 | evt.target.value = evt.clipboardData.getData("Text"); | ||
106 | this.handleNewFileNameOnkeyup(evt); | ||
107 | } | ||
108 | }, | ||
109 | |||
78 | handleNewFileNameOnkeyup:{ | 110 | handleNewFileNameOnkeyup:{ |
79 | value:function(evt){ | 111 | value:function(evt){ |
80 | this.fileName = this.newFileName.value; | 112 | this.fileName = this.newFileName.value; |
@@ -83,6 +115,13 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
83 | this.enableOk(); | 115 | this.enableOk(); |
84 | } | 116 | } |
85 | } | 117 | } |
118 | if(evt.keyCode === 13){ | ||
119 | if(!this.okButton.hasAttribute("disabled")){ | ||
120 | this.handleOkButtonAction(evt); | ||
121 | } | ||
122 | }else if(evt.keyCode === 27){ | ||
123 | this.handleCancelButtonAction(evt); | ||
124 | } | ||
86 | } | 125 | } |
87 | }, | 126 | }, |
88 | 127 | ||
@@ -99,7 +138,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
99 | handleCancelButtonAction :{ | 138 | handleCancelButtonAction :{ |
100 | value:function(evt){ | 139 | value:function(evt){ |
101 | //clean up memory | 140 | //clean up memory |
102 | //this.cleanup(); | 141 | this.cleanup(); |
103 | 142 | ||
104 | if(this.popup){ | 143 | if(this.popup){ |
105 | this.popup.hide(); | 144 | this.popup.hide(); |
@@ -111,7 +150,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
111 | handleOkButtonAction:{ | 150 | handleOkButtonAction:{ |
112 | value: function(evt){ | 151 | value: function(evt){ |
113 | var filename = this.fileName, | 152 | var filename = this.fileName, |
114 | newFileDirectory = this.newFileDirectory, | 153 | newFileDirectory = this.folderUri, |
115 | success = true; | 154 | success = true; |
116 | if(this.isValidFileName(this.fileName) && this.isValidUri(this.folderUri) && !this.checkFileExists(this.fileName, this.folderUri)){ | 155 | if(this.isValidFileName(this.fileName) && this.isValidUri(this.folderUri) && !this.checkFileExists(this.fileName, this.folderUri)){ |
117 | try{ | 156 | try{ |
@@ -128,13 +167,13 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
128 | } | 167 | } |
129 | }catch(e){ | 168 | }catch(e){ |
130 | success = false; | 169 | success = false; |
131 | console.log("[ERROR] Failed to save: "+ this.fileName + " at "+ this.newFileDirectory); | 170 | console.log("[ERROR] Failed to save: "+ this.fileName + " at "+ newFileDirectory); |
132 | console.log(e.stack); | 171 | console.log(e.stack); |
133 | } | 172 | } |
134 | 173 | ||
135 | if(success){ | 174 | if(success){ |
136 | //clean up memory | 175 | //clean up memory |
137 | //this.cleanup(); | 176 | this.cleanup(); |
138 | 177 | ||
139 | if(this.popup){ | 178 | if(this.popup){ |
140 | this.popup.hide(); | 179 | this.popup.hide(); |
@@ -227,6 +266,20 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
227 | } | 266 | } |
228 | return status; | 267 | return status; |
229 | } | 268 | } |
269 | }, | ||
270 | |||
271 | cleanup:{ | ||
272 | value:function(){ | ||
273 | var self = this; | ||
274 | |||
275 | //remove event listener | ||
276 | this.newFileName.removeEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false); | ||
277 | this.eventManager.removeEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); | ||
278 | this.okButton.removeEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); | ||
279 | this.cancelButton.removeEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); | ||
280 | |||
281 | this.application.ninja.newFileController.saveAsDialog = null; | ||
230 | } | 282 | } |
283 | } | ||
231 | 284 | ||
232 | }); \ No newline at end of file | 285 | }); \ No newline at end of file |