1 |
|
package org.kuali.student.lum.lu.ui.main.client.controllers; |
2 |
|
|
3 |
|
import java.util.Map; |
4 |
|
|
5 |
|
import org.kuali.student.common.ui.client.application.Application; |
6 |
|
import org.kuali.student.common.ui.client.application.ViewContext; |
7 |
|
import org.kuali.student.common.ui.client.configurable.mvc.LayoutController; |
8 |
|
import org.kuali.student.common.ui.client.mvc.Callback; |
9 |
|
import org.kuali.student.common.ui.client.mvc.Controller; |
10 |
|
import org.kuali.student.common.ui.client.mvc.View; |
11 |
|
import org.kuali.student.common.ui.client.util.WindowTitleUtils; |
12 |
|
import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel; |
13 |
|
import org.kuali.student.common.ui.shared.IdAttributes.IdType; |
14 |
|
import org.kuali.student.lum.common.client.configuration.LUMViews; |
15 |
|
import org.kuali.student.lum.common.client.widgets.AppLocations; |
16 |
|
import org.kuali.student.lum.lu.ui.browseprogram.client.controllers.BrowseProgramController; |
17 |
|
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminController; |
18 |
|
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminRetireController; |
19 |
|
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminWithoutVersionController; |
20 |
|
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController; |
21 |
|
import org.kuali.student.lum.lu.ui.course.client.controllers.ViewCourseParentController; |
22 |
|
import org.kuali.student.lum.lu.ui.course.client.views.CategoryManagementView; |
23 |
|
import org.kuali.student.lum.lu.ui.course.client.views.CurriculumHomeView; |
24 |
|
import org.kuali.student.lum.lu.ui.dependency.client.controllers.DependencyAnalysisController; |
25 |
|
import org.kuali.student.lum.lu.ui.tools.client.configuration.CatalogBrowserController; |
26 |
|
import org.kuali.student.lum.lu.ui.tools.client.configuration.CluSetsManagementController; |
27 |
|
import org.kuali.student.lum.program.client.ProgramConstants; |
28 |
|
import org.kuali.student.lum.program.client.ProgramRegistry; |
29 |
|
import org.kuali.student.lum.program.client.core.CoreManager; |
30 |
|
import org.kuali.student.lum.program.client.credential.CredentialManager; |
31 |
|
import org.kuali.student.lum.program.client.major.MajorManager; |
32 |
|
|
33 |
|
import com.google.gwt.core.client.RunAsyncCallback; |
34 |
|
import com.google.gwt.user.client.Window; |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
@author |
60 |
|
@see |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 186 (186) |
Complexity: 56 |
Complexity Density: 0.38 |
|
62 |
|
public class CurriculumHomeController extends LayoutController { |
63 |
|
|
64 |
|
private CurriculumHomeView home; |
65 |
|
private final SpanPanel panel = new SpanPanel(); |
66 |
|
|
67 |
|
private CourseProposalController courseProposalController; |
68 |
|
private CourseAdminController courseAdminController; |
69 |
|
private CourseAdminWithoutVersionController courseAdminWithoutVersionController; |
70 |
|
private CourseAdminRetireController courseAdminRetireController; |
71 |
|
private LayoutController viewCourseController; |
72 |
|
private LayoutController manageCluSetsController; |
73 |
|
private LayoutController browseCatalogController; |
74 |
|
private LayoutController dependencyAnalysisController; |
75 |
|
private LayoutController browseProgramController; |
76 |
|
private MajorManager majorManager = new MajorManager(); |
77 |
|
private CredentialManager credentialManager = new CredentialManager(); |
78 |
|
private CoreManager coreManager = new CoreManager(); |
79 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
|
private abstract class RunAsyncGetView implements RunAsyncCallback { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0
|
public void onFailure(Throwable reason) {... |
82 |
0
|
Window.alert("Download failed. Please try again."); |
83 |
|
} |
84 |
|
} |
85 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
86 |
0
|
public CurriculumHomeController(Controller controller, String name, Enum<?> viewType) {... |
87 |
0
|
super(); |
88 |
0
|
super.setController(controller); |
89 |
0
|
super.setName(name); |
90 |
0
|
super.setViewEnum(viewType); |
91 |
0
|
this.setDefaultView(LUMViews.DEFAULT); |
92 |
0
|
this.initWidget(panel); |
93 |
0
|
setupDefaultView(); |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0
|
private void setupDefaultView() {... |
97 |
0
|
home = new CurriculumHomeView(this, LUMViews.DEFAULT); |
98 |
|
} |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 130 (130) |
Complexity: 37 |
Complexity Density: 0.33 |
|
100 |
0
|
@Override... |
101 |
|
public <V extends Enum<?>> void getView(V viewType, final Callback<View> callback, Map<String, String> tokenMap) { |
102 |
|
|
103 |
|
|
104 |
0
|
switch ((LUMViews) viewType) { |
105 |
0
|
case DEFAULT: |
106 |
0
|
callback.exec(home); |
107 |
0
|
break; |
108 |
0
|
case COURSE_PROPOSAL: |
109 |
|
|
110 |
|
|
111 |
|
|
112 |
0
|
callback.exec(getCourseProposalController()); |
113 |
|
|
114 |
|
|
115 |
0
|
break; |
116 |
0
|
case COURSE_ADMIN: |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
0
|
callback.exec(getCourseAdminController()); |
121 |
|
|
122 |
|
|
123 |
0
|
break; |
124 |
0
|
case COURSE_ADMIN_NO_VERSION: |
125 |
|
|
126 |
|
|
127 |
|
|
128 |
0
|
callback.exec(getCourseAdminWithoutVersionController()); |
129 |
|
|
130 |
|
|
131 |
0
|
break; |
132 |
0
|
case COURSE_ADMIN_RETIRE: |
133 |
|
|
134 |
|
|
135 |
|
|
136 |
0
|
callback.exec(getCourseAdminRetireController()); |
137 |
|
|
138 |
|
|
139 |
0
|
break; |
140 |
|
|
141 |
0
|
case VIEW_COURSE: |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
0
|
callback.exec(getViewCourseController()); |
146 |
|
|
147 |
|
|
148 |
0
|
break; |
149 |
0
|
case PROGRAM_PROPOSAL: |
150 |
|
|
151 |
|
|
152 |
|
|
153 |
0
|
if (ProgramRegistry.isCreateNew()) { |
154 |
0
|
ProgramRegistry.setCreateNew(false); |
155 |
0
|
majorManager = new MajorManager(); |
156 |
|
} |
157 |
0
|
callback.exec(majorManager.getMajorProposalController()); |
158 |
|
|
159 |
|
|
160 |
0
|
break; |
161 |
0
|
case PROGRAM_VIEW: |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
0
|
if (ProgramRegistry.isCreateNew()) { |
166 |
0
|
ProgramRegistry.setCreateNew(false); |
167 |
0
|
majorManager = new MajorManager(); |
168 |
|
} |
169 |
0
|
callback.exec(majorManager.getProgramViewController()); |
170 |
|
|
171 |
|
|
172 |
0
|
break; |
173 |
0
|
case PROGRAM_EDIT: |
174 |
|
|
175 |
|
|
176 |
|
|
177 |
0
|
Application.getApplicationContext().setParentPath(""); |
178 |
0
|
if (ProgramRegistry.isCreateNew()) { |
179 |
0
|
ProgramRegistry.setCreateNew(false); |
180 |
0
|
majorManager = new MajorManager(); |
181 |
|
} |
182 |
0
|
callback.exec(majorManager.getProgramEditController()); |
183 |
|
|
184 |
|
|
185 |
0
|
break; |
186 |
0
|
case PROGRAM_SPEC_EDIT: |
187 |
|
|
188 |
|
|
189 |
|
|
190 |
0
|
if (ProgramRegistry.isCreateNew()) { |
191 |
0
|
ProgramRegistry.setCreateNew(false); |
192 |
0
|
majorManager = new MajorManager(); |
193 |
|
} |
194 |
0
|
callback.exec(majorManager.getProgramSpecEditController()); |
195 |
|
|
196 |
|
|
197 |
0
|
break; |
198 |
0
|
case PROGRAM_CREATE: |
199 |
|
|
200 |
|
|
201 |
|
|
202 |
0
|
majorManager = new MajorManager(); |
203 |
0
|
callback.exec(majorManager.getProgramEditController()); |
204 |
|
|
205 |
|
|
206 |
0
|
break; |
207 |
0
|
case PROGRAM_VERSIONS: |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
0
|
callback.exec(majorManager.getProgramVersionsController()); |
212 |
|
|
213 |
|
|
214 |
0
|
break; |
215 |
0
|
case CLU_SETS: |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
0
|
callback.exec(getCluSetsController()); |
220 |
|
|
221 |
|
|
222 |
0
|
break; |
223 |
0
|
case COURSE_CATALOG: |
224 |
|
|
225 |
|
|
226 |
|
|
227 |
0
|
callback.exec(getBrowseCatalogController()); |
228 |
|
|
229 |
|
|
230 |
0
|
break; |
231 |
0
|
case VARIATION_VIEW: |
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
0
|
if(majorManager.getProgramModel()!=null && majorManager.getProgramModel().getDefinition()!=null){ |
237 |
0
|
callback.exec(majorManager.getVariationViewController()); |
238 |
|
}else{ |
239 |
|
|
240 |
|
|
241 |
|
|
242 |
0
|
ViewContext viewContext = new ViewContext(); |
243 |
0
|
viewContext.setId(tokenMap.get("docId")); |
244 |
0
|
viewContext.setAttribute(ProgramConstants.VARIATION_ID, tokenMap.get(ProgramConstants.VARIATION_ID)); |
245 |
0
|
viewContext.setAttribute(ProgramConstants.TYPE, ProgramConstants.VARIATION_TYPE_KEY); |
246 |
0
|
viewContext.setIdType(IdType.OBJECT_ID); |
247 |
0
|
ProgramRegistry.setCreateNew(true); |
248 |
0
|
Application.navigate(AppLocations.Locations.VIEW_PROGRAM.getLocation(), viewContext); |
249 |
|
} |
250 |
|
|
251 |
|
|
252 |
0
|
break; |
253 |
0
|
case VARIATION_EDIT: |
254 |
|
|
255 |
|
|
256 |
|
|
257 |
0
|
if(majorManager.getProgramModel()!=null && majorManager.getProgramModel().getDefinition()!=null){ |
258 |
0
|
callback.exec(majorManager.getVariationEditController()); |
259 |
|
}else{ |
260 |
|
|
261 |
0
|
Application.getApplicationContext().setParentPath(""); |
262 |
0
|
if (ProgramRegistry.isCreateNew()) { |
263 |
0
|
ProgramRegistry.setCreateNew(false); |
264 |
0
|
majorManager = new MajorManager(); |
265 |
|
} |
266 |
0
|
callback.exec(majorManager.getProgramEditController()); |
267 |
|
} |
268 |
|
|
269 |
|
|
270 |
0
|
break; |
271 |
0
|
case CORE_PROGRAM_VIEW: |
272 |
|
|
273 |
|
|
274 |
|
|
275 |
0
|
if (ProgramRegistry.isCreateNew()) { |
276 |
0
|
ProgramRegistry.setCreateNew(false); |
277 |
0
|
coreManager = new CoreManager(); |
278 |
|
} |
279 |
0
|
callback.exec(coreManager.getViewController()); |
280 |
|
|
281 |
|
|
282 |
0
|
break; |
283 |
0
|
case CORE_PROGRAM_EDIT: |
284 |
|
|
285 |
|
|
286 |
|
|
287 |
0
|
callback.exec(coreManager.getEditController()); |
288 |
|
|
289 |
|
|
290 |
0
|
break; |
291 |
0
|
case CORE_PROGRAM_VERSIONS: |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
0
|
callback.exec(coreManager.getProgramVersionsController()); |
296 |
|
|
297 |
|
|
298 |
0
|
break; |
299 |
0
|
case BACC_PROGRAM_VIEW: |
300 |
|
|
301 |
|
|
302 |
|
|
303 |
0
|
if (ProgramRegistry.isCreateNew()) { |
304 |
0
|
ProgramRegistry.setCreateNew(false); |
305 |
0
|
credentialManager = new CredentialManager(); |
306 |
|
} |
307 |
0
|
callback.exec(credentialManager.getBaccViewController()); |
308 |
|
|
309 |
|
|
310 |
0
|
break; |
311 |
0
|
case BACC_PROGRAM_EDIT: |
312 |
|
|
313 |
|
|
314 |
|
|
315 |
0
|
callback.exec(credentialManager.getBaccEditController()); |
316 |
|
|
317 |
|
|
318 |
0
|
break; |
319 |
0
|
case BACC_PROGRAM_VERSIONS: |
320 |
|
|
321 |
|
|
322 |
|
|
323 |
0
|
callback.exec(credentialManager.getProgramVersionsController()); |
324 |
|
|
325 |
|
|
326 |
0
|
break; |
327 |
0
|
case LO_CATEGORIES: |
328 |
|
|
329 |
|
|
330 |
|
|
331 |
0
|
callback.exec(getCategoryManagementController()); |
332 |
|
|
333 |
|
|
334 |
0
|
break; |
335 |
0
|
case DEPENDENCY_ANALYSIS: |
336 |
|
|
337 |
|
|
338 |
|
|
339 |
0
|
callback.exec(getDependencyAnalysisController()); |
340 |
|
|
341 |
|
|
342 |
0
|
break; |
343 |
0
|
case BROWSE_PROGRAM: |
344 |
|
|
345 |
|
|
346 |
|
|
347 |
0
|
callback.exec(getBrowseProgramController()); |
348 |
|
|
349 |
|
|
350 |
0
|
break; |
351 |
0
|
default: |
352 |
0
|
callback.exec(home); |
353 |
|
} |
354 |
|
} |
355 |
|
|
356 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
357 |
0
|
private View getCategoryManagementController() {... |
358 |
0
|
return new CategoryManagementView(this, "Learning Objective Categories", LUMViews.LO_CATEGORIES); |
359 |
|
} |
360 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
361 |
0
|
private CourseProposalController getCourseProposalController() {... |
362 |
0
|
courseProposalController = new CourseProposalController(); |
363 |
0
|
return courseProposalController; |
364 |
|
} |
365 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
366 |
0
|
private CourseAdminController getCourseAdminController() {... |
367 |
0
|
courseAdminController = new CourseAdminController(); |
368 |
0
|
return courseAdminController; |
369 |
|
} |
370 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
371 |
0
|
private CourseAdminWithoutVersionController getCourseAdminRetireController(){... |
372 |
0
|
courseAdminRetireController = new CourseAdminRetireController(); |
373 |
0
|
return courseAdminRetireController; |
374 |
|
} |
375 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
376 |
0
|
private CourseAdminWithoutVersionController getCourseAdminWithoutVersionController(){... |
377 |
0
|
courseAdminWithoutVersionController = new CourseAdminWithoutVersionController(); |
378 |
0
|
return courseAdminWithoutVersionController; |
379 |
|
} |
380 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
381 |
0
|
private LayoutController getViewCourseController() {... |
382 |
0
|
if (viewCourseController == null) { |
383 |
0
|
viewCourseController = new ViewCourseParentController(); |
384 |
|
} |
385 |
0
|
return this.viewCourseController; |
386 |
|
} |
387 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
388 |
0
|
private LayoutController getCluSetsController() {... |
389 |
0
|
manageCluSetsController = new CluSetsManagementController(); |
390 |
0
|
return manageCluSetsController; |
391 |
|
} |
392 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
393 |
0
|
private LayoutController getBrowseCatalogController() {... |
394 |
0
|
browseCatalogController = new CatalogBrowserController(this); |
395 |
0
|
return browseCatalogController; |
396 |
|
} |
397 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
398 |
0
|
private LayoutController getDependencyAnalysisController() {... |
399 |
0
|
dependencyAnalysisController = new DependencyAnalysisController("DependencyAnalaysis"); |
400 |
0
|
return dependencyAnalysisController; |
401 |
|
} |
402 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
403 |
0
|
private LayoutController getBrowseProgramController() {... |
404 |
0
|
browseProgramController = new BrowseProgramController("BrowseProgram"); |
405 |
0
|
return browseProgramController; |
406 |
|
} |
407 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
408 |
0
|
@Override... |
409 |
|
protected void hideView(View view) { |
410 |
0
|
ApplicationController.getApplicationViewContainer().clear(); |
411 |
|
} |
412 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
413 |
0
|
@Override... |
414 |
|
protected void renderView(View view) { |
415 |
0
|
ApplicationController.getApplicationViewContainer().add(view.asWidget()); |
416 |
|
} |
417 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
418 |
0
|
@Override... |
419 |
|
public Enum<?> getViewEnumValue(String enumValue) { |
420 |
0
|
return LUMViews.valueOf(enumValue); |
421 |
|
} |
422 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
423 |
0
|
@Override... |
424 |
|
public void updateModel() { |
425 |
|
|
426 |
|
} |
427 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
428 |
0
|
public <V extends Enum<?>> void showView(V viewType, Callback<Boolean> onReadyCallback) {... |
429 |
0
|
if (viewType == LUMViews.DEFAULT) { |
430 |
0
|
WindowTitleUtils.setContextTitle(name); |
431 |
|
} |
432 |
0
|
super.showView(viewType, onReadyCallback); |
433 |
|
} |
434 |
|
} |