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.js31
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js118
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js14
4 files changed, 123 insertions, 49 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 0e1e09a4..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,19 +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.element.addEventListener("keyup", this, false);
27 this.newFileName.element.focus();
28 this.newFileName.element.select();
26 } 29 }
27 }, 30 },
28 31
29 handleKeyup:{ 32 handleKeyup:{
30 value:function(evt){ 33 value: function(evt){
31 if(this.newFileName.value !== "") { 34 if(evt.keyCode === 13){
32 var newFileNameSetEvent = document.createEvent("Events"); 35 var enterKeyupEvent = document.createEvent("Events");
33 newFileNameSetEvent.initEvent("newFileNameSet", false, false); 36 enterKeyupEvent.initEvent("enterKey", false, false);
34 newFileNameSetEvent.newFileName = this.newFileName.value; 37 this.eventManager.dispatchEvent(enterKeyupEvent);
35 this.eventManager.dispatchEvent(newFileNameSetEvent); 38 }else if(evt.keyCode === 27){
39 var escKeyupEvent = document.createEvent("Events");
40 escKeyupEvent.initEvent("escKey", false, false);
41 this.eventManager.dispatchEvent(escKeyupEvent);
36 } 42 }
37 } 43 }
38 } 44 },
39 45
46 newFileNameChange:{
47 value:function(evt){
48 var newFileNameSetEvent = document.createEvent("Events");
49 newFileNameSetEvent.initEvent("newFileNameSet", false, false);
50 newFileNameSetEvent.newFileName = this.newFileName.value;
51 newFileNameSetEvent.keyCode = evt.keyCode;
52 this.eventManager.dispatchEvent(newFileNameSetEvent);
53 }
54 }
40}); \ 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 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 }