diff options
author | Ananya Sen | 2012-04-04 19:21:01 -0700 |
---|---|---|
committer | Ananya Sen | 2012-04-04 19:21:01 -0700 |
commit | 5de25f936c9dce08f1d24824ae1946a07e7b708d (patch) | |
tree | c2deb7cf0ac076832b76860ef1fdf1df1f1655d5 /js | |
parent | 17ca01f54591187f5c0812c0fd2cb7260afa9639 (diff) | |
download | ninja-5de25f936c9dce08f1d24824ae1946a07e7b708d.tar.gz |
- disable ok when text box is cleared using backspace and cross, for file name and directory location, in New file and save as dialog
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js')
5 files changed, 45 insertions, 41 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index b0ffe2d8..ed7df972 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -1085,7 +1085,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
1085 | isValidUri:{ | 1085 | isValidUri:{ |
1086 | value: function(uri){ | 1086 | value: function(uri){ |
1087 | var isWindowsUri=false, isUnixUri=false,status=false; | 1087 | var isWindowsUri=false, isUnixUri=false,status=false; |
1088 | if(uri !== ""){ | 1088 | if((uri !== null) && (uri !== "")){ |
1089 | uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces | 1089 | uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces |
1090 | 1090 | ||
1091 | //for local machine folder uri | 1091 | //for local machine folder uri |
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 46e8b386..0f66468a 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 | |||
@@ -21,6 +21,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
21 | 21 | ||
22 | this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); | 22 | this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); |
23 | this.newFileDirectory.addEventListener("paste", this, false); | 23 | this.newFileDirectory.addEventListener("paste", this, false); |
24 | this.newFileDirectory.addEventListener("search", this, false); | ||
24 | } | 25 | } |
25 | }, | 26 | }, |
26 | 27 | ||
@@ -74,16 +75,20 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
74 | 75 | ||
75 | handleNewFileDirectoryOnkeyup:{ | 76 | handleNewFileDirectoryOnkeyup:{ |
76 | value:function(evt){ | 77 | value:function(evt){ |
77 | if(this.newFileDirectory.value !== ""){ | 78 | var newFileDirectorySetEvent = document.createEvent("Events"); |
78 | var newFileDirectorySetEvent = document.createEvent("Events"); | 79 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); |
79 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | 80 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; |
80 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | 81 | newFileDirectorySetEvent.keyCode = evt.keyCode; |
81 | newFileDirectorySetEvent.keyCode = evt.keyCode; | 82 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); |
82 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); | ||
83 | } | ||
84 | } | 83 | } |
85 | }, | 84 | }, |
86 | 85 | ||
86 | handleSearch:{ | ||
87 | value:function(evt){ | ||
88 | this.handleNewFileDirectoryOnkeyup(evt); | ||
89 | } | ||
90 | }, | ||
91 | |||
87 | handleFileInputPickerSelectionsDone:{ | 92 | handleFileInputPickerSelectionsDone:{ |
88 | value: function(evt){ | 93 | value: function(evt){ |
89 | var selectedUri = ""; | 94 | var selectedUri = ""; |
@@ -105,7 +110,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
105 | if(!!obj && obj.uri && obj.uri.length > 0){ | 110 | if(!!obj && obj.uri && obj.uri.length > 0){ |
106 | selectedUri = obj.uri[0]; | 111 | selectedUri = obj.uri[0]; |
107 | this.newFileDirectory.value = selectedUri; | 112 | this.newFileDirectory.value = selectedUri; |
108 | 113 | this.newFileDirectory.focus(); | |
109 | var newFileDirectorySetEvent = document.createEvent("Events"); | 114 | var newFileDirectorySetEvent = document.createEvent("Events"); |
110 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | 115 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); |
111 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | 116 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; |
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..3582f1a5 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 | |||
@@ -24,6 +24,7 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { | |||
24 | 24 | ||
25 | this.newFileName.addEventListener("keyup", this, false); | 25 | this.newFileName.addEventListener("keyup", this, false); |
26 | this.newFileName.addEventListener("paste", this, false); | 26 | this.newFileName.addEventListener("paste", this, false); |
27 | this.newFileName.addEventListener("search", this, false); | ||
27 | this.newFileName.focus(); | 28 | this.newFileName.focus(); |
28 | this.newFileName.select(); | 29 | this.newFileName.select(); |
29 | } | 30 | } |
@@ -39,14 +40,16 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { | |||
39 | 40 | ||
40 | handleKeyup:{ | 41 | handleKeyup:{ |
41 | value:function(evt){ | 42 | value:function(evt){ |
42 | if(this.newFileName.value !== "") { | 43 | var newFileNameSetEvent = document.createEvent("Events"); |
43 | var newFileNameSetEvent = document.createEvent("Events"); | 44 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); |
44 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); | 45 | newFileNameSetEvent.newFileName = this.newFileName.value; |
45 | newFileNameSetEvent.newFileName = this.newFileName.value; | 46 | newFileNameSetEvent.keyCode = evt.keyCode; |
46 | newFileNameSetEvent.keyCode = evt.keyCode; | 47 | this.eventManager.dispatchEvent(newFileNameSetEvent); |
47 | this.eventManager.dispatchEvent(newFileNameSetEvent); | 48 | } |
48 | } | 49 | }, |
50 | handleSearch:{ | ||
51 | value:function(evt){ | ||
52 | this.handleKeyup(evt); | ||
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..35c3b28e 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, |
@@ -331,7 +331,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
331 | }else if(evt.keyCode === 27){ | 331 | }else if(evt.keyCode === 27){ |
332 | this.handleCancelButtonAction(evt); | 332 | this.handleCancelButtonAction(evt); |
333 | } | 333 | } |
334 | else if(!!evt._event.newFileDirectory){ | 334 | else{ |
335 | this.newFileDirectory = evt._event.newFileDirectory; | 335 | this.newFileDirectory = evt._event.newFileDirectory; |
336 | if(this.isValidUri(this.newFileDirectory)){ | 336 | if(this.isValidUri(this.newFileDirectory)){ |
337 | this.enableOk(); | 337 | this.enableOk(); |
@@ -347,7 +347,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
347 | }else if(evt.keyCode === 27){ | 347 | }else if(evt.keyCode === 27){ |
348 | this.handleCancelButtonAction(evt); | 348 | this.handleCancelButtonAction(evt); |
349 | } | 349 | } |
350 | else if(!!evt._event.newFileName){ | 350 | else{ |
351 | this.newFileName = evt._event.newFileName; | 351 | this.newFileName = evt._event.newFileName; |
352 | if(this.isValidFileName(this.newFileName)){ | 352 | if(this.isValidFileName(this.newFileName)){ |
353 | this.enableOk(); | 353 | this.enableOk(); |
@@ -422,14 +422,12 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
422 | isValidUri:{ | 422 | isValidUri:{ |
423 | value: function(uri){ | 423 | value: function(uri){ |
424 | var status= this.application.ninja.coreIoApi.isValidUri(uri); | 424 | var status= this.application.ninja.coreIoApi.isValidUri(uri); |
425 | if(uri !== ""){ | 425 | if((uri !== null) && !status){ |
426 | if(!status){ | ||
427 | this.showError("! Invalid directory."); | 426 | this.showError("! Invalid directory."); |
428 | //disable ok | 427 | //disable ok |
429 | if(!this.okButton.hasAttribute("disabled")){ | 428 | if(!this.okButton.hasAttribute("disabled")){ |
430 | this.okButton.setAttribute("disabled", "true"); | 429 | this.okButton.setAttribute("disabled", "true"); |
431 | } | 430 | } |
432 | } | ||
433 | } | 431 | } |
434 | return status; | 432 | return status; |
435 | } | 433 | } |
@@ -437,14 +435,12 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
437 | isValidFileName:{ | 435 | isValidFileName:{ |
438 | value: function(fileName){ | 436 | value: function(fileName){ |
439 | var status = this.validateFileName(fileName); | 437 | var status = this.validateFileName(fileName); |
440 | if(fileName !== ""){ | 438 | if((fileName !== null ) && !status){ |
441 | if(!status){ | ||
442 | this.showError("! Invalid file name."); | 439 | this.showError("! Invalid file name."); |
443 | //disable ok | 440 | //disable ok |
444 | if(!this.okButton.hasAttribute("disabled")){ | 441 | if(!this.okButton.hasAttribute("disabled")){ |
445 | this.okButton.setAttribute("disabled", "true"); | 442 | this.okButton.setAttribute("disabled", "true"); |
446 | } |