diff options
author | hwc487 | 2012-04-13 11:52:13 -0700 |
---|---|---|
committer | hwc487 | 2012-04-13 11:52:13 -0700 |
commit | 4f2fb5764703cab4ce3ada719b1395ed1e2f3b7c (patch) | |
tree | 3dc2e3c5a041179eed38eab1a00f851554e50005 /js/io/ui/save-as-dialog.reel | |
parent | 521df0ed9242efff45715998837068c87aca7efd (diff) | |
parent | 4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff) | |
download | ninja-4f2fb5764703cab4ce3ada719b1395ed1e2f3b7c.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Snapping_II
Conflicts:
js/helper-classes/3D/view-utils.js
js/panels/presets/animations-presets.reel/animations-presets.js
js/panels/presets/style-presets.reel/style-presets.js
js/panels/presets/transitions-presets.reel/transitions-presets.js
js/tools/Translate3DToolBase.js
Diffstat (limited to 'js/io/ui/save-as-dialog.reel')
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.html | 9 | ||||
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.js | 80 |
2 files changed, 52 insertions, 37 deletions
diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.html b/js/io/ui/save-as-dialog.reel/save-as-dialog.html index 374e3d48..453d7a96 100644 --- a/js/io/ui/save-as-dialog.reel/save-as-dialog.html +++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.html | |||
@@ -18,13 +18,20 @@ | |||
18 | } | 18 | } |
19 | }, | 19 | }, |
20 | 20 | ||
21 | "newFileName": { | ||
22 | "prototype": "montage/ui/textfield.reel", | ||
23 | "properties": { | ||
24 | "element": {"#": "newFileName"} | ||
25 | } | ||
26 | }, | ||
27 | |||
21 | "owner":{ | 28 | "owner":{ |
22 | "module": "js/io/ui/new-file-dialog/new-file-location.reel", | 29 | "module": "js/io/ui/new-file-dialog/new-file-location.reel", |
23 | "name": "SaveAsDialog", | 30 | "name": "SaveAsDialog", |
24 | "properties": { | 31 | "properties": { |
25 | "element": {"#": "saveAsDialog"}, | 32 | "element": {"#": "saveAsDialog"}, |
26 | "fileInputField": {"@": "fileInputField"}, | 33 | "fileInputField": {"@": "fileInputField"}, |
27 | "newFileName": {"#": "newFileName"}, | 34 | "newFileName": {"@": "newFileName"}, |
28 | "error":{"#": "error"}, | 35 | "error":{"#": "error"}, |
29 | "okButton":{"#": "okButton"}, | 36 | "okButton":{"#": "okButton"}, |
30 | "cancelButton":{"#": "cancelButton"} | 37 | "cancelButton":{"#": "cancelButton"} |
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 81d1afee..e2f50ff5 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 | |||
@@ -36,7 +36,12 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
36 | writable: true, | 36 | writable: true, |
37 | value: null | 37 | value: null |
38 | }, | 38 | }, |
39 | 39 | prepareForDraw: { | |
40 | value: function() { | ||
41 | this.newFileName.value = this.fileName; | ||
42 | this.fileInputField.newFileDirectory.value = this.folderUri; | ||
43 | } | ||
44 | }, | ||
40 | willDraw: { | 45 | willDraw: { |
41 | enumerable: false, | 46 | enumerable: false, |
42 | value: function() {} | 47 | value: function() {} |
@@ -51,19 +56,16 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
51 | var self = this; | 56 | var self = this; |
52 | this.fileInputField.selectDirectory = true; | 57 | this.fileInputField.selectDirectory = true; |
53 | this.fileInputField.pickerName = "saveAsDirectoryPicker"; | 58 | this.fileInputField.pickerName = "saveAsDirectoryPicker"; |
54 | this.newFileName.value = this.fileName; | ||
55 | this.fileInputField.newFileDirectory.value = this.folderUri; | ||
56 | 59 | ||
57 | this.newFileName.addEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false); | 60 | this.addEventListener("change@newFileName.value", this.handleNewFileNameChange, false); |
58 | this.newFileName.addEventListener("paste", this, false); | 61 | this.newFileName.element.addEventListener("keyup", this, false); |
59 | this.newFileName.addEventListener("search", this, false); | ||
60 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); | 62 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); |
61 | |||
62 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); | 63 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); |
63 | this.cancelButton.addEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); | 64 | this.cancelButton.addEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); |
64 | 65 | ||
65 | this.newFileName.focus(); | 66 | this.eventManager.addEventListener("enterKey", this, false); |
66 | this.newFileName.select(); | 67 | this.eventManager.addEventListener("escKey", this, false); |
68 | |||
67 | 69 | ||
68 | this.enableOk(); | 70 | this.enableOk(); |
69 | 71 | ||
@@ -81,52 +83,57 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
81 | } | 83 | } |
82 | }, true); | 84 | }, true); |
83 | 85 | ||
86 | this.newFileName.element.focus(); | ||
87 | this.newFileName.element.select(); | ||
88 | |||
84 | } | 89 | } |
85 | }, | 90 | }, |
86 | 91 | ||
87 | handleNewFileDirectorySet:{ | 92 | handleNewFileDirectorySet:{ |
88 | value:function(evt){ | 93 | value:function(evt){ |
89 | if(evt.keyCode === 13){ | 94 | this.folderUri = evt._event.newFileDirectory; |
90 | if(!this.okButton.hasAttribute("disabled")) this.handleOkButtonAction(evt); | 95 | if(this.isValidUri(this.folderUri)){ |
91 | }else if(evt.keyCode === 27){ | 96 | this.enableOk(); |
92 | this.handleCancelButtonAction(evt); | ||
93 | } | ||
94 | else{ | ||
95 | this.folderUri = evt._event.newFileDirectory; | ||
96 | if(this.isValidUri(this.folderUri)){ | ||
97 | this.enableOk(); | ||
98 | } | ||
99 | } | 97 | } |
100 | } | 98 | } |
101 | }, | 99 | }, |
102 | 100 | ||
103 | handlePaste:{ | 101 | handleNewFileNameChange:{ |
104 | value:function(evt){ | ||
105 | evt.preventDefault(); | ||
106 | evt.target.value = evt.clipboardData.getData("Text"); | ||
107 | this.handleNewFileNameOnkeyup(evt); | ||
108 | } | ||
109 | }, | ||
110 | |||
111 | handleNewFileNameOnkeyup:{ | ||
112 | value:function(evt){ | 102 | value:function(evt){ |
113 | this.fileName = this.newFileName.value; | 103 | this.fileName = this.newFileName.value; |
114 | if(this.isValidFileName(this.fileName)){ | 104 | if(this.isValidFileName(this.fileName)){ |
115 | this.enableOk(); | 105 | this.enableOk(); |
116 | } | 106 | } |
117 | if(evt.keyCode === 13){ | 107 | } |
118 | if(!this.okButton.hasAttribute("disabled")){ | 108 | }, |
109 | |||
110 | handleKeyup:{ | ||
111 | value: function(evt){ | ||
112 | if(evt.keyCode === 13){ | ||
113 | if(!this.okButton.hasAttribute("disabled")){ | ||
119 | this.handleOkButtonAction(evt); | 114 | this.handleOkButtonAction(evt); |
120 | } | 115 | } |
121 | }else if(evt.keyCode === 27){ | 116 | }else if(evt.keyCode === 27){ |
122 | this.handleCancelButtonAction(evt); | 117 | this.handleCancelButtonAction(evt); |
118 | } | ||
119 | } | ||
120 | }, | ||
121 | |||
122 | handleEnterKey:{ | ||
123 | value: function(evt){ | ||
124 | if((this.application.ninja.newFileController.saveAsDialog !== null) | ||
125 | && !this.okButton.hasAttribute("disabled")){ | ||
126 | |||
127 | this.handleOkButtonAction(evt); | ||
123 | } | 128 | } |
124 | } | 129 | } |
125 | }, | 130 | }, |
126 | 131 | ||
127 | handleSearch:{ | 132 | handleEscKey:{ |
128 | value:function(evt){ | 133 | value: function(evt){ |
129 | this.handleNewFileNameOnkeyup(evt); | 134 | if(this.application.ninja.newFileController.saveAsDialog !== null){ |
135 | this.handleCancelButtonAction(evt); | ||
136 | } | ||
130 | } | 137 | } |
131 | }, | 138 | }, |
132 | 139 | ||
@@ -259,6 +266,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
259 | var status = false; | 266 | var status = false; |
260 | if((fileName !== null) && (fileName !== "")){ | 267 | if((fileName !== null) && (fileName !== "")){ |
261 | fileName = fileName.replace(/^\s+|\s+$/g,""); | 268 | fileName = fileName.replace(/^\s+|\s+$/g,""); |
269 | if(fileName === ""){return false;} | ||
262 | status = !(/[/\\]/g.test(fileName)); | 270 | status = !(/[/\\]/g.test(fileName)); |
263 | if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden | 271 | if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden |
264 | status = !(/^\./g.test(fileName)); | 272 | status = !(/^\./g.test(fileName)); |