diff options
author | Nivesh Rajbhandari | 2012-04-16 16:06:24 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-16 16:06:24 -0700 |
commit | c253192a08b499ea7be46fa5438d273e51f7ec5a (patch) | |
tree | 18a1f0e3679c0eb993a9dedb537035d3861f49ac /js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js | |
parent | e19376c54eedd1f1c457ba405b2f110be376a559 (diff) | |
parent | 4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff) | |
download | ninja-c253192a08b499ea7be46fa5438d273e51f7ec5a.tar.gz |
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
Diffstat (limited to 'js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js')
-rw-r--r-- | js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js | 118 |
1 files changed, 80 insertions, 38 deletions
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 aaf39005..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, |
@@ -98,14 +98,6 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
98 | 98 | ||
99 | this.addIdentifiers(); | 99 | this.addIdentifiers(); |
100 | 100 | ||
101 | this.element.addEventListener("drawTree", function(evt){that.handleNewFileNavDrawTree(evt);}, false); | ||
102 | this.element.addEventListener("selectedItem", function(evt){that.handleNewFileNavSelectedItem(evt);}, false);//for single selection only | ||
103 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){that.handleNewFileDirectorySet(evt);}, false); | ||
104 | this.eventManager.addEventListener("newFileNameSet", function(evt){that.handleNewFileNameSet(evt);}, false); | ||
105 | |||
106 | this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false); | ||
107 | this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false); | ||
108 | |||
109 | if(!!this.newFileModel.defaultProjectType){ | 101 | if(!!this.newFileModel.defaultProjectType){ |
110 | var templates = this.newFileModel.prepareContents(this.newFileModel.defaultProjectType); | 102 | var templates = this.newFileModel.prepareContents(this.newFileModel.defaultProjectType); |
111 | this.templateList = iconsListModule.IconsList.create(); | 103 | this.templateList = iconsListModule.IconsList.create(); |
@@ -116,7 +108,6 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
116 | this.templateList.element = this.templateIcons; | 108 | this.templateList.element = this.templateIcons; |
117 | this.templateList.needsDraw = true; | 109 | this.templateList.needsDraw = true; |
118 | 110 | ||
119 | |||
120 | this.selectedProjectType = {"uri":this.newFileModel.defaultProjectType, "element":null}; | 111 | this.selectedProjectType = {"uri":this.newFileModel.defaultProjectType, "element":null}; |
121 | } | 112 | } |
122 | 113 | ||
@@ -127,6 +118,36 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
127 | fileExtensionEl.innerHTML = ""+this.newFileModel.projectTypeData[this.newFileModel.defaultProjectType].fileExtension; | 118 | fileExtensionEl.innerHTML = ""+this.newFileModel.projectTypeData[this.newFileModel.defaultProjectType].fileExtension; |
128 | } | 119 | } |
129 | } | 120 | } |
121 | |||
122 | this.element.addEventListener("drawTree", function(evt){that.handleNewFileNavDrawTree(evt);}, false); | ||
123 | this.element.addEventListener("selectedItem", function(evt){that.handleNewFileNavSelectedItem(evt);}, false);//for single selection only | ||
124 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){ | ||
125 | that.handleNewFileDirectorySet(evt); | ||
126 | }, false); | ||
127 | this.eventManager.addEventListener("newFileNameSet", function(evt){ | ||
128 | that.handleNewFileNameSet(evt); | ||
129 | }, false); | ||
130 | |||
131 | this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false); | ||
132 | this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false); | ||
133 | |||
134 | this.element.addEventListener("keyup", function(evt){ | ||
135 | if(evt.keyCode == 27) {//ESC key | ||
136 | if(that.application.ninja.newFileController.newFileOptionsNav !== null){ | ||
137 | that.handleCancelButtonAction(); | ||
138 | } | ||
139 | }else if((evt.keyCode == 13) && !(evt.ctrlKey || evt.metaKey)){//ENTER key | ||
140 | if((that.application.ninja.newFileController.newFileOptionsNav !== null) | ||
141 | && !that.okButton.hasAttribute("disabled")){ | ||
142 | |||
143 | that.handleOkButtonAction(); | ||
144 | } | ||
145 | } | ||
146 | }, true); | ||
147 | |||
148 | this.eventManager.addEventListener("enterKey", this, false); | ||
149 | this.eventManager.addEventListener("escKey", this, false); | ||
150 | |||
130 | } | 151 | } |
131 | 152 | ||
132 | }, | 153 | }, |
@@ -291,10 +312,16 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
291 | }else{ | 312 | }else{ |
292 | if(this.error.innerHTML === ""){ | 313 | if(this.error.innerHTML === ""){ |
293 | this.showError("! Project Template, Name and Directory should be valid."); | 314 | this.showError("! Project Template, Name and Directory should be valid."); |
294 | } | 315 | //disable ok |
295 | //disable ok | 316 | if(!this.okButton.hasAttribute("disabled")){ |
296 | if(!this.okButton.hasAttribute("disabled")){ | 317 | this.okButton.setAttribute("disabled", "true"); |
297 | this.okButton.setAttribute("disabled", "true"); | 318 | } |
319 | }else if(!this.selectedProjectType || !this.selectedTemplate){ | ||
320 | this.showError("! Project Template should be selected."); | ||
321 | //disable ok | ||
322 | if(!this.okButton.hasAttribute("disabled")){ | ||
323 | this.okButton.setAttribute("disabled", "true"); | ||
324 | } | ||
298 | } | 325 | } |
299 | } | 326 | } |
300 | } | 327 | } |
@@ -302,22 +329,36 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
302 | 329 | ||
303 | handleNewFileDirectorySet:{ | 330 | handleNewFileDirectorySet:{ |
304 | value:function(evt){ | 331 | value:function(evt){ |
305 | if(!!evt._event.newFileDirectory){ | 332 | this.newFileDirectory = evt._event.newFileDirectory; |
306 | this.newFileDirectory = evt._event.newFileDirectory; | 333 | if(this.isValidUri(this.newFileDirectory)){ |
307 | if(this.isValidUri(this.newFileDirectory)){ | 334 | this.enableOk(); |
308 | this.enableOk(); | ||
309 | } | ||
310 | } | 335 | } |
311 | } | 336 | } |
312 | }, | 337 | }, |
313 | 338 | ||
314 | handleNewFileNameSet:{ | 339 | handleNewFileNameSet:{ |
315 | value:function(evt){ | 340 | value:function(evt){ |
316 | if(!!evt._event.newFileName){ | 341 | this.newFileName = evt._event.newFileName; |
317 | this.newFileName = evt._event.newFileName; | 342 | if(this.isValidFileName(this.newFileName)){ |
318 | if(this.isValidFileName(this.newFileName)){ | 343 | this.enableOk(); |
319 | this.enableOk(); | 344 | } |
320 | } | 345 | } |
346 | }, | ||
347 | |||
348 | handleEnterKey:{ | ||
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); | ||
321 | } | 362 | } |
322 | } | 363 | } |
323 | }, | 364 | }, |
@@ -374,24 +415,26 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
374 | 415 | ||
375 | this.newFileName = ""; | 416 | this.newFileName = ""; |
376 | this.newFileDirectory = ""; | 417 | this.newFileDirectory = ""; |
377 | this.selectedProjectType = null; | ||
378 | this.selectedTemplate = null; | ||
379 | 418 | ||
380 | //remove event listeners | 419 | //remove event listeners |
381 | this.element.removeEventListener("drawTree", function(evt){that.handleNewFileNavDrawTree(evt);}, false); | 420 | this.element.removeEventListener("drawTree", function(evt){that.handleNewFileNavDrawTree(evt);}, false); |
382 | this.element.removeEventListener("selectedItem", function(evt){that.handleNewFileNavSelectedItem(evt);}, false);//for single selection only | 421 | this.element.removeEventListener("selectedItem", function(evt){that.handleNewFileNavSelectedItem(evt);}, false);//for single selection only |
383 | this.eventManager.removeEventListener("newFileDirectorySet", function(evt){that.handleNewFileDirectorySet(evt);}, false); | 422 | this.eventManager.removeEventListener("newFileDirectorySet", function(evt){that.handleNewFileDirectorySet(evt);}, false); |
384 |