Clover Coverage Report - Kuali Student 1.2-M5-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Aug 29 2011 05:04:27 EDT
../../../../../../../../../img/srcFileCovDistChart0.png 42% of files have more coverage
388   1,240   101   8.43
86   1,023   0.26   23
46     2.2  
2    
 
  CourseSummaryConfigurer       Line # 83 386 0% 99 516 0% 0.0
  CourseSummaryConfigurer.EditHandler       Line # 109 2 0% 2 4 0% 0.0
 
No Tests
 
1    package org.kuali.student.lum.lu.ui.course.client.configuration;
2   
3    import java.util.ArrayList;
4    import java.util.Arrays;
5    import java.util.HashMap;
6    import java.util.Iterator;
7    import java.util.List;
8    import java.util.Map;
9   
10    import org.kuali.student.common.assembly.data.Data;
11    import org.kuali.student.common.assembly.data.Metadata;
12    import org.kuali.student.common.assembly.data.QueryPath;
13    import org.kuali.student.common.assembly.data.Data.Property;
14    import org.kuali.student.common.ui.client.application.Application;
15    import org.kuali.student.common.ui.client.configurable.mvc.Configurer;
16    import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptorReadOnly;
17    import org.kuali.student.common.ui.client.configurable.mvc.LayoutController;
18    import org.kuali.student.common.ui.client.configurable.mvc.binding.ListToTextBinding;
19    import org.kuali.student.common.ui.client.configurable.mvc.binding.ModelWidgetBinding;
20    import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController;
21    import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityConfiguration;
22    import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityFieldConfiguration;
23    import org.kuali.student.common.ui.client.configurable.mvc.sections.WarnContainer;
24    import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
25    import org.kuali.student.common.ui.client.mvc.Callback;
26    import org.kuali.student.common.ui.client.mvc.Controller;
27    import org.kuali.student.common.ui.client.mvc.DataModel;
28    import org.kuali.student.common.ui.client.mvc.DataModelDefinition;
29    import org.kuali.student.common.ui.client.widgets.KSButton;
30    import org.kuali.student.common.ui.client.widgets.KSLabel;
31    import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
32    import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo;
33    import org.kuali.student.common.ui.client.widgets.menus.KSListPanel;
34    import org.kuali.student.common.ui.client.widgets.table.summary.ShowRowConditionCallback;
35    import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableBlock;
36    import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableFieldBlock;
37    import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableFieldRow;
38    import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableSection;
39    import org.kuali.student.common.validation.dto.ValidationResultInfo;
40    import org.kuali.student.common.validation.dto.ValidationResultInfo.ErrorLevel;
41    import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool;
42    import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool.EditMode;
43    import org.kuali.student.core.document.ui.client.widgets.documenttool.DocumentList;
44    import org.kuali.student.core.document.ui.client.widgets.documenttool.DocumentListBinding;
45    import org.kuali.student.core.statement.dto.StatementTreeViewInfo;
46    import org.kuali.student.core.statement.dto.StatementTypeInfo;
47    import org.kuali.student.core.statement.ui.client.widgets.rules.SubrulePreviewWidget;
48    import org.kuali.student.core.workflow.ui.client.widgets.WorkflowEnhancedNavController;
49    import org.kuali.student.lum.common.client.lo.TreeStringBinding;
50    import org.kuali.student.lum.common.client.lu.LUUIConstants;
51    import org.kuali.student.lum.common.client.widgets.AppLocations;
52    import org.kuali.student.lum.lu.assembly.data.client.constants.base.AcademicSubjectOrgInfoConstants;
53    import org.kuali.student.lum.lu.assembly.data.client.constants.base.MetaInfoConstants;
54    import org.kuali.student.lum.lu.assembly.data.client.constants.base.RichTextInfoConstants;
55    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.AffiliatedOrgInfoConstants;
56    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseActivityConstants;
57    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseConstants;
58    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseDurationConstants;
59    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseExpenditureInfoConstants;
60    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseFormatConstants;
61    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseJointsConstants;
62    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseProposalConstants;
63    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseProposalInfoConstants;
64    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseRevenueInfoConstants;
65    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.FeeInfoConstants;
66    import org.kuali.student.lum.lu.assembly.data.client.constants.orch.LearningObjectiveConstants;
67    import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer.CourseSections;
68    import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer.KeyListModelWigetBinding;
69    import org.kuali.student.lum.lu.ui.course.client.configuration.ViewCourseConfigurer.ViewCourseSections;
70    import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController;
71    import org.kuali.student.lum.lu.ui.course.client.controllers.VersionsController;
72    import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsSummaryView;
73    import org.kuali.student.lum.lu.ui.course.client.requirements.HasRequirements;
74   
75    import com.google.gwt.core.client.GWT;
76    import com.google.gwt.event.dom.client.ClickEvent;
77    import com.google.gwt.event.dom.client.ClickHandler;
78    import com.google.gwt.user.client.ui.Anchor;
79    import com.google.gwt.user.client.ui.FlowPanel;
80    import com.google.gwt.user.client.ui.HTML;
81    import com.google.gwt.user.client.ui.Widget;
82   
 
83    public class CourseSummaryConfigurer extends Configurer implements
84    CreditCourseProposalConstants, CreditCourseProposalInfoConstants,
85    CreditCourseConstants, CreditCourseFormatConstants,
86    CreditCourseActivityConstants, MetaInfoConstants,
87    CreditCourseDurationConstants, FeeInfoConstants,
88    LearningObjectiveConstants, AcademicSubjectOrgInfoConstants,
89    AffiliatedOrgInfoConstants, CreditCourseRevenueInfoConstants,
90    CreditCourseExpenditureInfoConstants {
91    // Override paths for course and proposal so they are root
92    public static final String PROPOSAL = "";
93    public static final String COURSE = "";
94    public static final String PROPOSAL_TITLE_PATH = "proposal/name";
95   
96    private static final String OPTIONAL = "o";
97   
98    private List<ValidationResultInfo> validationInfos = new ArrayList<ValidationResultInfo>();
99    private boolean showingValidation = false;
100   
101    private List<StatementTypeInfo> stmtTypes;
102   
103    private Controller controller;
104    private SummaryTableSection tableSection; // review proposal data display
105    private String modelId;
106   
107    private List<Anchor> validateLinks = new ArrayList<Anchor>(); //KSLAB-1985
108   
 
109    private class EditHandler implements ClickHandler {
110   
111    Enum<?> view;
112   
 
113  0 toggle public EditHandler(Enum<?> view) {
114  0 this.view = view;
115    }
116   
 
117  0 toggle @Override
118    public void onClick(ClickEvent event) {
119  0 controller.showView(view);
120    }
121    }
122   
 
123  0 toggle public CourseSummaryConfigurer(String type, String state, String groupName,
124    DataModelDefinition modelDefinition,
125    List<StatementTypeInfo> stmtTypes, Controller controller,
126    String modelId) {
127  0 this.type = type;
128  0 this.state = state;
129  0 this.groupName = groupName;
130  0 this.modelDefinition = modelDefinition;
131  0 this.stmtTypes = stmtTypes;
132  0 this.controller = controller;
133  0 this.modelId = modelId;
134  0 tableSection = new SummaryTableSection((Controller) controller);
135    }
136   
 
137  0 toggle protected VerticalSectionView initSectionView(Enum<?> viewEnum,
138    String labelKey) {
139  0 VerticalSectionView section = new VerticalSectionView(viewEnum,
140    getLabel(labelKey), modelId);
141  0 section.addStyleName(LUUIConstants.STYLE_SECTION);
142  0 return section;
143    }
144   
 
145  0 toggle protected SummaryTableFieldRow getFieldRow(String fieldKey,
146    MessageKeyInfo messageKey) {
147  0 return getFieldRow(fieldKey, messageKey, null, null, null, null, false);
148    }
149   
 
150  0 toggle protected SummaryTableFieldRow getFieldRow(String fieldKey,
151    MessageKeyInfo messageKey, boolean optional) {
152  0 return getFieldRow(fieldKey, messageKey, null, null, null, null,
153    optional);
154    }
155   
 
156  0 toggle protected SummaryTableFieldRow getFieldRow(String fieldKey,
157    MessageKeyInfo messageKey, Widget widget, Widget widget2,
158    String parentPath, ModelWidgetBinding<?> binding, boolean optional) {
159  0 QueryPath path = QueryPath.concat(parentPath, fieldKey);
160  0 Metadata meta = modelDefinition.getMetadata(path);
161   
162  0 FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly(
163    path.toString(), messageKey, meta);
164  0 if (widget != null) {
165  0 fd.setFieldWidget(widget);
166    }
167  0 if (binding != null) {
168  0 fd.setWidgetBinding(binding);
169    }
170  0 fd.setOptional(optional);
171   
172  0 FieldDescriptorReadOnly fd2 = new FieldDescriptorReadOnly(
173    path.toString(), messageKey, meta);
174  0 if (widget2 != null) {
175  0 fd2.setFieldWidget(widget2);
176    }
177  0 if (binding != null) {
178  0 fd2.setWidgetBinding(binding);
179    }
180  0 fd2.setOptional(optional);
181   
182  0 SummaryTableFieldRow fieldRow = new SummaryTableFieldRow(fd, fd2);
183   
184  0 return fieldRow;
185    }
186   
 
187  0 toggle public VerticalSectionView generateProposalSummarySection(boolean canEditSections) {
188   
189    //Create and add the comment tool
190  0 final CommentTool commentTool = new CommentTool(CourseSections.COMMENTS,
191    getLabel(LUUIConstants.TOOL_COMMENTS_LABEL_KEY), "kuali.comment.type.generalRemarks",
192    "Proposal Comments");
193  0 commentTool.setEditMode(EditMode.VIEW_COMMENT);
194  0 if (controller instanceof MenuSectionController) {
195  0 MenuSectionController menuSectionController = (MenuSectionController)controller;
196  0 commentTool.setController(menuSectionController);
197  0 menuSectionController.addContentWidget(new KSButton("Comments", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() {
198   
 
199  0 toggle @Override
200    public void onClick(ClickEvent event) {
201  0 commentTool.show();
202    }
203    }));
204    }
205   
206  0 tableSection.setEditable(canEditSections);
207  0 tableSection.addSummaryTableFieldBlock(generateCourseInformationForProposal());
208  0 tableSection.addSummaryTableFieldBlock(generateCourseInformationForProposalCrossListed());
209  0 tableSection.addSummaryTableFieldBlock(generateGovernanceSection());
210  0 tableSection.addSummaryTableFieldBlock(generateCourseLogisticsSection());
211  0 tableSection.addSummaryTableFieldBlock(generateLearningObjectivesSection());
212  0 tableSection.addSummaryTableFieldBlock(generateRequirementsSection());
213  0 tableSection.addSummaryTableFieldBlock(generateActiveDatesSection());
214  0 tableSection.addSummaryTableFieldBlock(generateFeesSection());
215  0 tableSection.addSummaryTableFieldBlock(generateProposalDocumentsSection());
216   
217  0 if (controller instanceof WorkflowEnhancedNavController
218    && ((WorkflowEnhancedNavController) controller).getWfUtilities() != null) {
219   
220  0 final WarnContainer infoContainer1; // Header widget (with warnings if necessary)
221  0 final WarnContainer infoContainer2; // Footer widget (with warnings if necessary)
222    //WarnContainers initialized with buttons common to all states (error or otherwise)
223  0 infoContainer1 = generateWorkflowWidgetContainer(((WorkflowEnhancedNavController) controller)
224    .getWfUtilities().getWorkflowActionsWidget());
225  0 infoContainer2 = generateWorkflowWidgetContainer(((WorkflowEnhancedNavController) controller)
226    .getWfUtilities().getWorkflowActionsWidget());
227   
228  0 ((WorkflowEnhancedNavController) controller).getWfUtilities()
229    .addSubmitCallback(new Callback<Boolean>() {
230   
 
231  0 toggle @Override
232    public void exec(Boolean result) { //Don't place a breakpoint here: It will stall debugging for some unknown reason!
233  0 if (result) {
234  0 tableSection.setEditable(false);
235  0 if (controller instanceof MenuSectionController) {
236  0 ((MenuSectionController) controller).removeMenuNavigation();
237    }
238    }
239   
240    }
241    });
242   
243    // Override beforeShow for summary section here to allow for custom validation mechanism on the table
244  0 VerticalSectionView verticalSection = new VerticalSectionView(
245    CourseSections.SUMMARY,
246    getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId) {
 
247  0 toggle @Override
248    public void beforeShow(final Callback<Boolean> onReadyCallback) { //Don't place a breakpoint here: It will stall debugging for some unknown reason!
249   
250  0 super.beforeShow(new Callback<Boolean>() {
251   
 
252  0 toggle @Override
253    public void exec(final Boolean result) { //Don't place a breakpoint here: It will stall debugging for some unknown reason!
254   
255  0 if (result) {
256    // Make sure workflow actions and status updated before showing.
257  0 ((WorkflowEnhancedNavController) controller).getWfUtilities().refresh();
258   
259    // Show validation error if they exist
260  0 ((WorkflowEnhancedNavController) controller).getWfUtilities()
261    .doValidationCheck(new Callback<List<ValidationResultInfo>>() {
 
262  0 toggle @Override
263    public void exec(List<ValidationResultInfo> validationResult) { //Don't place a breakpoint here: It will stall debugging for some unknown reason!
264   
265  0 tableSection.enableValidation(showingValidation);
266  0 ErrorLevel isValid = tableSection.processValidationResults(
267    validationResult, true);
268   
269  0 validationInfos = validationResult;
270  0 if (isValid == ErrorLevel.OK) {
271  0 infoContainer1.showWarningLayout(false);
272  0 infoContainer2.showWarningLayout(false);
273  0 ((WorkflowEnhancedNavController) controller)
274    .getWfUtilities()
275    .enableWorkflowActionsWidgets(true);
276    } else { //KSLAB-1985
277   
278  0 infoContainer1.clearWarnLayout();
279  0 infoContainer2.clearWarnLayout();
280   
281  0 if (tableSection.getHasWarnings()) {
282   
283  0 infoContainer1
284    .addWarnWidgetBlock(new KSLabel(
285    "This proposal contains warnings that prevent it from being submitted."));
286  0 infoContainer2
287    .addWarnWidgetBlock(new KSLabel(
288    "This proposal contains warnings that prevent it from being submitted."));
289    }
290   
291  0 if (tableSection.getIsMissingFields()) {
292   
293  0 final Anchor link1 = new Anchor("Show what's missing.");
294  0 final Anchor link2 = new Anchor("Show what's missing.");
295  0 ClickHandler showHideMsgClickHandler = new ClickHandler() {
296   
297    //sets link action
 
298  0 toggle @Override
299    public void onClick(ClickEvent event) { //Don't place a breakpoint here: It will stall debugging for some unknown reason!
300  0 if (!showingValidation) {
301   
302  0 for (int i = 0; i < validateLinks.size(); i++) {
303  0 validateLinks.get(i).setText(
304    "Hide error highlighting.");
305    }
306  0 showingValidation = true;
307  0 tableSection.enableValidation(showingValidation);
308  0 tableSection.processValidationResults(
309    validationInfos, true);
310    } else {
311   
312  0 for (int i = 0; i < validateLinks.size(); i++) {
313  0 validateLinks.get(i).setText(
314    "Show what's missing.");
315    }
316  0 showingValidation = false;
317  0 tableSection.enableValidation(showingValidation);
318  0 tableSection.removeValidationHighlighting();
319    }
320    }
321    };
322   
323    //enables links
324  0 validateLinks.add(link1);
325  0 validateLinks.add(link2);
326   
327  0 link1.addClickHandler(showHideMsgClickHandler);
328  0 link2.addClickHandler(showHideMsgClickHandler);
329   
330  0 infoContainer1.addWarnWidget(new KSLabel(
331    "This proposal has missing fields. "));
332  0 infoContainer1.addWarnWidget(link1);
333  0 infoContainer2.addWarnWidget(new KSLabel(
334    "This proposal has missing fields. "));
335  0 infoContainer2.addWarnWidget(link2);
336    }
337   
338  0 infoContainer1.showWarningLayout(true);
339  0 infoContainer2.showWarningLayout(true);
340  0 ((WorkflowEnhancedNavController) controller).getWfUtilities()
341    .enableWorkflowActionsWidgets(false);
342    } //KSLAB-1985
343   
344  0 onReadyCallback.exec(result);
345    }
346    });
347    } else {
348  0 onReadyCallback.exec(result);
349    }
350    }
351    });
352    }
353    };
354    // Widget-adding order matters
355  0 verticalSection.addWidget(infoContainer1); // Header widget (with warnings if necessary)
356  0 verticalSection.addSection(tableSection);
357  0 verticalSection.addWidget(infoContainer2); // Footer widget (with warnings if necessary)
358   
359  0 return verticalSection;
360   
361    } else {
362   
363  0 VerticalSectionView verticalSection = new VerticalSectionView(
364    CourseSections.SUMMARY,
365    getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId);
366  0 verticalSection.addSection(tableSection);
367  0 GWT.log("CourseSummaryConfigurer - Summary table needs a workflow controller to provide submit/validation mechanism");
368   
369  0 return verticalSection;
370    }
371   
372    }
373   
 
374  0 toggle private SummaryTableFieldBlock generateProposalDocumentsSection() {
375  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
376  0 block.addEditingHandler(new EditHandler(CourseSections.DOCUMENTS));
377  0 block.setTitle(getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY));
378  0 block.addSummaryTableFieldRow(getFieldRow("proposal/id",
379    generateMessageInfo(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY),
380    new DocumentList(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE,
381    false, false), new DocumentList(
382    LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE, false,
383    false), null, new DocumentListBinding("proposal/id"),
384    false));
385  0 return block;
386    }
387   
388    // Initializes a WarnContainer with Action options dropdown, and Curriculum Management link
 
389  0 toggle private WarnContainer generateWorkflowWidgetContainer(Widget w) {
390   
391  0 WarnContainer warnContainer = new WarnContainer();
392   
393  0 warnContainer.add(w);
394  0 w.addStyleName("ks-button-spacing");
395  0 warnContainer.add(new KSButton("Return to Curriculum Management",
396    ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() {
397   
 
398  0 toggle @Override
399    public void onClick(ClickEvent event) { //Don't place a breakpoint here: It will stall debugging for some unknown reason!
400  0 Application
401    .navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT
402    .getLocation());
403    }
404    }));
405   
406    // KSLAB-1985: Warning logic/display moved to generateProposalSummarySection() where error states are established
407   
408  0 return warnContainer;
409    }
410   
 
411  0 toggle public VerticalSectionView generateCourseSummarySection() {
412  0 tableSection.setEditable(false);
413  0 tableSection.addSummaryTableFieldBlock(generateCourseInformation());
414  0 tableSection
415    .addSummaryTableFieldBlock(generateCourseInformationCrossListing());
416  0 tableSection.addSummaryTableFieldBlock(generateGovernanceSection());
417  0 tableSection
418    .addSummaryTableFieldBlock(generateCourseLogisticsSection());
419  0 tableSection
420    .addSummaryTableFieldBlock(generateLearningObjectivesSection());
421  0 tableSection.addSummaryTableFieldBlock(generateRequirementsSection());
422  0 tableSection.addSummaryTableFieldBlock(generateActiveDatesSection());
423  0 tableSection.addSummaryTableFieldBlock(generateFeesSection());
424   
425  0 VerticalSectionView verticalSection = new VerticalSectionView(
426    ViewCourseSections.DETAILED,
427    getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId, false);
428  0 verticalSection.addSection(tableSection);
429   
430  0 return verticalSection;
431    }
432   
 
433  0 toggle @SuppressWarnings("unchecked")
434    public SummaryTableFieldBlock generateCourseInformationForProposal() {
435  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
436  0 block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
437  0 block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY));
438  0 block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH,
439    generateMessageInfo(LUUIConstants.PROPOSAL_TITLE_LABEL_KEY)));
440  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE,
441    generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
442  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
443    + TRANSCRIPT_TITLE,
444    generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY)));
445  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA,
446    generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY)));
447  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
448    + COURSE_NUMBER_SUFFIX,
449    generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
450  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS,
451    generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null,
452    null, null, new KeyListModelWigetBinding("personId"), false));
453   
454    // block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" +
455    // PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN,
456    // generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
457    // block.addSummaryTableFieldRow(getFieldRow("proposal/rationale",
458    // generateMessageInfo(LUUIConstants.PROPOSAL_RATIONALE_LABEL_KEY)));
459   
460  0 return block;
461    }
462   
 
463  0 toggle @SuppressWarnings("unchecked")
464    public SummaryTableFieldBlock generateCourseInformationForProposalCrossListed() {
465  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
466  0 block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
467  0 block.setTitle("Cross Listed Courses");
468   
469  0 block.addSummaryMultiplicity(getMultiplicityConfig(
470    COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
471    LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY, Arrays.asList(Arrays
472    .asList(SUBJECT_AREA,
473    LUUIConstants.SUBJECT_CODE_LABEL_KEY), Arrays
474    .asList(COURSE_NUMBER_SUFFIX,
475    LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
476   
477  0 block.addSummaryMultiplicity(getMultiplicityConfig(
478    COURSE + QueryPath.getPathSeparator() + JOINTS,
479    LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
480    Arrays.asList(Arrays.asList(
481    CreditCourseJointsConstants.COURSE_ID,
482    LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
483   
484  0 block.addSummaryMultiplicity(getMultiplicityConfig(
485    COURSE + QueryPath.getPathSeparator() + VERSIONS,
486    LUUIConstants.VERSION_CODE_LABEL_KEY, Arrays.asList(Arrays
487    .asList("variationCode",
488    LUUIConstants.VERSION_CODE_LABEL_KEY),
489    Arrays.asList("variationTitle",
490    LUUIConstants.TITLE_LABEL_KEY))));
491   
492  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
493    + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN,
494    generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
495  0 block.addSummaryTableFieldRow(getFieldRow("proposal/rationale",
496    generateMessageInfo(LUUIConstants.PROPOSAL_RATIONALE_LABEL_KEY)));
497   
498  0 return block;
499    }
500   
 
501  0 toggle public SummaryTableFieldBlock generateCourseInformation() {
502  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
503  0 block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
504  0 block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY));
505    // block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH,
506    // generateMessageInfo(LUConstants.PROPOSAL_TITLE_LABEL_KEY)));
507  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE,
508    generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
509  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
510    + TRANSCRIPT_TITLE,
511    generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY)));
512  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA,
513    generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY)));
514  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
515    + COURSE_NUMBER_SUFFIX,
516    generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
517  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS,
518    generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null,
519    null, null, new KeyListModelWigetBinding("personId"), false));
520  0 SummaryTableFieldBlock aRow = new SummaryTableFieldBlock();
521  0 aRow.setTitle("Fixing it");
522   
523  0 aRow.addSummaryMultiplicity(getMultiplicityConfig(
524    COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
525    LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY, Arrays.asList(Arrays
526    .asList(SUBJECT_AREA,
527    LUUIConstants.SUBJECT_CODE_LABEL_KEY), Arrays
528    .asList(COURSE_NUMBER_SUFFIX,
529    LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
530   
531  0 block.addSummaryMultiplicity(getMultiplicityConfig(
532    COURSE + QueryPath.getPathSeparator() + JOINTS,
533    LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
534    Arrays.asList(Arrays.asList(
535    CreditCourseJointsConstants.COURSE_ID,
536    LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
537  0 block.addSummaryMultiplicity(getMultiplicityConfig(
538    COURSE + QueryPath.getPathSeparator() + VERSIONS,
539    LUUIConstants.VERSION_CODE_LABEL_KEY, Arrays.asList(Arrays
540    .asList("variationCode",
541    LUUIConstants.VERSION_CODE_LABEL_KEY),
542    Arrays.asList("variationTitle",
543    LUUIConstants.TITLE_LABEL_KEY))));
544   
545    // block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" +
546    // PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN,
547    // generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
548   
549  0 return block;
550    }
551   
 
552  0 toggle public SummaryTableFieldBlock generateCourseInformationCrossListing() {
553  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
554  0 block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
555  0 block.setTitle("Cross Listings");
556   
557  0 block.addSummaryMultiplicity(getMultiplicityConfig(
558    COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
559    LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY, Arrays.asList(Arrays
560    .asList(SUBJECT_AREA,
561    LUUIConstants.SUBJECT_CODE_LABEL_KEY), Arrays
562    .asList(COURSE_NUMBER_SUFFIX,
563    LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
564   
565  0 block.addSummaryMultiplicity(getMultiplicityConfig(
566    COURSE + QueryPath.getPathSeparator() + JOINTS,
567    LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
568    Arrays.asList(Arrays.asList(
569    CreditCourseJointsConstants.COURSE_ID,
570    LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
571  0 block.addSummaryMultiplicity(getMultiplicityConfig(
572    COURSE + QueryPath.getPathSeparator() + VERSIONS,
573    LUUIConstants.VERSION_CODE_LABEL_KEY, Arrays.asList(Arrays
574    .asList("variationCode",
575    LUUIConstants.VERSION_CODE_LABEL_KEY),
576    Arrays.asList("variationTitle",
577    LUUIConstants.TITLE_LABEL_KEY))));
578   
579  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
580    + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN,
581    generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
582   
583  0 return block;
584    }
585   
 
586  0 toggle public SummaryTableFieldBlock generateGovernanceSection() {
587  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
588  0 block.addEditingHandler(new EditHandler(CourseSections.GOVERNANCE));
589  0 block.setTitle(getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY));
590  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
591    + CAMPUS_LOCATIONS,
592    generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY)));
593  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
594    + CURRICULUM_OVERSIGHT_ORGS_,
595    generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY)));
596  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS,
597    generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY)));
598  0 return block;
599    }
600   
 
601  0 toggle @SuppressWarnings("unchecked")
602    public SummaryTableFieldBlock generateCourseLogisticsSection() {
603  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
604  0 block.addEditingHandler(new EditHandler(CourseSections.COURSE_LOGISTICS));
605  0 block.setTitle(getLabel(LUUIConstants.LOGISTICS_LABEL_KEY));
606  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED,
607    generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY)));
608  0 block.addSummaryTableFieldRow(getFieldRow(
609    COURSE + "/" + GRADING_OPTIONS,
610    generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY)));
611  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
612    + CreditCourseConstants.DURATION + "/" + "atpDurationTypeKey",
613    generateMessageInfo(LUUIConstants.DURATION_TYPE_LABEL_KEY)));
614  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
615    + CreditCourseConstants.DURATION + "/" + "timeQuantity",
616    generateMessageInfo(LUUIConstants.DURATION_QUANTITY_LABEL_KEY)));
617  0 block.addSummaryTableFieldRow(getFieldRow(
618    COURSE + "/" + PASS_FAIL,
619    generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY)));
620  0 block.addSummaryTableFieldRow(getFieldRow(
621    COURSE + "/" + AUDIT,
622    generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY)));
623   
624  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
625    + CreditCourseConstants.FINAL_EXAM,
626    generateMessageInfo(LUUIConstants.FINAL_EXAM_STATUS_LABEL_KEY)));
627  0 block.addSummaryTableFieldRow(getFieldRow(
628    COURSE + "/" + CreditCourseConstants.FINAL_EXAM_RATIONALE,
629    generateMessageInfo(LUUIConstants.FINAL_EXAM_RATIONALE_LABEL_KEY),
630    true));
631   
632    // Outcomes
633  0 Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>();
634  0 ListToTextBinding resultValuesBinding = new ListToTextBinding();
635  0 customBindings.put("resultValues", resultValuesBinding);
636  0 String outcomesKey = COURSE + QueryPath.getPathSeparator()
637    + CREDIT_OPTIONS;
638  0 MultiplicityConfiguration outcomesConfig = getMultiplicityConfig(
639    outcomesKey,
640    LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY,
641    Arrays.asList(
642    Arrays.asList(
643    CreditCourseConstants.TYPE,
644    LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY),
645    Arrays.asList(CREDIT_OPTION_FIXED_CREDITS,
646    LUUIConstants.CREDIT_VALUE_LABEL_KEY, OPTIONAL),
647    Arrays.asList(
648    CREDIT_OPTION_MIN_CREDITS,
649    LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY,
650    OPTIONAL),
651    Arrays.asList(
652    CREDIT_OPTION_MAX_CREDITS,
653    LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY,
654    OPTIONAL),
655    Arrays.asList(
656    "resultValues",
657    LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY,
658    OPTIONAL)), customBindings);
659   
660    // Massive workaround for result values problem where we dont want to
661    // show them on certain selections,
662    // in most cases you want to just use the optional flag and have it be
663    // based on empty/null data
664    // but since this data is sometimes not empty/null when we dont want to
665    // show it, it requires a show
666    // condition callback
667  0 tableSection.addShowRowCallback(new ShowRowConditionCallback() {
 
668  0 toggle @Override
669    public void processShowConditions(SummaryTableFieldRow row, //Don't place a breakpoint here: It will stall debugging for some unknown reason!
670    DataModel column1, DataModel column2) {
671  0 if (row.getFieldDescriptor1() != null
672    && row.getFieldDescriptor1().getFieldKey()
673    .contains(CREDIT_OPTIONS)
674    && row.getFieldDescriptor1().getFieldKey()
675    .contains("resultValues")) {
676  0 String type = row
677    .getFieldDescriptor1()
678    .getFieldKey()
679    .replace("resultValues", CreditCourseConstants.TYPE);
680  0 Object data1 = null;
681  0 Object data2 = null;
682  0 if (column1 != null) {
683  0 data1 = column1.get(type);
684    }
685  0 if (column2 != null) {
686  0 data2 = column2.get(type);
687    }
688   
689  0 if (data1 != null && data1 instanceof String) {
690  0 if (!((String) data1)
691    .equals("kuali.resultComponentType.credit.degree.multiple")) {
692  0 row.setShown(false);
693    }
694  0 } else if (data2 != null && data2 instanceof String) {
695  0 if (!((String) data2)
696    .equals("kuali.resultComponentType.credit.degree.multiple")) {
697  0 row.setShown(false);
698    }
699    }
700    }
701    }
702    });
703   
704  0 block.addSummaryMultiplicity(outcomesConfig);
705   
706    // Formats
707  0 MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE
708    + QueryPath.getPathSeparator() + FORMATS,
709    LUUIConstants.FORMAT_LABEL_KEY, null);
710  0 MultiplicityConfiguration activitiesConfig = getMultiplicityConfig(
711    COURSE + QueryPath.getPathSeparator() + FORMATS
712    + QueryPath.getPathSeparator()
713    + QueryPath.getWildCard()
714    + QueryPath.getPathSeparator() + ACTIVITIES,
715    LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY,
716    Arrays.asList(Arrays.asList(ACTIVITY_TYPE,
717    LUUIConstants.ACTIVITY_TYPE_LABEL_KEY), Arrays.asList(
718    CONTACT_HOURS + "/" + "unitQuantity",
719    LUUIConstants.CONTACT_HOURS_LABEL_KEY), Arrays.asList(
720    CONTACT_HOURS + "/" + "unitType",
721    LUUIConstants.CONTACT_HOURS_FREQUENCY_LABEL_KEY),
722    Arrays.asList(CreditCourseActivityConstants.DURATION
723    + "/" + "atpDurationTypeKey",
724    LUUIConstants.DURATION_TYPE_LABEL_KEY),
725    Arrays.asList(CreditCourseActivityConstants.DURATION
726    + "/" + "timeQuantity",
727    LUUIConstants.DURATION_LITERAL_LABEL_KEY),
728    Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE,
729    LUUIConstants.CLASS_SIZE_LABEL_KEY)));
730  0 formatsConfig.setNestedConfig(activitiesConfig);
731  0 block.addSummaryMultiplicity(formatsConfig);
732   
733  0 return block;
734    }
735   
 
736  0 toggle public SummaryTableFieldBlock generateLearningObjectivesSection() {
737  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
738  0 block.addEditingHandler(new EditHandler(
739    CourseSections.LEARNING_OBJECTIVES));
740  0 block.setTitle(getLabel(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY));
741  0 SummaryTableFieldRow loRow = getFieldRow(
742    COURSE + "/" + CreditCourseConstants.COURSE_SPECIFIC_LOS,
743    generateMessageInfo(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY),
744    new KSListPanel(), new KSListPanel(), null,
745    new TreeStringBinding(), false);
746  0 loRow.addContentCellStyleName("summaryTable-lo-cell");
747  0 block.addSummaryTableFieldRow(loRow);
748   
749  0 return block;
750    }
751   
 
752  0 toggle public SummaryTableFieldBlock generateActiveDatesSection() {
753  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
754  0 block.addEditingHandler(new EditHandler(CourseSections.ACTIVE_DATES));
755  0 block.setTitle(getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY));
756  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + START_TERM,
757    generateMessageInfo(LUUIConstants.START_TERM_LABEL_KEY)));
758  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + END_TERM,
759    generateMessageInfo(LUUIConstants.END_TERM_LABEL_KEY)));
760    // Probably wrong - checkbox
761  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PILOT_COURSE,
762    generateMessageInfo(LUUIConstants.PILOT_COURSE_LABEL_KEY)));
763  0 return block;
764    }
765   
 
766  0 toggle public SummaryTableFieldBlock generateFeesSection() {
767  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
768  0 block.addEditingHandler(new EditHandler(CourseSections.FINANCIALS));
769  0 block.setTitle(getLabel(LUUIConstants.FINANCIALS_LABEL_KEY));
770  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
771    + "feeJustification" + "/" + RichTextInfoConstants.PLAIN,
772    generateMessageInfo(LUUIConstants.JUSTIFICATION_FEE)));
773    // Fees
774  0 MultiplicityConfiguration feesConfig = getMultiplicityConfig(
775    COURSE + QueryPath.getPathSeparator() + FEES,
776    LUUIConstants.FEE,
777    Arrays.asList(Arrays.asList("rateType", "Rate Type"),
778    Arrays.asList("feeType", "Fee Type")));
779    // Note the use of empty string to remove the additional row from
780    // display in the summary table
781  0 MultiplicityConfiguration amountsConfig = getMultiplicityConfig(
782    COURSE + QueryPath.getPathSeparator() + FEES
783    + QueryPath.getPathSeparator()
784    + QueryPath.getWildCard()
785    + QueryPath.getPathSeparator() + "feeAmounts", "",
786    Arrays.asList(Arrays.asList("currencyQuantity", "Amount")));
787  0 feesConfig.setNestedConfig(amountsConfig);
788  0 block.addSummaryMultiplicity(feesConfig);
789   
790    // Revenue
791  0 MultiplicityConfiguration revenueConfig = getMultiplicityConfig(
792    COURSE + QueryPath.getPathSeparator() + "revenues",
793    LUUIConstants.REVENUE,
794    Arrays.asList(Arrays.asList("affiliatedOrgs/0/orgId",
795    "Organization"), Arrays.asList(
796    "affiliatedOrgs/0/percentage", "Percentage")));
797  0 block.addSummaryMultiplicity(revenueConfig);
798   
799    // Expenditure
800  0 MultiplicityConfiguration expenditureConfig = getMultiplicityConfig(
801    COURSE + QueryPath.getPathSeparator() + "expenditure"
802    + QueryPath.getPathSeparator() + "affiliatedOrgs",
803    LUUIConstants.EXPENDITURE,
804    Arrays.asList(Arrays.asList("orgId", "Organization"),
805    Arrays.asList("percentage", "Percentage")));
806  0 block.addSummaryMultiplicity(expenditureConfig);
807   
808  0 return block;
809    }
810   
 
811  0 toggle public SummaryTableFieldBlock generateRequirementsSection() {
812   
813  0 final SummaryTableFieldBlock block = new SummaryTableFieldBlock();
814  0 block.addEditingHandler(new EditHandler(
815    CourseSections.COURSE_REQUISITES));
816  0 block.setTitle(getLabel(LUUIConstants.REQUISITES_LABEL_KEY));
817   
818    // one row per requirement type
819  0 for (StatementTypeInfo stmtType : stmtTypes) {
820  0 SummaryTableFieldRow arow;
821  0 if (controller instanceof VersionsController
822    || controller instanceof CourseProposalController)
823  0 arow = new SummaryTableFieldRow(addRequisiteField(
824    new FlowPanel(), stmtType), addRequisiteFieldComp(
825    new FlowPanel(), stmtType));
826    else
827  0 arow = new SummaryTableFieldRow(addRequisiteField(
828    new FlowPanel(), stmtType), addRequisiteField(
829    new FlowPanel(), stmtType));
830  0 block.addSummaryTableFieldRow(arow);
831    }
832   
833  0 return block;
834    }
835   
 
836  0 toggle private FieldDescriptorReadOnly addRequisiteField(final FlowPanel panel,
837    final StatementTypeInfo stmtType) {
838   
839  0 final ModelWidgetBinding<FlowPanel> widgetBinding = new ModelWidgetBinding<FlowPanel>() {
840   
 
841  0 toggle @Override
842    public void setModelValue(FlowPanel panel, DataModel model, //Don't place a breakpoint here: It will stall debugging for some unknown reason!
843    String path) {
844    }
845   
 
846  0 toggle @Override
847    public void setWidgetValue(final FlowPanel panel, DataModel model, //Don't place a breakpoint here: It will stall debugging for some unknown reason!
848    String path) {
849  0 panel.clear();
850  0 if (controller instanceof HasRequirements) {
851  0 HasRequirements requirementsController = (HasRequirements) controller;
852  0 List<StatementTreeViewInfo> statementTreeViewInfos = requirementsController
853    .getReqDataModel().getCourseReqInfo(
854    stmtType.getId());
855  0 for (StatementTreeViewInfo rule : statementTreeViewInfos) {
856  0 SubrulePreviewWidget ruleWidget = new SubrulePreviewWidget(
857    rule, true,
858    CourseRequirementsSummaryView
859    .getCluSetWidgetList(rule));
860  0 panel.add(ruleWidget);
861    }
862    }
863    }
864    };
865   
866  0 FieldDescriptorReadOnly requisiteField = new FieldDescriptorReadOnly(
867    COURSE + "/" + CreditCourseConstants.ID, new MessageKeyInfo(
868    stmtType.getName()), null, panel);
869  0 requisiteField.setWidgetBinding(widgetBinding);
870   
871  0 return requisiteField;
872    }
873   
 
874  0 toggle private FieldDescriptorReadOnly addRequisiteFieldComp(
875    final FlowPanel panel, final StatementTypeInfo stmtType) {
876   
877  0 final ModelWidgetBinding<FlowPanel> widgetBinding = new ModelWidgetBinding<FlowPanel>() {
878   
 
879  0 toggle @Override
880    public void setModelValue(FlowPanel panel, DataModel model,
881    String path) {
882    }
883   
 
884  0 toggle @Override
885    public void setWidgetValue(final FlowPanel panel, DataModel model,
886    String path) {
887  0 panel.clear();
888  0 List<StatementTreeViewInfo> statementTreeViewInfos = null;
889   
890  0 if (controller instanceof VersionsController)
891  0 statementTreeViewInfos = ((VersionsController) controller)
892    .getReqDataModelComp().getCourseReqInfo(
893    stmtType.getId());
894  0 else if (controller instanceof CourseProposalController)
895  0 statementTreeViewInfos = ((CourseProposalController) controller)
896    .getReqDataModelComp().getCourseReqInfo(
897    stmtType.getId());
898   
899  0 for (StatementTreeViewInfo rule : statementTreeViewInfos) {
900  0 SubrulePreviewWidget ruleWidget = new SubrulePreviewWidget(
901    rule, true,
902    CourseRequirementsSummaryView
903    .getCluSetWidgetList(rule));
904  0 panel.add(ruleWidget);
905    }
906    }
907    };
908   
909  0 FieldDescriptorReadOnly requisiteField = new FieldDescriptorReadOnly(
910    COURSE + "/" + CreditCourseConstants.ID, new MessageKeyInfo(
911    stmtType.getName()), null, panel);
912  0 requisiteField.setWidgetBinding(widgetBinding);
913   
914  0 return requisiteField;
915    }
916   
 
917  0 toggle private MultiplicityConfiguration getMultiplicityConfig(String path,
918    String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels) {
919  0 return getMultiplicityConfig(path, itemLabelMessageKey,
920    fieldKeysAndLabels, null);
921    }
922   
 
923  0 toggle private MultiplicityConfiguration getMultiplicityConfig(String path,
924    String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels,
925    Map<String, ModelWidgetBinding> customBindings) {
926  0 QueryPath parentPath = QueryPath.concat(path);
927  0 MultiplicityConfiguration config = new MultiplicityConfiguration(
928    MultiplicityConfiguration.MultiplicityType.TABLE,
929    MultiplicityConfiguration.StyleType.TOP_LEVEL_GROUP,
930    modelDefinition.getMetadata(parentPath));
931  0 config.setItemLabel(getLabel(itemLabelMessageKey));
932  0 config.setUpdateable(false);
933  0 config.setShowHeaders(true);
934   
935  0 FieldDescriptorReadOnly parentFd = buildFieldDescriptor(path,
936    getLabel(itemLabelMessageKey), null);
937  0 config.setParent(parentFd);
938   
939  0 if (fieldKeysAndLabels != null) {
940  0 for (List<String> fieldKeyAndLabel : fieldKeysAndLabels) {
941  0 MultiplicityFieldConfiguration fd = buildMultiplicityFD(
942    fieldKeyAndLabel.get(0), fieldKeyAndLabel.get(1),
943    parentPath.toString());
944  0 if (fieldKeyAndLabel.size() == 3
945    && fieldKeyAndLabel.get(2).equals(OPTIONAL)) {
946  0 fd.setOptional(true);
947    }
948  0 if (customBindings != null
949    && customBindings.containsKey(fieldKeyAndLabel.get(0))) {
950  0 fd.setModelWidgetBinding(customBindings
951    .get(fieldKeyAndLabel.get(0)));
952    }
953  0 config.addFieldConfiguration(fd);
954    }
955    }
956   
957  0 return config;
958    }
959   
960    // TODO next 3 methods below should be moved into some kind of multiplicity
961    // helper class
 
962  0 toggle private MultiplicityFieldConfiguration buildMultiplicityFD(String fieldKey,
963    String labelKey, String parentPath) {
964   
965  0 QueryPath fieldPath = QueryPath.concat(parentPath,
966    QueryPath.getWildCard(), fieldKey);
967  0 Metadata meta = modelDefinition.getMetadata(fieldPath);
968   
969  0 MultiplicityFieldConfiguration fd = new MultiplicityFieldConfiguration(
970    fieldPath.toString(), generateMessageInfo(labelKey), meta, null);
971   
972  0 return fd;
973   
974    }
975   
 
976  0 toggle private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey,
977    String messageKey, String parentPath) {
978  0 return buildFieldDescriptor(fieldKey, messageKey, parentPath, null,
979    null);
980    }
981   
 
982  0 toggle private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey,
983    String messageKey, String parentPath, Widget widget,
984    ModelWidgetBinding<?> binding) {
985   
986  0 QueryPath path = QueryPath.concat(parentPath, fieldKey);
987  0 Metadata meta = modelDefinition.getMetadata(path);
988   
989  0 FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly(
990    path.toString(), generateMessageInfo(messageKey), meta);
991  0 if (widget != null) {
992  0 fd.setFieldWidget(widget);
993    }
994  0 if (binding != null) {
995  0 fd.setWidgetBinding(binding);
996    }
997  0 return fd;
998    }
999   
 
1000  0 toggle public VerticalSectionView generateCourseBriefSection() {
1001  0 SummaryTableSection courseBriefSection = new SummaryTableSection(
1002    controller);
1003  0 courseBriefSection.setEditable(false);
1004  0 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
1005  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE,
1006    generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
1007  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + "code",
1008    generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
1009  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS,
1010    generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY)));
1011  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
1012    + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN,
1013    generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
1014  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
1015    + CURRICULUM_OVERSIGHT_ORGS_,
1016    generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY)));
1017  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/"
1018    + CAMPUS_LOCATIONS,
1019    generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY)));
1020   
1021  0 Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>();
1022  0 ListToTextBinding resultValuesBinding = new ListToTextBinding();
1023  0 customBindings.put("resultValues", resultValuesBinding);
1024  0 String outcomesKey = COURSE + QueryPath.getPathSeparator()
1025    + CREDIT_OPTIONS;
1026  0 MultiplicityConfiguration outcomesConfig = getMultiplicityConfig(
1027    outcomesKey,
1028    LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY,
1029    Arrays.asList(
1030    Arrays.asList(
1031    CreditCourseConstants.TYPE,
1032    LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY),
1033    Arrays.asList(CREDIT_OPTION_FIXED_CREDITS,
1034    LUUIConstants.CONTACT_HOURS_LABEL_KEY, OPTIONAL),
1035    Arrays.asList(
1036    CREDIT_OPTION_MIN_CREDITS,
1037    LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY,
1038    OPTIONAL),
1039    Arrays.asList(
1040    CREDIT_OPTION_MAX_CREDITS,
1041    LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY,
1042    OPTIONAL),
1043    Arrays.asList(
1044    "resultValues",
1045    LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY,
1046    OPTIONAL)), customBindings);
1047   
1048    // Massive workaround for result values problem where we dont want to
1049    // show them on certain selections,
1050    // in most cases you want to just use the optional flag and have it be
1051    // based on empty/null data
1052    // but since this data is sometimes not empty/null when we dont want to
1053    // show it, it requires a show
1054    // condition callback
1055  0 courseBriefSection.addShowRowCallback(new ShowRowConditionCallback() {
 
1056  0 toggle @Override
1057    public void processShowConditions(SummaryTableFieldRow row,
1058    DataModel column1, DataModel column2) {
1059  0 if (row.getFieldDescriptor1() != null
1060    && row.getFieldDescriptor1().getFieldKey()
1061    .contains(CREDIT_OPTIONS)
1062    && row.getFieldDescriptor1().getFieldKey()
1063    .contains("resultValues")) {
1064  0 String type = row
1065    .getFieldDescriptor1()
1066    .getFieldKey()
1067    .replace("resultValues", CreditCourseConstants.TYPE);
1068  0 Object data1 = null;
1069  0 Object data2 = null;
1070  0 if (column1 != null) {
1071  0 data1 = column1.get(type);
1072    }
1073  0 if (column2 != null) {
1074  0 data2 = column2.get(type);
1075    }
1076   
1077  0 if (data1 != null && data1 instanceof String) {
1078  0 if (!((String) data1)
1079    .equals("kuali.resultComponentType.credit.degree.multiple")) {
1080  0 row.setShown(false);
1081    }
1082  0 } else if (data2 != null && data2 instanceof String) {
1083  0 if (!((String) data2)
1084    .equals("kuali.resultComponentType.credit.degree.multiple")) {
1085  0 row.setShown(false);
1086    }
1087    }
1088    }
1089    }
1090    });
1091  0 block.addSummaryMultiplicity(outcomesConfig);
1092   
1093  0 block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED,
1094    generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY)));
1095  0 block.addSummaryTableFieldRow(getFieldRow(
1096    COURSE + "/" + GRADING_OPTIONS,
1097    generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY)));
1098  0 block.addSummaryTableFieldRow(getFieldRow(
1099    COURSE + "/" + PASS_FAIL,
1100    generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY),
1101    true));
1102  0 block.addSummaryTableFieldRow(getFieldRow(
1103    COURSE + "/" + AUDIT,
1104    generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY),
1105    true));
1106  0 MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE
1107    + QueryPath.getPathSeparator() + FORMATS,
1108    LUUIConstants.FORMAT_LABEL_KEY, null);
1109  0 MultiplicityConfiguration activitiesConfig = getMultiplicityConfig(
1110    COURSE + QueryPath.getPathSeparator() + FORMATS
1111    + QueryPath.getPathSeparator()
1112    + QueryPath.getWildCard()
1113    + QueryPath.getPathSeparator() + ACTIVITIES,
1114    LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY, Arrays.asList(Arrays
1115    .asList(ACTIVITY_TYPE,
1116    LUUIConstants.ACTIVITY_TYPE_LABEL_KEY), Arrays
1117    .asList(CONTACT_HOURS + "/" + "unitQuantity",
1118    LUUIConstants.CONTACT_HOURS_LABEL_KEY), Arrays
1119    .asList(CONTACT_HOURS + "/" + "unitType", "per"),
1120    Arrays.asList(CreditCourseActivityConstants.DURATION
1121    + "/" + "atpDurationTypeKey",
1122    LUUIConstants.DURATION_TYPE_LABEL_KEY),
1123    Arrays.asList(CreditCourseActivityConstants.DURATION
1124    + "/" + "timeQuantity",
1125    LUUIConstants.DURATION_LITERAL_LABEL_KEY),
1126    Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE,
1127    LUUIConstants.CLASS_SIZE_LABEL_KEY)));
1128  0 formatsConfig.setNestedConfig(activitiesConfig);
1129  0 block.addSummaryMultiplicity(formatsConfig);
1130    // Fees
1131  0 MultiplicityConfiguration feesConfig = getMultiplicityConfig(
1132    COURSE + QueryPath.getPathSeparator() + FEES,
1133    LUUIConstants.FEE,
1134    Arrays.asList(Arrays.asList("rateType", "Rate Type"),
1135    Arrays.asList("feeType", "Fee Type")));
1136    // Note the use of empty string to remove the additional row from
1137    // display in the summary table
1138  0 MultiplicityConfiguration amountsConfig = getMultiplicityConfig(
1139    COURSE + QueryPath.getPathSeparator() + FEES
1140    + QueryPath.getPathSeparator()
1141    + QueryPath.getWildCard()
1142    + QueryPath.getPathSeparator() + "feeAmounts", "",
1143    Arrays.asList(Arrays.asList("currencyQuantity", "Amount")));
1144  0 feesConfig.setNestedConfig(amountsConfig);
1145  0 block.addSummaryMultiplicity(feesConfig);
1146    /*
1147    * block.addSummaryMultiplicity(getMultiplicityConfig(COURSE +
1148    * QueryPath.getPathSeparator() + CROSS_LISTINGS,
1149    * LUConstants.CROSS_LISTED_ITEM_LABEL_KEY, Arrays.asList(
1150    * Arrays.asList(SUBJECT_AREA, LUConstants.SUBJECT_CODE_LABEL_KEY),
1151    * Arrays.asList(COURSE_NUMBER_SUFFIX,
1152    * LUConstants.COURSE_NUMBER_LABEL_KEY))));
1153    * block.addSummaryMultiplicity(getMultiplicityConfig(COURSE +
1154    * QueryPath.getPathSeparator() + JOINTS,
1155    * LUConstants.JOINT_OFFER_ITEM_LABEL_KEY, Arrays.asList(
1156    * Arrays.asList(CreditCourseJointsConstants.COURSE_ID,
1157    * LUConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
1158    * block.addSummaryMultiplicity(getMultiplicityConfig(COURSE +
1159    * QueryPath.getPathSeparator() + VERSIONS,
1160    * LUConstants.VERSION_CODE_LABEL_KEY, Arrays.asList(
1161    * Arrays.asList("variationCode", LUConstants.VERSION_CODE_LABEL_KEY),
1162    * Arrays.asList("variationTitle", LUConstants.TITLE_LABEL_KEY))));
1163    */
1164  0 courseBriefSection.addSummaryTableFieldBlock(block);
1165  0 VerticalSectionView verticalSection = new VerticalSectionView(
1166    ViewCourseSections.BRIEF, "At a Glance", modelId, false);
1167  0 verticalSection.addSection(courseBriefSection);
1168   
1169  0 return verticalSection;
1170    }
1171   
 
1172  0 toggle public VerticalSectionView generateCourseCatalogSection() {
1173  0 VerticalSectionView verticalSection = new VerticalSectionView(
1174    ViewCourseSections.CATALOG, "Catalog View", modelId, false);
1175  0 FieldDescriptorReadOnly catalogField = new FieldDescriptorReadOnly("",
1176    null, null, new HTML());
1177  0 catalogField.hideLabel();
1178  0 catalogField.setWidgetBinding(new ModelWidgetBinding<HTML>() {
1179   
 
1180  0 toggle @Override
1181    public void setModelValue(HTML widget, DataModel model, String path) { //Don't place a breakpoint here: It will stall debugging for some unknown reason!
1182    // TODO Auto-generated method stub
1183   
1184    }
1185   
 
1186  0 toggle @Override
1187    public void setWidgetValue(HTML widget, DataModel model, String path) { //Don't place a breakpoint here: It will stall debugging for some unknown reason!
1188  0 String code = model.get("code");
1189  0 String title = model.get(COURSE + "/" + COURSE_TITLE);
1190  0 String credits = "";
1191  0 String outcomesKey = COURSE + QueryPath.getPathSeparator()
1192    + CREDIT_OPTIONS;
1193  0 Data outcomes = model.get(outcomesKey);
1194  0 if (outcomes != null) {
1195  0 Iterator<Property> iter = outcomes.realPropertyIterator();
1196  0 String list = "";
1197  0 ListToTextBinding binding = new ListToTextBinding();
1198  0 while (iter.hasNext()) {
1199  0 Property prop = iter.next();
1200  0 if (prop.getKey() instanceof Integer) {
1201  0 Integer number = (Integer) prop.getKey();
1202  0 Object value = outcomes.get(number);
1203  0 if (value instanceof Data) {
1204  0 list = list
1205    + binding.getStringList(model,
1206    outcomesKey + "/" + number
1207    + "/" + "resultValues")
1208    + ", ";
1209    }
1210    }
1211    }
1212   
1213  0 if (!list.isEmpty()) {
1214  0 list = list.trim();
1215  0 list = list.substring(0, list.length() - 1);
1216  0 credits = "(" + list + ")";
1217    }
1218    }
1219   
1220  0 String description = model.get(COURSE + "/"
1221    + PROPOSAL_DESCRIPTION + "/"
1222    + RichTextInfoConstants.PLAIN);
1223  0 String catalogText = "<b> " + code + " " + title + " "
1224    + credits + "</b> " + description + " ";
1225  0 catalogText.replace(" null ", "");
1226  0 catalogText.trim();
1227  0 widget.setHTML(catalogText);
1228   
1229    }
1230    });
1231  0 verticalSection.addField(catalogField);
1232   
1233  0 return verticalSection;
1234    }
1235   
 
1236  0 toggle public SummaryTableSection getTableSection() {
1237  0 return tableSection;
1238    }
1239    }
1240    // KSLAB-1940