aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/new-file-dialog
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/ui/new-file-dialog')
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html9
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js39
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js60
3 files changed, 61 insertions, 47 deletions
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html
index 7340251c..1f9d9b9f 100755
--- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html
+++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html
@@ -58,13 +58,20 @@
58 } 58 }
59 }, 59 },
60 60
61 "newFileName": {
62 "prototype": "montage/ui/textfield.reel",
63 "properties": {
64 "element": {"#": "newFileName"}
65 }
66 },
67
61 "owner":{ 68 "owner":{
62 "module": "js/io/ui/new-file-dialog/new-file-location.reel", 69 "module": "js/io/ui/new-file-dialog/new-file-location.reel",
63 "name": "NewFileLocation", 70 "name": "NewFileLocation",
64 "properties": { 71 "properties": {
65 "element": {"#": "newfileLocation"}, 72 "element": {"#": "newfileLocation"},
66 "fileInputField": {"@": "fileInputField"}, 73 "fileInputField": {"@": "fileInputField"},
67 "newFileName": {"#": "newFileName"} 74 "newFileName": {"@": "newFileName"}
68 } 75 }
69 } 76 }
70 } 77 }
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
index 02579676..3ac38d02 100755
--- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
+++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js
@@ -22,31 +22,34 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
22 value: function() { 22 value: function() {
23 this.fileInputField.selectDirectory = true; 23 this.fileInputField.selectDirectory = true;
24 24
25 this.newFileName.addEventListener("keyup", this, false); 25 this.addEventListener("change@newFileName.value", this.newFileNameChange, false);
26 this.newFileName.addEventListener("paste", this, false); 26 this.newFileName.element.addEventListener("keyup", this, false);
27 this.newFileName.focus(); 27 this.newFileName.element.focus();
28 this.newFileName.select(); 28 this.newFileName.element.select();
29 } 29 }
30 }, 30 },
31 31
32 handlePaste:{ 32 handleKeyup:{
33 value:function(evt){ 33 value: function(evt){
34 evt.preventDefault(); 34 if(evt.keyCode === 13){
35 evt.target.value = evt.clipboardData.getData("Text"); 35 var enterKeyupEvent = document.createEvent("Events");
36 this.handleKeyup(evt); 36 enterKeyupEvent.initEvent("enterKey", false, false);
37 this.eventManager.dispatchEvent(enterKeyupEvent);
38 }else if(evt.keyCode === 27){
39 var escKeyupEvent = document.createEvent("Events");
40 escKeyupEvent.initEvent("escKey", false, false);
41 this.eventManager.dispatchEvent(escKeyupEvent);
42 }
37 } 43 }
38 }, 44 },
39 45
40 handleKeyup:{ 46 newFileNameChange:{
41 value:function(evt){ 47 value:function(evt){
42 if(this.newFileName.value !== "") { 48 var newFileNameSetEvent = document.createEvent("Events");
43 var newFileNameSetEvent = document.createEvent("Events"); 49 newFileNameSetEvent.initEvent("newFileNameSet", false, false);
44 newFileNameSetEvent.initEvent("newFileNameSet", false, false); 50 newFileNameSetEvent.newFileName = this.newFileName.value;
45 newFileNameSetEvent.newFileName = this.newFileName.value; 51 newFileNameSetEvent.keyCode = evt.keyCode;
46 newFileNameSetEvent.keyCode = evt.keyCode; 52 this.eventManager.dispatchEvent(newFileNameSetEvent);
47 this.eventManager.dispatchEvent(newFileNameSetEvent);
48 }
49 } 53 }
50 } 54 }
51
52}); \ No newline at end of file 55}); \ No newline at end of file
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
index c98955ca..1a26c99c 100644
--- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
+++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
@@ -30,12 +30,12 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
30 newFileName:{ 30 newFileName:{
31 writable:true, 31 writable:true,
32 enumerable:false, 32 enumerable:false,
33 value:"" 33 value:null
34 }, 34 },
35 newFileDirectory:{ 35 newFileDirectory:{
36 writable:true, 36 writable:true,
37 enumerable:false, 37 enumerable:false,
38 value:"" 38 value:null
39 }, 39 },
40 templateWidth:{ 40 templateWidth:{
41 writable:true, 41 writable:true,
@@ -145,6 +145,9 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
145 } 145 }
146 }, true); 146 }, true);
147 147
148 this.eventManager.addEventListener("enterKey", this, false);
149 this.eventManager.addEventListener("escKey", this, false);
150
148 } 151 }
149 152
150 }, 153 },
@@ -326,32 +329,36 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
326 329
327 handleNewFileDirectorySet:{ 330 handleNewFileDirectorySet:{
328 value:function(evt){ 331 value:function(evt){
329 if(evt.keyCode === 13){ 332 this.newFileDirectory = evt._event.newFileDirectory;
330 if(!this.okButton.hasAttribute("disabled")) this.handleOkButtonAction(evt); 333 if(this.isValidUri(this.newFileDirectory)){
331 }else if(evt.keyCode === 27){ 334 this.enableOk();
332 this.handleCancelButtonAction(evt);
333 }
334 else if(!!evt._event.newFileDirectory){
335 this.newFileDirectory = evt._event.newFileDirectory;
336 if(this.isValidUri(this.newFileDirectory)){
337 this.enableOk();
338 }
339 } 335 }
340 } 336 }
341 }, 337 },
342 338
343 handleNewFileNameSet:{ 339 handleNewFileNameSet:{
344 value:function(evt){ 340 value:function(evt){
345 if((evt.keyCode === 13) && !this.okButton.hasAttribute("disabled")){ 341 this.newFileName = evt._event.newFileName;
346 this.handleOkButtonAction(evt); 342 if(this.isValidFileName(this.newFileName)){
347 }else if(evt.keyCode === 27){ 343 this.enableOk();
348 this.handleCancelButtonAction(evt);
349 } 344 }
350 else if(!!evt._event.newFileName){ 345 }
351 this.newFileName = evt._event.newFileName; 346 },
352 if(this.isValidFileName(this.newFileName)){ 347
353 this.enableOk(); 348 handleEnterKey:{
354 } 349 value: function(evt){
350 if((this.application.ninja.newFileController.newFileOptionsNav !== null)
351 && !this.okButton.hasAttribute("disabled")){
352
353 this.handleOkButtonAction(evt);
354 }
355 }
356 },
357
358 handleEscKey:{
359 value: function(evt){
360 if(this.application.ninja.newFileController.newFileOptionsNav !== null){
361 this.handleCancelButtonAction(evt);
355 } 362 }
356 } 363 }
357 }, 364 },
@@ -422,14 +429,12 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
422 isValidUri:{ 429 isValidUri:{
423 value: function(uri){ 430 value: function(uri){
424 var status= this.application.ninja.coreIoApi.isValidUri(uri); 431 var status= this.application.ninja.coreIoApi.isValidUri(uri);
425 if(uri !== ""){ 432 if((uri !== null) && !status){
426 if(!status){
427 this.showError("! Invalid directory."); 433 this.showError("! Invalid directory.");
428 //disable ok 434 //disable ok