1 | |
package org.kuali.student.lum.lu.ui.course.client.configuration; |
2 | |
|
3 | |
import org.kuali.student.common.dto.DtoConstants; |
4 | |
import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; |
5 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
6 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
7 | |
import org.kuali.student.common.ui.client.mvc.View; |
8 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
9 | |
import org.kuali.student.lum.common.client.lu.LUUIConstants; |
10 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminRetireController; |
11 | |
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController; |
12 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsViewController; |
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | 0 | public class CourseAdminRetireConfigurer extends CourseProposalConfigurer { |
21 | |
|
22 | |
protected CourseRequirementsViewController requisitesSection; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
@Override |
32 | |
public void configure(final CourseProposalController layout) { |
33 | 0 | type = "course"; |
34 | 0 | state = DtoConstants.STATE_RETIRED; |
35 | 0 | nextState = DtoConstants.STATE_RETIRED; |
36 | |
|
37 | 0 | groupName = LUUIConstants.COURSE_GROUP_NAME; |
38 | |
|
39 | 0 | KSLabel courseStatusLabel = new KSLabel(""); |
40 | 0 | if (layout.getCourseState() != null) |
41 | 0 | courseStatusLabel.setText(getLabel("courseStatusLabel") + ": " + layout.getCourseState()); |
42 | |
else |
43 | 0 | courseStatusLabel.setText(getLabel("courseStatusLabel") + ": Unknown"); |
44 | 0 | layout.addContentWidget(courseStatusLabel); |
45 | |
|
46 | 0 | layout.addView(generateCourseAdminView((CourseAdminRetireController) layout)); |
47 | 0 | } |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
protected View generateCourseAdminView(final CourseAdminRetireController layout) { |
55 | 0 | VerticalSectionView view = |
56 | |
new VerticalSectionView(CourseSections.COURSE_INFO, getLabel(LUUIConstants.RETIREMENT_LABEL_KEY), |
57 | |
COURSE_PROPOSAL_MODEL, false); |
58 | 0 | view.addStyleName(LUUIConstants.STYLE_SECTION); |
59 | |
|
60 | |
|
61 | 0 | Section activeDatesSection = generateActiveDatesSection(initSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY)); |
62 | 0 | Section retirementSection = generateRetirementSection(initSection(LUUIConstants.RETIREMENT_LABEL_KEY)); |
63 | |
|
64 | |
|
65 | 0 | view.addSection(activeDatesSection); |
66 | 0 | view.addSection(retirementSection); |
67 | |
|
68 | |
|
69 | 0 | String sections = getLabel(LUUIConstants.COURSE_SECTIONS); |
70 | 0 | layout.addMenu(sections); |
71 | 0 | layout.addMenuItemSection(sections, getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY), |
72 | |
LUUIConstants.ACTIVE_DATES_LABEL_KEY, activeDatesSection.getLayout()); |
73 | 0 | layout.addMenuItemSection(sections, getLabel(LUUIConstants.RETIREMENT_LABEL_KEY), |
74 | |
LUUIConstants.RETIREMENT_LABEL_KEY, retirementSection.getLayout()); |
75 | |
|
76 | |
|
77 | 0 | layout.addButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton()); |
78 | 0 | layout.addButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton()); |
79 | 0 | layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton()); |
80 | 0 | layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton()); |
81 | |
|
82 | 0 | return view; |
83 | |
} |
84 | |
|
85 | |
protected Section generateActiveDatesSection(Section section) { |
86 | 0 | addReadOnlyField(section, COURSE + "/" + START_TERM, generateMessageInfo(LUUIConstants.START_TERM_LABEL_KEY)); |
87 | 0 | addField(section, COURSE + "/" + END_TERM, generateMessageInfo(LUUIConstants.END_TERM_LABEL_KEY)); |
88 | |
|
89 | 0 | return section; |
90 | |
} |
91 | |
|
92 | |
protected Section generateRetirementSection(Section section) { |
93 | 0 | addField(section, COURSE + "/" + RETIREMENT_RATIONALE, |
94 | |
generateMessageInfo(LUUIConstants.RETIREMENT_RATIONALE_LABEL_KEY)); |
95 | 0 | addField(section, COURSE + "/" + LAST_TERM_OFFERED, |
96 | |
generateMessageInfo(LUUIConstants.LAST_TERM_OFFERED_LABEL_KEY)); |
97 | 0 | addField(section, COURSE + "/" + LAST_PUBLICATION_YEAR, |
98 | |
generateMessageInfo(LUUIConstants.LAST_PUBLICATION_YEAR_LABEL_KEY)); |
99 | 0 | addField(section, COURSE + "/" + SPECIAL_CIRCUMSTANCES, |
100 | |
generateMessageInfo(LUUIConstants.SPECIAL_CIRCUMSTANCES_LABEL_KEY)); |
101 | |
|
102 | 0 | return section; |
103 | |
} |
104 | |
|
105 | |
protected Section initSection(String labelKey) { |
106 | 0 | return initSection(SectionTitle.generateH2Title(getLabel(labelKey)), NO_DIVIDER); |
107 | |
} |
108 | |
|
109 | |
} |