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.layouts.MenuSectionController; |
6 |
|
import org.kuali.student.common.ui.client.configurable.mvc.sections.RequiredContainer; |
7 |
|
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
8 |
|
import org.kuali.student.common.ui.client.configurable.mvc.sections.VerticalSection; |
9 |
|
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
10 |
|
import org.kuali.student.common.ui.client.mvc.Callback; |
11 |
|
import org.kuali.student.common.ui.client.mvc.Controller; |
12 |
|
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
13 |
|
import org.kuali.student.common.ui.client.mvc.View; |
14 |
|
import org.kuali.student.common.ui.client.widgets.KSButton; |
15 |
|
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
16 |
|
import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool; |
17 |
|
import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool.EditMode; |
18 |
|
import org.kuali.student.core.document.ui.client.widgets.documenttool.DocumentTool; |
19 |
|
import org.kuali.student.lum.common.client.lu.LUUIConstants; |
20 |
|
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminController; |
21 |
|
import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController; |
22 |
|
import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsViewController; |
23 |
|
|
24 |
|
import com.google.gwt.core.client.GWT; |
25 |
|
import com.google.gwt.event.dom.client.ClickEvent; |
26 |
|
import com.google.gwt.event.dom.client.ClickHandler; |
27 |
|
import com.google.gwt.user.client.ui.Composite; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@author |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 104 (104) |
Complexity: 16 |
Complexity Density: 0.19 |
|
35 |
|
|
36 |
|
public class CourseAdminConfigurer extends CourseProposalConfigurer{ |
37 |
|
|
38 |
|
protected CourseRequirementsViewController requisitesSection; |
39 |
|
|
40 |
|
private RequiredContainer requiredContainer = new RequiredContainer(); |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
@param |
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 2 |
Complexity Density: 0.15 |
|
48 |
0
|
... |
49 |
0
|
public void configure(final CourseProposalController layout) { |
50 |
0
|
type = "course"; |
51 |
0
|
state = DtoConstants.STATE_DRAFT; |
52 |
|
nextState = DtoConstants.STATE_ACTIVE; |
53 |
0
|
|
54 |
|
groupName = LUUIConstants.COURSE_GROUP_NAME; |
55 |
0
|
|
56 |
0
|
layout.addContentWidget(layout.getWfUtilities().getProposalStatusLabel()); |
57 |
0
|
if (modelDefinition.getMetadata().isCanEdit()) { |
58 |
0
|
layout.addInfoWidget(requiredContainer); |
59 |
|
layout.addView(generateCourseAdminView((CourseAdminController) layout)); |
60 |
0
|
} else { |
61 |
0
|
CourseSummaryConfigurer summaryConfigurer = GWT.create(CourseSummaryConfigurer.class); |
62 |
0
|
summaryConfigurer.init(type, state, groupName, (DataModelDefinition) modelDefinition, stmtTypes, (Controller) layout, COURSE_PROPOSAL_MODEL); |
63 |
0
|
layout.removeMenuNavigation(); |
64 |
0
|
layout.addView(summaryConfigurer.generateProposalSummarySection(false)); |
65 |
|
final CommentTool commentTool = createCommentTool(layout); |
66 |
|
commentTool.setEditMode(EditMode.VIEW_COMMENT); |
67 |
|
} |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 1 |
Complexity Density: 0.02 |
|
73 |
0
|
@return... |
74 |
0
|
|
75 |
|
protected View generateCourseAdminView(final CourseAdminController layout) { |
76 |
0
|
VerticalSectionView view = |
77 |
|
new VerticalSectionView(CourseSections.COURSE_INFO, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), COURSE_PROPOSAL_MODEL, false); |
78 |
|
view.addStyleName(LUUIConstants.STYLE_SECTION); |
79 |
0
|
|
80 |
0
|
|
81 |
0
|
Section courseSection = generateCourseInfoSection(initSection(LUUIConstants.INFORMATION_LABEL_KEY)); |
82 |
0
|
Section governanceSection = generateGovernanceSection(initSection(LUUIConstants.GOVERNANCE_LABEL_KEY)); |
83 |
0
|
Section logisticsSection = generateCourseLogisticsSection(initSection(LUUIConstants.LOGISTICS_LABEL_KEY)); |
84 |
0
|
Section loSection = initSection(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY); |
85 |
0
|
loSection.addSection(generateLearningObjectivesNestedSection()); |
86 |
|
Section activeDatesSection = generateActiveDatesSection(initSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY)); |
87 |
|
Section financialSection = generateFinancialsSection(initSection(LUUIConstants.FINANCIALS_LABEL_KEY)); |
88 |
0
|
|
89 |
|
|
90 |
|
requisitesSection = new CourseRequirementsViewController(layout, getLabel(LUUIConstants.REQUISITES_LABEL_KEY), CourseSections.COURSE_REQUISITES, false, false); |
91 |
|
|
92 |
0
|
|
93 |
0
|
|
94 |
0
|
documentTool = new DocumentTool(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE,CourseSections.DOCUMENTS, getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY)); |
95 |
0
|
documentTool.setModelDefinition((DataModelDefinition)modelDefinition); |
96 |
0
|
documentTool.setController(layout); |
97 |
|
documentTool.setTitle(getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY)); |
98 |
0
|
documentTool.addStyleName(LUUIConstants.STYLE_SECTION); |
99 |
|
|
100 |
|
createCommentTool(layout); |
101 |
|
|
102 |
0
|
|
103 |
0
|
|
104 |
0
|
view.addSection(courseSection); |
105 |
0
|
view.addSection(governanceSection); |
106 |
0
|
view.addSection(logisticsSection); |
107 |
0
|
view.addSection(loSection); |
108 |
0
|
view.addSection(this.createHiddenRequisitesSection()); |
109 |
0
|
view.addView(requisitesSection); |
110 |
0
|
view.addSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY,activeDatesSection); |
111 |
|
view.addSection(financialSection); |
112 |
|
view.addView(documentTool); |
113 |
0
|
|
114 |
0
|
|
115 |
0
|
String sections = getLabel(LUUIConstants.COURSE_SECTIONS); |
116 |
0
|
layout.addMenu(sections); |
117 |
0
|
layout.addMenuItemSection(sections, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), LUUIConstants.INFORMATION_LABEL_KEY, courseSection.getLayout()); |
118 |
0
|
layout.addMenuItemSection(sections, getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY), LUUIConstants.GOVERNANCE_LABEL_KEY, governanceSection.getLayout()); |
119 |
0
|
layout.addMenuItemSection(sections, getLabel(LUUIConstants.LOGISTICS_LABEL_KEY), LUUIConstants.LOGISTICS_LABEL_KEY, logisticsSection.getLayout()); |
120 |
0
|
layout.addMenuItemSection(sections, getLabel(LUUIConstants.LEARNING_OBJECTIVE_LABEL_KEY), LUUIConstants.LEARNING_OBJECTIVE_LABEL_KEY, loSection.getLayout()); |
121 |
0
|
layout.addMenuItemSection(sections, getLabel(LUUIConstants.REQUISITES_LABEL_KEY), LUUIConstants.REQUISITES_LABEL_KEY, requisitesSection); |
122 |
0
|
layout.addMenuItemSection(sections, getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY), LUUIConstants.ACTIVE_DATES_LABEL_KEY, activeDatesSection.getLayout()); |
123 |
|
layout.addMenuItemSection(sections, getLabel(LUUIConstants.FINANCIALS_LABEL_KEY), LUUIConstants.FINANCIALS_LABEL_KEY, financialSection.getLayout()); |
124 |
|
layout.addMenuItemSection(sections, getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY), LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY, documentTool); |
125 |
0
|
|
126 |
0
|
|
127 |
0
|
layout.addButtonForView(CourseSections.COURSE_INFO, layout.getApproveAndActivateButton()); |
128 |
0
|
layout.addButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton()); |
129 |
0
|
layout.addButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton()); |
130 |
0
|
layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getApproveAndActivateButton()); |
131 |
|
layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton()); |
132 |
|
layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton()); |
133 |
0
|
|
134 |
0
|
|
135 |
|
this.addDocToolLink(); |
136 |
0
|
requiredContainer.setMainSection(view); |
137 |
|
|
138 |
|
return view; |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
139 |
0
|
}... |
140 |
|
|
141 |
0
|
private CommentTool createCommentTool(final MenuSectionController layout) { |
142 |
0
|
|
143 |
0
|
final CommentTool commentTool = new CommentTool(CourseSections.COMMENTS, getLabel(LUUIConstants.TOOL_COMMENTS_LABEL_KEY), "kuali.comment.type.generalRemarks", "Proposal Comments"); |
144 |
|
commentTool.setController(layout); |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
145 |
0
|
layout.addContentWidget(new KSButton("Comments", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() {... |
146 |
|
|
147 |
0
|
@Override |
148 |
|
public void onClick(ClickEvent event) { |
149 |
|
commentTool.show(); |
150 |
0
|
} |
151 |
|
})); |
152 |
|
return commentTool; |
153 |
|
} |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
@param |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
159 |
0
|
@return... |
160 |
0
|
|
161 |
|
public CourseRequirementsViewController getRequisitesSection() { |
162 |
|
return requisitesSection; |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
@param |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
169 |
0
|
@return... |
170 |
0
|
|
171 |
|
public DocumentTool getDocumentTool() { |
172 |
|
return documentTool; |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
173 |
0
|
}... |
174 |
0
|
|
175 |
|
protected VerticalSection initSection(String labelKey) { |
176 |
0
|
final VerticalSection section = initSection(SectionTitle.generateH2Title(getLabel(labelKey)), NO_DIVIDER); |
177 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
178 |
0
|
section.addShowAllLink(requiredContainer.createShowAllLink(new ClickHandler() {... |
179 |
|
|
180 |
0
|
@Override |
181 |
0
|
public void onClick(ClickEvent event) { |
182 |
|
requiredContainer.processInnerSection(section, true); |
183 |
|
section.getShowAllLink().setVisible(false); |
184 |
|
} |
185 |
0
|
})); |
186 |
|
|
187 |
|
return section; |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
188 |
0
|
}... |
189 |
0
|
|
190 |
|
private VerticalSection createHiddenRequisitesSection() { |
191 |
0
|
final VerticalSection section = initSection(SectionTitle.generateH2Title(getLabel(LUUIConstants.REQUISITES_LABEL_KEY)), NO_DIVIDER); |
192 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
193 |
0
|
section.addShowAllLink(requiredContainer.createShowAllLink(new ClickHandler() {... |
194 |
|
|
195 |
0
|
@Override |
196 |
0
|
public void onClick(ClickEvent event) { |
197 |
0
|
requisitesSection.asWidget().setVisible(true); |
198 |
|
section.getLayout().setVisible(false); |
199 |
|
section.setSectionId(LUUIConstants.REQUISITES_LABEL_KEY + "_Hidden"); |
200 |
|
} |
201 |
|
})); |
202 |
0
|
|
203 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
204 |
0
|
requiredContainer.addCallback(new Callback<Boolean>() {... |
205 |
|
|
206 |
0
|
@Override |
207 |
0
|
public void exec(Boolean result) { |
208 |
0
|
requisitesSection.asWidget().setVisible(result); |
209 |
0
|
section.getLayout().setVisible(!result); |
210 |
|
if (result) { |
211 |
0
|
section.setSectionId(LUUIConstants.REQUISITES_LABEL_KEY + "_Hidden"); |
212 |
|
} else { |
213 |
|
section.setSectionId(LUUIConstants.REQUISITES_LABEL_KEY); |
214 |
|
} |
215 |
0
|
} |
216 |
|
}); |
217 |
|
return section; |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
218 |
0
|
}... |
219 |
0
|
|
220 |
|
private void addDocToolLink(){ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
221 |
0
|
Composite container = requiredContainer.createShowAllLink(new ClickHandler() {... |
222 |
|
|
223 |
0
|
@Override |
224 |
|
public void onClick(ClickEvent event) { |
225 |
|
documentTool.showShowAllLink(false); |
226 |
|
} |
227 |
|
}); |
228 |
0
|
|
229 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
230 |
0
|
requiredContainer.addCallback(new Callback<Boolean>() {... |
231 |
|
|
232 |
0
|
@Override |
233 |
|
public void exec(Boolean result) { |
234 |
|
documentTool.showShowAllLink(!result); |
235 |
0
|
} |
236 |
|
}); |
237 |
|
documentTool.setShowAllLink(container); |
238 |
|
} |
239 |
|
} |