diff options
author | hwc487 | 2012-04-19 13:01:43 -0700 |
---|---|---|
committer | hwc487 | 2012-04-19 13:01:43 -0700 |
commit | e6a20fe64574763483dc602bd759278ccf5e5e68 (patch) | |
tree | 69defe7200206f0257fe90697136fadef59d521e /js/io/ui/save-as-dialog.reel | |
parent | ae7eb87564632ce7c676bd728b8ff2710ff0bb83 (diff) | |
parent | 9284c19f076dec3b47ece7dc7bcd22d74e4246c3 (diff) | |
download | ninja-e6a20fe64574763483dc602bd759278ccf5e5e68.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts:
js/lib/drawing/world.js
js/lib/geom/geom-obj.js
js/lib/rdge/materials/cloud-material.js
js/lib/rdge/materials/deform-material.js
js/lib/rdge/materials/flat-material.js
js/lib/rdge/materials/material.js
js/lib/rdge/materials/pulse-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
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 | 111 |
2 files changed, 94 insertions, 26 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 c60a92f9..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 | |||
@@ -16,13 +16,13 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
16 | fileName : { | 16 | fileName : { |
17 | enumerable: true, | 17 | enumerable: true, |
18 | writable: true, | 18 | writable: true, |
19 | value: "" | 19 | value: null |
20 | }, | 20 | }, |
21 | 21 | ||
22 | folderUri:{ | 22 | folderUri:{ |
23 | enumerable: true, | 23 | enumerable: true, |
24 | writable: true, | 24 | writable: true, |
25 | value: "" | 25 | value: null |
26 | }, | 26 | }, |
27 | 27 | ||
28 | callback : { | 28 | callback : { |
@@ -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,41 +56,86 @@ 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); |
61 | this.newFileName.element.addEventListener("keyup", this, false); | ||
58 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); | 62 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); |
59 | |||
60 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); | 63 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); |
61 | this.cancelButton.addEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); | 64 | this.cancelButton.addEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); |
62 | 65 | ||
66 | this.eventManager.addEventListener("enterKey", this, false); | ||
67 | this.eventManager.addEventListener("escKey", this, false); | ||
68 | |||
69 | |||
63 | this.enableOk(); | 70 | this.enableOk(); |
71 | |||
72 | this.element.addEventListener("keyup", function(evt){ | ||
73 | if(evt.keyCode == 27) {//ESC key | ||
74 | if(self.application.ninja.newFileController.saveAsDialog !== null){ | ||
75 | self.handleCancelButtonAction(); | ||
76 | } | ||
77 | }else if((evt.keyCode == 13) && !(evt.ctrlKey || evt.metaKey)){//ENTER key | ||
78 | if((self.application.ninja.newFileController.saveAsDialog !== null) | ||
79 | && !self.okButton.hasAttribute("disabled")){ | ||
80 | |||
81 | self.handleOkButtonAction(); | ||
82 | } | ||
83 | } | ||
84 | }, true); | ||
85 | |||
86 | this.newFileName.element.focus(); | ||
87 | this.newFileName.element.select(); | ||
88 | |||
64 | } | 89 | } |
65 | }, | 90 | }, |
66 | 91 | ||
67 | handleNewFileDirectorySet:{ | 92 | handleNewFileDirectorySet:{ |
68 | value:function(evt){ | 93 | value:function(evt){ |
69 | if(!!evt._event.newFileDirectory){ | 94 | this.folderUri = evt._event.newFileDirectory; |
70 | this.folderUri = evt._event.newFileDirectory; | 95 | if(this.isValidUri(this.folderUri)){ |
71 | if(this.isValidUri(this.folderUri)){ | 96 | this.enableOk(); |
72 | this.enableOk(); | ||
73 | } | ||
74 | } | 97 | } |
75 | } | 98 | } |
76 | }, | 99 | }, |
77 | 100 | ||
78 | handleNewFileNameOnkeyup:{ | 101 | handleNewFileNameChange:{ |
79 | value:function(evt){ | 102 | value:function(evt){ |
80 | this.fileName = this.newFileName.value; | 103 | this.fileName = this.newFileName.value; |
81 | if(this.fileName !== ""){ | 104 | if(this.isValidFileName(this.fileName)){ |
82 | if(this.isValidFileName(this.fileName)){ | ||
83 | this.enableOk(); | 105 | this.enableOk(); |
84 | } | ||
85 | } | 106 | } |
86 | } | 107 | } |
87 | }, | 108 | }, |
88 | 109 | ||
110 | handleKeyup:{ | ||
111 | value: function(evt){ | ||
112 | if(evt.keyCode === 13){ | ||
113 | if(!this.okButton.hasAttribute("disabled")){ | ||
114 | this.handleOkButtonAction(evt); | ||
115 | } | ||
116 | }else if(evt.keyCode === 27){ | ||
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); | ||
128 | } | ||
129 | } | ||
130 | }, | ||
131 | |||
132 | handleEscKey:{ | ||
133 | value: function(evt){ | ||
134 | if(this.application.ninja.newFileController.saveAsDialog !== null){ | ||
135 | this.handleCancelButtonAction(evt); | ||
136 | } | ||
137 | } | ||
138 | }, | ||
89 | 139 | ||
90 | enableOk:{ | 140 | enableOk:{ |
91 | value: function(){ | 141 | value: function(){ |
@@ -99,7 +149,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
99 | handleCancelButtonAction :{ | 149 | handleCancelButtonAction :{ |
100 | value:function(evt){ | 150 | value:function(evt){ |
101 | //clean up memory | 151 | //clean up memory |
102 | //this.cleanup(); | 152 | this.cleanup(); |
103 | 153 | ||
104 | if(this.popup){ | 154 | if(this.popup){ |
105 | this.popup.hide(); | 155 | this.popup.hide(); |
@@ -134,7 +184,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
134 | 184 | ||
135 | if(success){ | 185 | if(success){ |
136 | //clean up memory | 186 | //clean up memory |
137 | //this.cleanup(); | 187 | this.cleanup(); |
138 | 188 | ||
139 | if(this.popup){ | 189 | if(this.popup){ |
140 | this.popup.hide(); | 190 | this.popup.hide(); |
@@ -155,10 +205,8 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
155 | isValidUri:{ | 205 | isValidUri:{ |
156 | value: function(uri){ | 206 | value: function(uri){ |
157 | var status= this.application.ninja.coreIoApi.isValidUri(uri); | 207 | var status= this.application.ninja.coreIoApi.isValidUri(uri); |
158 | if(uri !== ""){ | 208 | if((uri !== null) && !status){ |
159 | if(!status){ | ||
160 | this.showError("! Invalid directory."); | 209 | this.showError("! Invalid directory."); |
161 | } | ||