diff options
Diffstat (limited to 'js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js')
-rw-r--r-- | js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js | 160 |
1 files changed, 0 insertions, 160 deletions
diff --git a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js deleted file mode 100644 index 86c2c86b..00000000 --- a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js +++ /dev/null | |||
@@ -1,160 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component, | ||
9 | iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"), | ||
10 | treeModule = require("js/components/ui/tree-basic/tree.reel"), | ||
11 | newFileLocationSelectionModule = require("js/io/workflow/newFileDialog/new-file-workflow-controller"); | ||
12 | newFileWorkflowControllerModule = require("js/io/workflow/newFileDialog/new-file-location.reel"); | ||
13 | |||
14 | var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(Component, { | ||
15 | |||
16 | newFileModel: { | ||
17 | writable: true, | ||
18 | enumerable:false, | ||
19 | value:null | ||
20 | }, | ||
21 | selectedProjectType:{ | ||
22 | writable: true, | ||
23 | enumerable:false, | ||
24 | value:null | ||
25 | }, | ||
26 | selectedTemplates:{ | ||
27 | writable: true, | ||
28 | enumerable:false, | ||
29 | value:[] | ||
30 | }, | ||
31 | willDraw: { | ||
32 | enumerable: false, | ||
33 | value: function() {} | ||
34 | }, | ||
35 | draw: { | ||
36 | enumerable: false, | ||
37 | value: function() {} | ||
38 | }, | ||
39 | didDraw: { | ||
40 | enumerable: false, | ||
41 | value: function() { | ||
42 | var that = this; | ||
43 | |||
44 | this.templateList = null; | ||
45 | |||
46 | //draw left nav project type tree | ||
47 | var tree = treeModule.Tree.create(); | ||
48 | tree.showIcons = false; | ||
49 | tree.directoryBold = true; | ||
50 | tree.treeViewDataObject = this.newFileModel.prepareContents("projectTypes"); | ||
51 | tree.element = this.projectTypeTree; | ||
52 | tree.needsDraw = true; | ||
53 | |||
54 | var newFileLocation = newFileWorkflowControllerModule.NewFileLocation.create(); | ||
55 | newFileLocation.element = this.locationSelection; | ||
56 | newFileLocation.needsDraw = true; | ||
57 | |||
58 | this.addIdentifiers(); | ||
59 | |||
60 | this.element.addEventListener("drawTree", function(evt){that.handleNewFileNavDrawTree(evt);}, false); | ||
61 | this.element.addEventListener("selectedItem", function(evt){that.handleNewFileNavSelectedItem(evt);}, false);//for single selection only | ||
62 | this.cancelButton.addEventListener("click", this, false); | ||
63 | } | ||
64 | |||
65 | }, | ||
66 | |||
67 | /** | ||
68 | * Event Listners | ||
69 | */ | ||
70 | |||
71 | addIdentifiers:{ | ||
72 | value: function(){ | ||
73 | this.element.identifier = "newFileNav"; | ||
74 | this.okButton.identifier = "okButton"; | ||
75 | this.cancelButton.identifier = "cancelButton"; | ||
76 | } | ||
77 | }, | ||
78 | |||
79 | handleNewFileNavDrawTree:{ | ||
80 | value: function(evt){ | ||
81 | //toggle open or close for directory | ||
82 | if((evt.uriType === "directory") && (!!evt.subTreeContainer)){ | ||
83 | var tree = treeModule.Tree.create(); | ||
84 | tree.showIcons = false; | ||
85 | tree.treeViewDataObject = this.newFileModel.prepareContents(evt.uri); | ||
86 | tree.element = evt.subTreeContainer; | ||
87 | tree.needsDraw = true; | ||
88 | } | ||
89 | } | ||
90 | }, | ||
91 | |||
92 | handleNewFileNavSelectedItem:{ | ||
93 | value: function(evt){ | ||
94 | var selectionType = this.newFileModel.projectTypeData[evt.uri].type; | ||
95 | if(evt.target.classList.contains("atreeItemContent") && (selectionType === "file")){//populate templates for project type selection | ||
96 | //save project type selection | ||
97 | this.selectedProjectType = evt.uri; | ||
98 | |||
99 | //render templates | ||
100 | var templates = this.newFileModel.prepareContents(evt.uri); | ||
101 | if(this.templatesContainer.querySelectorAll(".list").length > 0){ | ||
102 | this.templateList.iconsViewDataObject = templates; | ||
103 | }else{ | ||
104 | this.templateList = iconsListModule.IconsList.create(); | ||
105 | this.templateList.iconsViewDataObject = templates; | ||
106 | this.templateList.element = this.templateIcons; | ||
107 | this.templateList.needsDraw = true; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | if(evt.target.classList.contains("icon")){ | ||
112 | //save template selection | ||
113 | this.selectedTemplates.push[evt.uri];//todo: check for duplicates | ||
114 | |||
115 | } | ||
116 | |||
117 | // if(!evt.target.classList.contains("selected")){ | ||
118 | // evt.target.classList.add("selected"); | ||
119 | // } | ||
120 | |||
121 | //enable ok | ||
122 | } | ||
123 | }, | ||
124 | |||
125 | handleCancelButtonClick :{ | ||
126 | value:function(evt){ | ||
127 | //clean up memory | ||
128 | //this.cleanup(); | ||
129 | |||
130 | if(this.popup){ | ||
131 | this.popup.hide(); | ||
132 | } | ||
133 | |||
134 | } | ||
135 | }, | ||
136 | |||
137 | |||
138 | |||
139 | |||
140 | dummyProjectTypes:{ | ||
141 | writable:false, | ||
142 | enumerable:false, | ||
143 | value:[{ | ||
144 | "type":"directory", | ||
145 | "name":"Blank Document", | ||
146 | "uri":"newFile" | ||
147 | }, | ||
148 | { | ||
149 | "type":"directory", | ||
150 | "name":"New Project", | ||
151 | "uri":"newProject" | ||
152 | }, | ||
153 | { | ||
154 | "type":"directory", | ||
155 | "name":"From Template", | ||
156 | "uri":"fromTemplate" | ||
157 | }] | ||
158 | } | ||
159 | |||
160 | }); \ No newline at end of file | ||