Coverage Report - org.kuali.student.lum.lu.ui.course.client.configuration.CourseSummaryConfigurer
 
Classes in this File Line Coverage Branch Coverage Complexity
CourseSummaryConfigurer
0%
0/257
0%
0/28
2.244
CourseSummaryConfigurer$1
0%
0/6
0%
0/4
2.244
CourseSummaryConfigurer$2
0%
0/3
N/A
2.244
CourseSummaryConfigurer$2$1
0%
0/6
0%
0/2
2.244
CourseSummaryConfigurer$2$1$1
0%
0/13
0%
0/2
2.244
CourseSummaryConfigurer$3
0%
0/3
N/A
2.244
CourseSummaryConfigurer$4
0%
0/13
0%
0/6
2.244
CourseSummaryConfigurer$5
0%
0/16
0%
0/22
2.244
CourseSummaryConfigurer$6
0%
0/11
0%
0/4
2.244
CourseSummaryConfigurer$7
0%
0/16
0%
0/22
2.244
CourseSummaryConfigurer$8
0%
0/29
0%
0/10
2.244
CourseSummaryConfigurer$EditHandler
0%
0/5
N/A
2.244
 
 1  
 package org.kuali.student.lum.lu.ui.course.client.configuration;
 2  
 
 3  
 import java.util.*;
 4  
 
 5  
 import org.kuali.student.common.ui.client.application.Application;
 6  
 import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptorReadOnly;
 7  
 import org.kuali.student.common.ui.client.configurable.mvc.binding.ListToTextBinding;
 8  
 import org.kuali.student.common.ui.client.configurable.mvc.binding.ModelWidgetBinding;
 9  
 import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController;
 10  
 import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityConfiguration;
 11  
 import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityFieldConfiguration;
 12  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.WarnContainer;
 13  
 import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
 14  
 import org.kuali.student.common.ui.client.mvc.*;
 15  
 import org.kuali.student.common.ui.client.widgets.KSButton;
 16  
 import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
 17  
 import org.kuali.student.common.ui.client.widgets.KSLabel;
 18  
 import org.kuali.student.common.ui.client.widgets.documenttool.DocumentList;
 19  
 import org.kuali.student.common.ui.client.widgets.documenttool.DocumentListBinding;
 20  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo;
 21  
 import org.kuali.student.common.ui.client.widgets.menus.KSListPanel;
 22  
 import org.kuali.student.common.ui.client.widgets.progress.BlockingTask;
 23  
 import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator;
 24  
 import org.kuali.student.common.ui.client.widgets.rules.SubrulePreviewWidget;
 25  
 import org.kuali.student.common.ui.client.widgets.table.summary.ShowRowConditionCallback;
 26  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableFieldBlock;
 27  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableFieldRow;
 28  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableSection;
 29  
 import org.kuali.student.core.assembly.data.Data;
 30  
 import org.kuali.student.core.assembly.data.Data.Property;
 31  
 import org.kuali.student.core.assembly.data.Metadata;
 32  
 import org.kuali.student.core.assembly.data.QueryPath;
 33  
 import org.kuali.student.core.statement.dto.StatementTreeViewInfo;
 34  
 import org.kuali.student.core.statement.dto.StatementTypeInfo;
 35  
 import org.kuali.student.core.validation.dto.ValidationResultInfo;
 36  
 import org.kuali.student.core.validation.dto.ValidationResultInfo.ErrorLevel;
 37  
 import org.kuali.student.core.workflow.ui.client.widgets.WorkflowEnhancedNavController;
 38  
 import org.kuali.student.lum.common.client.lo.TreeStringBinding;
 39  
 import org.kuali.student.lum.common.client.lu.LUUIConstants;
 40  
 import org.kuali.student.lum.common.client.widgets.AppLocations;
 41  
 import org.kuali.student.lum.lu.assembly.data.client.constants.base.AcademicSubjectOrgInfoConstants;
 42  
 import org.kuali.student.lum.lu.assembly.data.client.constants.base.MetaInfoConstants;
 43  
 import org.kuali.student.lum.lu.assembly.data.client.constants.base.RichTextInfoConstants;
 44  
 import org.kuali.student.lum.lu.assembly.data.client.constants.orch.*;
 45  
 import org.kuali.student.lum.lu.ui.course.client.configuration.CourseConfigurer.CourseSections;
 46  
 import org.kuali.student.lum.lu.ui.course.client.configuration.ViewCourseConfigurer.ViewCourseSections;
 47  
 import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController;
 48  
 import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsDataModel;
 49  
 import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsSummaryView;
 50  
 
 51  
 import com.google.gwt.core.client.GWT;
 52  
 import com.google.gwt.event.dom.client.ClickEvent;
 53  
 import com.google.gwt.event.dom.client.ClickHandler;
 54  
 import com.google.gwt.user.client.ui.Anchor;
 55  
 import com.google.gwt.user.client.ui.FlowPanel;
 56  
 import com.google.gwt.user.client.ui.HTML;
 57  
 import com.google.gwt.user.client.ui.Widget;
 58  
 import org.kuali.student.lum.lu.ui.course.client.requirements.HasRequirements;
 59  
 
 60  0
 public class CourseSummaryConfigurer implements
 61  
         CreditCourseProposalConstants,
 62  
         CreditCourseProposalInfoConstants,
 63  
         CreditCourseConstants,
 64  
         CreditCourseFormatConstants,
 65  
         CreditCourseActivityConstants,
 66  
         MetaInfoConstants,
 67  
         CreditCourseDurationConstants,
 68  
         FeeInfoConstants,
 69  
         LearningObjectiveConstants,
 70  
         AcademicSubjectOrgInfoConstants,
 71  
         AffiliatedOrgInfoConstants,
 72  
         CreditCourseRevenueInfoConstants,
 73  
         CreditCourseExpenditureInfoConstants
 74  
 {
 75  
     //Override paths for course and proposal so they are root
 76  
     public static final String PROPOSAL = "";
 77  
     public static final String COURSE = "";
 78  
     public static final String PROPOSAL_TITLE_PATH = "proposal/name";
 79  0
     private List<ValidationResultInfo> validationInfos = new ArrayList<ValidationResultInfo>();
 80  0
     private boolean showingValidation = false;
 81  
     private static final String OPTIONAL = "o";
 82  
 
 83  0
     protected String type = "course";
 84  0
     protected String state = "draft";
 85  
     protected String groupName;
 86  
     protected DataModelDefinition modelDefinition;
 87  
     private List<StatementTypeInfo> stmtTypes;
 88  
 
 89  
     private Controller controller;
 90  
     private SummaryTableSection tableSection;
 91  
     private String modelId;
 92  
 
 93  0
         private BlockingTask loadDataTask = new BlockingTask("Retrieving Data");
 94  
     
 95  
     private class EditHandler implements ClickHandler{
 96  
 
 97  
             Enum<?> view;
 98  
 
 99  0
             public EditHandler(Enum<?> view){
 100  0
                     this.view = view;
 101  0
             }
 102  
 
 103  
                 @Override
 104  
                 public void onClick(ClickEvent event) {
 105  0
                         controller.showView(view);
 106  0
                 }
 107  
     }
 108  
 
 109  
     public CourseSummaryConfigurer(String type, String state,
 110  0
             String groupName, DataModelDefinition modelDefinition, List<StatementTypeInfo> stmtTypes, Controller controller, String modelId) {
 111  0
         this.type = type;
 112  0
         this.state = state;
 113  0
         this.groupName = groupName;
 114  0
         this.modelDefinition = modelDefinition;
 115  0
         this.stmtTypes = stmtTypes;
 116  0
         this.controller = controller;
 117  0
         this.modelId = modelId;
 118  0
         tableSection = new SummaryTableSection((Controller)controller);
 119  0
     }
 120  
 
 121  
     protected VerticalSectionView initSectionView (Enum<?> viewEnum, String labelKey) {
 122  0
         VerticalSectionView section = new VerticalSectionView(viewEnum, getLabel(labelKey), modelId);
 123  0
         section.addStyleName(LUUIConstants.STYLE_SECTION);
 124  0
         return section;
 125  
     }
 126  
     protected String getLabel(String labelKey) {
 127  0
         return Application.getApplicationContext().getUILabel(groupName, type, state, labelKey);
 128  
     }
 129  
     protected MessageKeyInfo generateMessageInfo(String labelKey) {
 130  0
         return new MessageKeyInfo(groupName, type, state, labelKey);
 131  
     }
 132  
     protected SummaryTableFieldRow getFieldRow(String fieldKey, MessageKeyInfo messageKey) {
 133  0
         return getFieldRow(fieldKey, messageKey, null, null, null, null, false);
 134  
     }
 135  
     protected SummaryTableFieldRow getFieldRow(String fieldKey, MessageKeyInfo messageKey, boolean optional) {
 136  0
         return getFieldRow(fieldKey, messageKey, null, null, null, null, optional);
 137  
     }
 138  
 
 139  
     protected SummaryTableFieldRow getFieldRow(String fieldKey, MessageKeyInfo messageKey, Widget widget, Widget widget2, String parentPath, ModelWidgetBinding<?> binding, boolean optional) {
 140  0
         QueryPath path = QueryPath.concat(parentPath, fieldKey);
 141  0
         Metadata meta = modelDefinition.getMetadata(path);
 142  
 
 143  0
         FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly(path.toString(), messageKey, meta);
 144  0
         if (widget != null) {
 145  0
             fd.setFieldWidget(widget);
 146  
         }
 147  0
         if(binding != null){
 148  0
                 fd.setWidgetBinding(binding);
 149  
         }
 150  0
         fd.setOptional(optional);
 151  
 
 152  0
         FieldDescriptorReadOnly fd2 = new FieldDescriptorReadOnly(path.toString(), messageKey, meta);
 153  0
         if (widget2 != null) {
 154  0
             fd2.setFieldWidget(widget2);
 155  
         }
 156  0
         if(binding != null){
 157  0
                 fd2.setWidgetBinding(binding);
 158  
         }
 159  0
         fd2.setOptional(optional);
 160  
 
 161  0
         SummaryTableFieldRow fieldRow = new SummaryTableFieldRow(fd,fd2);
 162  
 
 163  0
         return fieldRow;
 164  
     }
 165  
 
 166  
         public VerticalSectionView generateProposalSummarySection(boolean canEditSections){
 167  0
         tableSection.setEditable(canEditSections);
 168  0
         tableSection.addSummaryTableFieldBlock(generateCourseInformationForProposal());
 169  0
         tableSection.addSummaryTableFieldBlock(generateGovernanceSection());
 170  0
         tableSection.addSummaryTableFieldBlock(generateCourseLogisticsSection());
 171  0
         tableSection.addSummaryTableFieldBlock(generateLearningObjectivesSection());
 172  0
         tableSection.addSummaryTableFieldBlock(generateRequirementsSection());
 173  0
         tableSection.addSummaryTableFieldBlock(generateActiveDatesSection());
 174  0
         tableSection.addSummaryTableFieldBlock(generateFeesSection());
 175  0
         tableSection.addSummaryTableFieldBlock(generateProposalDocumentsSection());
 176  
         
 177  0
         if(controller instanceof WorkflowEnhancedNavController){
 178  
                 final WarnContainer infoContainer1;
 179  
                 final WarnContainer infoContainer2;
 180  
 
 181  0
                 infoContainer1 = generateWorkflowWidgetContainer(((WorkflowEnhancedNavController)controller).getWfUtilities().getWorkflowActionsWidget());
 182  0
                 infoContainer2 = generateWorkflowWidgetContainer(((WorkflowEnhancedNavController)controller).getWfUtilities().getWorkflowActionsWidget());
 183  
 
 184  0
                 ((WorkflowEnhancedNavController)controller).getWfUtilities().addSubmitCallback(new Callback<Boolean>(){
 185  
 
 186  
                                 @Override
 187  
                                 public void exec(Boolean result) {
 188  0
                                         if(result){
 189  0
                                                 tableSection.setEditable(false);
 190  0
                                                 if(controller instanceof MenuSectionController){
 191  0
                                                         ((MenuSectionController) controller).removeMenuNavigation();
 192  
                                                 }
 193  
                                         }
 194  
 
 195  0
                                 }
 196  
                         });
 197  
                 //Override beforeShow for summary section here to allow for custom validation mechanism on the table
 198  0
                 VerticalSectionView verticalSection = new VerticalSectionView(CourseSections.SUMMARY, getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId){
 199  
                         @Override
 200  
                         public void beforeShow(final Callback<Boolean> onReadyCallback) {
 201  
 
 202  0
                                 super.beforeShow(new Callback<Boolean>(){
 203  
 
 204  
                                                 @Override
 205  
                                                 public void exec(final Boolean result) {
 206  0
                                                         if(result){
 207  
                                                                 //Make sure workflow actions and status updated before showing.
 208  0
                                                                 ((WorkflowEnhancedNavController)controller).getWfUtilities().refresh();
 209  
                                                                 
 210  
                                                                 //Show validation error if they exist
 211  0
                                                                 ((WorkflowEnhancedNavController)controller).getWfUtilities().doValidationCheck(new Callback<List<ValidationResultInfo>>(){
 212  
 
 213  
                                                                         @Override
 214  
                                                                         public void exec(
 215  
                                                                                         List<ValidationResultInfo> validationResult) {
 216  
                                                                                 //validationInfos = validationResult;
 217  0
                                                                                 tableSection.enableValidation(showingValidation);
 218  0
                                                                                 ErrorLevel isValid = tableSection.processValidationResults(validationResult, true);
 219  
 
 220  0
                                                                                 validationInfos = validationResult;
 221  0
                                                         if(isValid != ErrorLevel.ERROR){
 222  0
                                                                         infoContainer1.showWarningLayout(false);
 223  0
                                                                         infoContainer2.showWarningLayout(false);
 224  0
                                                                         ((WorkflowEnhancedNavController)controller).getWfUtilities().enableWorkflowActionsWidgets(true);
 225  
                                                         }
 226  
                                                         else{
 227  0
                                                                 infoContainer1.showWarningLayout(true);
 228  0
                                                                 infoContainer2.showWarningLayout(true);
 229  0
                                                                 ((WorkflowEnhancedNavController)controller).getWfUtilities().enableWorkflowActionsWidgets(false);
 230  
                                                         }
 231  0
                                                                                 onReadyCallback.exec(result);
 232  
 
 233  0
                                                                         }});
 234  
                                                         }
 235  
                                                         else{
 236  0
                                                                 onReadyCallback.exec(result);
 237  
                                                         }
 238  0
                                                 }});
 239  
 
 240  0
                         }
 241  
                 };
 242  
 
 243  0
                 verticalSection.addWidget(infoContainer1);
 244  0
                 verticalSection.addSection(tableSection);
 245  0
                 verticalSection.addWidget(infoContainer2);
 246  0
                 return verticalSection;
 247  
         }
 248  
         else{
 249  0
                 VerticalSectionView verticalSection = new VerticalSectionView(CourseSections.SUMMARY, getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId);
 250  0
                 verticalSection.addSection(tableSection);
 251  0
                 GWT.log("CourseSummaryConfigurer - Summary table needs a workflow controller to provide submit/validation mechanism");
 252  0
                 return verticalSection;
 253  
         }
 254  
 
 255  
 
 256  
     }
 257  
 
 258  
     private SummaryTableFieldBlock generateProposalDocumentsSection() {
 259  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 260  0
         block.addEditingHandler(new EditHandler(CourseSections.DOCUMENTS));
 261  0
         block.setTitle(getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY));
 262  0
             block.addSummaryTableFieldRow(getFieldRow("proposal/id", generateMessageInfo(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY),
 263  
                          new DocumentList(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE,false, false), new DocumentList(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE,false, false), null, new DocumentListBinding("proposal/id"), false));
 264  0
                 return block;
 265  
         }
 266  
 
 267  0
         private List<Anchor> validateLinks = new ArrayList<Anchor>();
 268  
     private WarnContainer generateWorkflowWidgetContainer(Widget w){
 269  0
             WarnContainer warnContainer = new WarnContainer();
 270  0
         warnContainer.add(w);
 271  0
         w.addStyleName("ks-button-spacing");
 272  0
         warnContainer.add(new KSButton("Return to Curriculum Management", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler(){
 273  
 
 274  
                         @Override
 275  
                         public void onClick(ClickEvent event) {
 276  0
                                 Application.navigate(AppLocations.Locations.CURRICULUM_MANAGEMENT.getLocation());
 277  0
                         }
 278  
                 }));
 279  
         //TODO use messages here
 280  0
         KSLabel label = new KSLabel("This proposal has missing fields.  ");
 281  0
         final String showText = "Show what's missing.";
 282  0
         final String hideText = "Hide error highlighting.";
 283  0
         final Anchor link = new Anchor(showText);
 284  0
         validateLinks.add(link);
 285  0
         link.addClickHandler(new ClickHandler(){
 286  
 
 287  
                         @Override
 288  
                         public void onClick(ClickEvent event) {
 289  0
                                 if(!showingValidation){
 290  0
                                         for(int i=0; i< validateLinks.size(); i++){
 291  0
                                                 validateLinks.get(i).setText(hideText);
 292  
                                         }
 293  0
                                         showingValidation = true;
 294  0
                                         tableSection.enableValidation(showingValidation);
 295  0
                                         tableSection.processValidationResults(validationInfos, true);
 296  
                                 }
 297  
                                 else{
 298  0
                                         for(int i=0; i< validateLinks.size(); i++){
 299  0
                                                 validateLinks.get(i).setText(showText);
 300  
                                         }
 301  0
                                         showingValidation = false;
 302  0
                                         tableSection.enableValidation(showingValidation);
 303  0
                                         tableSection.removeValidationHighlighting();
 304  
                                 }
 305  0
                         }
 306  
                 });
 307  0
         warnContainer.addWarnWidget(label);
 308  0
         warnContainer.addWarnWidget(link);
 309  0
         return warnContainer;
 310  
     }
 311  
 
 312  
         public VerticalSectionView generateCourseSummarySection(){
 313  0
         tableSection.setEditable(false);
 314  0
         tableSection.addSummaryTableFieldBlock(generateCourseInformation());
 315  0
         tableSection.addSummaryTableFieldBlock(generateGovernanceSection());
 316  0
         tableSection.addSummaryTableFieldBlock(generateCourseLogisticsSection());
 317  0
         tableSection.addSummaryTableFieldBlock(generateLearningObjectivesSection());
 318  0
         tableSection.addSummaryTableFieldBlock(generateRequirementsSection());
 319  0
         tableSection.addSummaryTableFieldBlock(generateActiveDatesSection());
 320  0
         tableSection.addSummaryTableFieldBlock(generateFeesSection());
 321  
 
 322  0
         VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.DETAILED, getLabel(LUUIConstants.SUMMARY_LABEL_KEY), modelId, false);
 323  0
         verticalSection.addSection(tableSection);
 324  
 
 325  0
         return verticalSection;
 326  
     }
 327  
 
 328  
         @SuppressWarnings("unchecked")
 329  
         public SummaryTableFieldBlock generateCourseInformationForProposal(){
 330  0
         SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 331  0
         block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
 332  0
         block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY));
 333  0
         block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH, generateMessageInfo(LUUIConstants.PROPOSAL_TITLE_LABEL_KEY)));
 334  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 335  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TRANSCRIPT_TITLE, generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY)));
 336  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA, generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY)));
 337  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_NUMBER_SUFFIX, generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 338  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS, generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null, null, null, new KeyListModelWigetBinding("personId"), false));
 339  
 
 340  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 341  
                         LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 342  
                         Arrays.asList(
 343  
                                 Arrays.asList(SUBJECT_AREA, LUUIConstants.SUBJECT_CODE_LABEL_KEY),
 344  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
 345  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 346  
                         LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 347  
                         Arrays.asList(
 348  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 349  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 350  
                         LUUIConstants.VERSION_CODE_LABEL_KEY,
 351  
                         Arrays.asList(
 352  
                                 Arrays.asList("variationCode", LUUIConstants.VERSION_CODE_LABEL_KEY),
 353  
                                 Arrays.asList("variationTitle", LUUIConstants.TITLE_LABEL_KEY))));
 354  
 
 355  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 356  0
         block.addSummaryTableFieldRow(getFieldRow("proposal/rationale", generateMessageInfo(LUUIConstants.PROPOSAL_RATIONALE_LABEL_KEY)));
 357  
 
 358  
 
 359  0
         return block;
 360  
     }
 361  
 
 362  
     public SummaryTableFieldBlock generateCourseInformation(){
 363  0
         SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 364  0
         block.addEditingHandler(new EditHandler(CourseSections.COURSE_INFO));
 365  0
         block.setTitle(getLabel(LUUIConstants.INFORMATION_LABEL_KEY));
 366  
         //block.addSummaryTableFieldRow(getFieldRow(PROPOSAL_TITLE_PATH, generateMessageInfo(LUConstants.PROPOSAL_TITLE_LABEL_KEY)));
 367  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 368  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TRANSCRIPT_TITLE, generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY)));
 369  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + SUBJECT_AREA, generateMessageInfo(LUUIConstants.SUBJECT_CODE_LABEL_KEY)));
 370  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_NUMBER_SUFFIX, generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 371  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + INSTRUCTORS, generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY), null, null, null, new KeyListModelWigetBinding("personId"), false));
 372  
 
 373  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 374  
                         LUUIConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 375  
                         Arrays.asList(
 376  
                                 Arrays.asList(SUBJECT_AREA, LUUIConstants.SUBJECT_CODE_LABEL_KEY),
 377  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUUIConstants.COURSE_NUMBER_LABEL_KEY))));
 378  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 379  
                         LUUIConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 380  
                         Arrays.asList(
 381  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUUIConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 382  0
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 383  
                         LUUIConstants.VERSION_CODE_LABEL_KEY,
 384  
                         Arrays.asList(
 385  
                                 Arrays.asList("variationCode", LUUIConstants.VERSION_CODE_LABEL_KEY),
 386  
                                 Arrays.asList("variationTitle", LUUIConstants.TITLE_LABEL_KEY))));
 387  
 
 388  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 389  
 
 390  0
         return block;
 391  
     }
 392  
 
 393  
     public SummaryTableFieldBlock generateGovernanceSection(){
 394  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 395  0
             block.addEditingHandler(new EditHandler(CourseSections.GOVERNANCE));
 396  0
         block.setTitle(getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY));
 397  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CAMPUS_LOCATIONS, generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY)));
 398  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CURRICULUM_OVERSIGHT_ORGS_, generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY)));
 399  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS, generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY)));
 400  0
         return block;
 401  
     }
 402  
 
 403  
     @SuppressWarnings("unchecked")
 404  
         public SummaryTableFieldBlock generateCourseLogisticsSection(){
 405  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 406  0
             block.addEditingHandler(new EditHandler(CourseSections.COURSE_LOGISTICS));
 407  0
         block.setTitle(getLabel(LUUIConstants.LOGISTICS_LABEL_KEY));
 408  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED, generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY)));
 409  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + GRADING_OPTIONS, generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY)));
 410  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.DURATION + "/" + "atpDurationTypeKey", generateMessageInfo(LUUIConstants.DURATION_TYPE_LABEL_KEY)));
 411  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.DURATION + "/" + "timeQuantity", generateMessageInfo(LUUIConstants.DURATION_QUANTITY_LABEL_KEY)));
 412  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PASS_FAIL, generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY)));
 413  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + AUDIT, generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY)));
 414  
 
 415  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.FINAL_EXAM, generateMessageInfo(LUUIConstants.FINAL_EXAM_STATUS_LABEL_KEY)));
 416  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CreditCourseConstants.FINAL_EXAM_RATIONALE, generateMessageInfo(LUUIConstants.FINAL_EXAM_RATIONALE_LABEL_KEY), true));
 417  
 
 418  
         //Outcomes
 419  0
         Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>();
 420  0
         ListToTextBinding resultValuesBinding = new ListToTextBinding();
 421  0
         customBindings.put("resultValues", resultValuesBinding);
 422  0
         String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 423  0
         MultiplicityConfiguration outcomesConfig = getMultiplicityConfig(outcomesKey,
 424  
                         LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY,
 425  
                         Arrays.asList(
 426  
                                 Arrays.asList(CreditCourseConstants.TYPE, LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY),
 427  
                                 Arrays.asList(CREDIT_OPTION_FIXED_CREDITS, LUUIConstants.CREDIT_VALUE_LABEL_KEY, OPTIONAL),
 428  
                                 Arrays.asList(CREDIT_OPTION_MIN_CREDITS, LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY, OPTIONAL),
 429  
                                 Arrays.asList(CREDIT_OPTION_MAX_CREDITS, LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY, OPTIONAL),
 430  
                                 Arrays.asList("resultValues", LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY, OPTIONAL)),
 431  
                                 customBindings);
 432  
 
 433  
         //Massive workaround for result values problem where we dont want to show them on certain selections,
 434  
         //in most cases you want to just use the optional flag and have it be based on empty/null data
 435  
         //but since this data is sometimes not empty/null when we dont want to show it, it requires a show
 436  
         //condition callback
 437  0
         tableSection.addShowRowCallback(new ShowRowConditionCallback(){
 438  
                         @Override
 439  
                         public void processShowConditions(SummaryTableFieldRow row,
 440  
                                         DataModel column1, DataModel column2) {
 441  0
                                 if(row.getFieldDescriptor1() != null &&
 442  
                                                 row.getFieldDescriptor1().getFieldKey().contains(CREDIT_OPTIONS) &&
 443  
                                                 row.getFieldDescriptor1().getFieldKey().contains("resultValues")){
 444  0
                                     String type = row.getFieldDescriptor1().getFieldKey().replace("resultValues", CreditCourseConstants.TYPE);
 445  0
                                     Object data1 = null;
 446  0
                                     Object data2 = null;
 447  0
                                     if(column1 != null){
 448  0
                                             data1 = column1.get(type);
 449  
                                     }
 450  0
                                     if(column2 != null){
 451  0
                                             data2 = column2.get(type);
 452  
                                     }
 453  
 
 454  0
                                     if(data1 != null && data1 instanceof String){
 455  0
                                             if(!((String)data1).equals("kuali.resultComponentType.credit.degree.multiple")){
 456  0
                                                     row.setShown(false);
 457  
                                             }
 458  
                                     }
 459  0
                                     else if(data2 != null && data2 instanceof String){
 460  0
                                             if(!((String)data2).equals("kuali.resultComponentType.credit.degree.multiple")){
 461  0
                                                     row.setShown(false);
 462  
                                             }
 463  
                                     }
 464  
                             }
 465  0
                         }
 466  
                 });
 467  
 
 468  0
         block.addSummaryMultiplicity(outcomesConfig);
 469  
 
 470  
         //Formats
 471  0
         MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS,
 472  
                         LUUIConstants.FORMAT_LABEL_KEY,
 473  
                         null);
 474  0
         MultiplicityConfiguration activitiesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS + QueryPath.getPathSeparator()
 475  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + ACTIVITIES,
 476  
                         LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY,
 477  
                         Arrays.asList(
 478  
                                 Arrays.asList(ACTIVITY_TYPE, LUUIConstants.ACTIVITY_TYPE_LABEL_KEY),
 479  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitQuantity", LUUIConstants.CONTACT_HOURS_LABEL_KEY),
 480  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitType", LUUIConstants.CONTACT_HOURS_FREQUENCY_LABEL_KEY),
 481  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "atpDurationTypeKey", LUUIConstants.DURATION_TYPE_LABEL_KEY),
 482  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "timeQuantity", LUUIConstants.DURATION_LITERAL_LABEL_KEY),
 483  
                                 Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE, LUUIConstants.CLASS_SIZE_LABEL_KEY)));
 484  0
         formatsConfig.setNestedConfig(activitiesConfig);
 485  0
         block.addSummaryMultiplicity(formatsConfig);
 486  
 
 487  0
         return block;
 488  
     }
 489  
 
 490  
     public SummaryTableFieldBlock generateLearningObjectivesSection(){
 491  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 492  0
             block.addEditingHandler(new EditHandler(CourseSections.LEARNING_OBJECTIVES));
 493  0
         block.setTitle(getLabel(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY));
 494  0
         SummaryTableFieldRow loRow = getFieldRow(COURSE + "/" + CreditCourseConstants.COURSE_SPECIFIC_LOS, generateMessageInfo(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY),
 495  
                         new KSListPanel(), new KSListPanel(), null, new TreeStringBinding(), false);
 496  0
         loRow.addContentCellStyleName("summaryTable-lo-cell");
 497  0
         block.addSummaryTableFieldRow(loRow);
 498  
 
 499  0
         return block;
 500  
     }
 501  
 
 502  
     public SummaryTableFieldBlock generateActiveDatesSection(){
 503  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 504  0
             block.addEditingHandler(new EditHandler(CourseSections.ACTIVE_DATES));
 505  0
         block.setTitle(getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY));
 506  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + START_TERM, generateMessageInfo(LUUIConstants.START_TERM_LABEL_KEY)));
 507  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + END_TERM, generateMessageInfo(LUUIConstants.END_TERM_LABEL_KEY)));
 508  
         //Probably wrong - checkbox
 509  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PILOT_COURSE, generateMessageInfo(LUUIConstants.PILOT_COURSE_LABEL_KEY)));
 510  0
         return block;
 511  
     }
 512  
 
 513  
     public SummaryTableFieldBlock generateFeesSection() {
 514  0
             SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 515  0
             block.addEditingHandler(new EditHandler(CourseSections.FINANCIALS));
 516  0
         block.setTitle(getLabel(LUUIConstants.FINANCIALS_LABEL_KEY));
 517  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + "feeJustification" + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.JUSTIFICATION_FEE)));
 518  
         //Fees
 519  0
         MultiplicityConfiguration feesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES,
 520  
                         LUUIConstants.FEE,
 521  
                         Arrays.asList(
 522  
                                 Arrays.asList("rateType", "Rate Type"),
 523  
                                 Arrays.asList("feeType", "Fee Type")));
 524  
         //Note the use of empty string to remove the additional row from display in the summary table
 525  0
         MultiplicityConfiguration amountsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES + QueryPath.getPathSeparator()
 526  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + "feeAmounts",
 527  
                         "",
 528  
                         Arrays.asList(
 529  
                                 Arrays.asList("currencyQuantity", "Amount")));
 530  0
                 feesConfig.setNestedConfig(amountsConfig);
 531  0
                 block.addSummaryMultiplicity(feesConfig);
 532  
 
 533  
                 //Revenue
 534  0
                 MultiplicityConfiguration revenueConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + "revenues",
 535  
                                 LUUIConstants.REVENUE,
 536  
                         Arrays.asList(
 537  
                                         Arrays.asList("affiliatedOrgs/0/orgId", "Organization"),
 538  
                                 Arrays.asList("affiliatedOrgs/0/percentage", "Percentage")));
 539  0
                 block.addSummaryMultiplicity(revenueConfig);
 540  
 
 541  
                 //Expenditure
 542  0
                 MultiplicityConfiguration expenditureConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + "expenditure"
 543  
                                 + QueryPath.getPathSeparator() + "affiliatedOrgs",
 544  
                                 LUUIConstants.EXPENDITURE,
 545  
                         Arrays.asList(
 546  
                                 Arrays.asList("orgId", "Organization"),
 547  
                                 Arrays.asList("percentage", "Percentage")));
 548  0
                 block.addSummaryMultiplicity(expenditureConfig);
 549  
 
 550  0
         return block;
 551  
         }
 552  
 
 553  
     public SummaryTableFieldBlock generateRequirementsSection(){
 554  
 
 555  0
             final SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 556  0
             block.addEditingHandler(new EditHandler(CourseSections.COURSE_REQUISITES));
 557  0
         block.setTitle(getLabel(LUUIConstants.REQUISITES_LABEL_KEY));
 558  
 
 559  
         //one row per requirement type
 560  0
         for (StatementTypeInfo stmtType : stmtTypes) {
 561  0
             SummaryTableFieldRow arow = new SummaryTableFieldRow(addRequisiteField(new FlowPanel(), stmtType), addRequisiteField(new FlowPanel(), stmtType));
 562  0
             block.addSummaryTableFieldRow(arow);
 563  0
         }
 564  
 
 565  0
         return block;
 566  
     }
 567  
 
 568  
     private FieldDescriptorReadOnly addRequisiteField(final FlowPanel panel, final StatementTypeInfo stmtType) {
 569  
 
 570  0
         final ModelWidgetBinding<FlowPanel> widgetBinding = new ModelWidgetBinding<FlowPanel>() {
 571  
 
 572  
             @Override
 573  
             public void setModelValue(FlowPanel panel, DataModel model, String path) {
 574  0
             }
 575  
 
 576  
             @Override
 577  
             public void setWidgetValue(final FlowPanel panel, DataModel model, String path) {
 578  0
                 panel.clear();
 579  0
                 if (controller instanceof HasRequirements) {
 580  0
                     HasRequirements requirementsController = (HasRequirements) controller;
 581  0
                     List<StatementTreeViewInfo> statementTreeViewInfos = requirementsController.getReqDataModel().getCourseReqInfo(stmtType.getId());
 582  0
                     for (StatementTreeViewInfo rule : statementTreeViewInfos) {
 583  0
                         SubrulePreviewWidget ruleWidget = new SubrulePreviewWidget(rule, true, CourseRequirementsSummaryView.getCluSetWidgetList(rule));
 584  0
                         panel.add(ruleWidget);
 585  0
                     }
 586  
                 }
 587  0
             }
 588  
         };
 589  
 
 590  0
         FieldDescriptorReadOnly requisiteField = new FieldDescriptorReadOnly(COURSE + "/" + CreditCourseConstants.ID, new MessageKeyInfo(stmtType.getName()), null, panel);
 591  0
         requisiteField.setWidgetBinding(widgetBinding);
 592  
 
 593  0
         return requisiteField;
 594  
     }
 595  
 
 596  
     private MultiplicityConfiguration getMultiplicityConfig(String path,
 597  
             String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels){
 598  0
             return getMultiplicityConfig(path, itemLabelMessageKey, fieldKeysAndLabels, null);
 599  
     }
 600  
 
 601  
         private MultiplicityConfiguration getMultiplicityConfig(String path,
 602  
             String itemLabelMessageKey, List<List<String>> fieldKeysAndLabels, Map<String, ModelWidgetBinding> customBindings){
 603  0
             QueryPath parentPath = QueryPath.concat(path);
 604  0
         MultiplicityConfiguration config = new MultiplicityConfiguration(MultiplicityConfiguration.MultiplicityType.TABLE,
 605  
                 MultiplicityConfiguration.StyleType.TOP_LEVEL_GROUP, modelDefinition.getMetadata(parentPath));
 606  0
         config.setItemLabel(getLabel(itemLabelMessageKey));
 607  0
         config.setUpdateable(false);
 608  0
         config.setShowHeaders(true);
 609  
 
 610  0
         FieldDescriptorReadOnly parentFd = buildFieldDescriptor(path, getLabel(itemLabelMessageKey), null);
 611  0
         config.setParent(parentFd);
 612  
 
 613  0
         if (fieldKeysAndLabels != null) {
 614  0
             for (List<String> fieldKeyAndLabel : fieldKeysAndLabels) {
 615  0
                     MultiplicityFieldConfiguration fd = buildMultiplicityFD(fieldKeyAndLabel.get(0),
 616  
                         fieldKeyAndLabel.get(1), parentPath.toString());
 617  0
                     if(fieldKeyAndLabel.size() == 3 && fieldKeyAndLabel.get(2).equals(OPTIONAL)){
 618  0
                             fd.setOptional(true);
 619  
                     }
 620  0
                     if(customBindings != null && customBindings.containsKey(fieldKeyAndLabel.get(0))){
 621  0
                             fd.setModelWidgetBinding(customBindings.get(fieldKeyAndLabel.get(0)));
 622  
                     }
 623  0
                 config.addFieldConfiguration(fd);
 624  0
             }
 625  
         }
 626  
 
 627  0
         return config;
 628  
     }
 629  
 
 630  
 
 631  
     //TODO next 3 methods below should be moved into some kind of multiplicity helper class
 632  
     private MultiplicityFieldConfiguration buildMultiplicityFD(
 633  
             String fieldKey, String labelKey, String parentPath) {
 634  
 
 635  0
         QueryPath fieldPath = QueryPath.concat(parentPath, QueryPath.getWildCard(), fieldKey);
 636  0
         Metadata meta = modelDefinition.getMetadata(fieldPath);
 637  
 
 638  0
         MultiplicityFieldConfiguration fd = new MultiplicityFieldConfiguration(
 639  
                 fieldPath.toString(), generateMessageInfo(labelKey), meta, null);
 640  
 
 641  
 
 642  0
         return fd;
 643  
 
 644  
     }
 645  
 
 646  
     private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey, String messageKey,String parentPath) {
 647  0
         return buildFieldDescriptor(fieldKey, messageKey, parentPath, null, null);
 648  
     }
 649  
 
 650  
     private FieldDescriptorReadOnly buildFieldDescriptor(String fieldKey, String messageKey, String parentPath, Widget widget, ModelWidgetBinding<?> binding) {
 651  
 
 652  0
         QueryPath path = QueryPath.concat(parentPath, fieldKey);
 653  0
         Metadata meta = modelDefinition.getMetadata(path);
 654  
 
 655  0
         FieldDescriptorReadOnly fd = new FieldDescriptorReadOnly(path.toString(), generateMessageInfo(messageKey), meta);
 656  0
         if (widget != null) {
 657  0
             fd.setFieldWidget(widget);
 658  
         }
 659  0
         if (binding != null) {
 660  0
             fd.setWidgetBinding(binding);
 661  
         }
 662  0
         return fd;
 663  
     }
 664  
 
 665  
         public VerticalSectionView generateCourseBriefSection() {
 666  0
                 SummaryTableSection courseBriefSection = new SummaryTableSection(controller);
 667  0
                 courseBriefSection.setEditable(false);
 668  0
                 SummaryTableFieldBlock block = new SummaryTableFieldBlock();
 669  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY)));
 670  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + "code", generateMessageInfo(LUUIConstants.COURSE_NUMBER_LABEL_KEY)));
 671  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + ADMIN_ORGS, generateMessageInfo(LUUIConstants.ADMIN_ORG_LABEL_KEY)));
 672  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY)));
 673  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CURRICULUM_OVERSIGHT_ORGS_, generateMessageInfo(LUUIConstants.ACADEMIC_SUBJECT_ORGS_KEY)));
 674  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + CAMPUS_LOCATIONS, generateMessageInfo(LUUIConstants.CAMPUS_LOCATION_LABEL_KEY)));
 675  
 
 676  0
         Map<String, ModelWidgetBinding> customBindings = new HashMap<String, ModelWidgetBinding>();
 677  0
         ListToTextBinding resultValuesBinding = new ListToTextBinding();
 678  0
         customBindings.put("resultValues", resultValuesBinding);
 679  0
         String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 680  0
         MultiplicityConfiguration outcomesConfig = getMultiplicityConfig(outcomesKey,
 681  
                         LUUIConstants.LEARNING_RESULT_OUTCOME_LABEL_KEY,
 682  
                         Arrays.asList(
 683  
                                 Arrays.asList(CreditCourseConstants.TYPE, LUUIConstants.LEARNING_RESULT_OUTCOME_TYPE_LABEL_KEY),
 684  
                                 Arrays.asList(CREDIT_OPTION_FIXED_CREDITS, LUUIConstants.CONTACT_HOURS_LABEL_KEY, OPTIONAL),
 685  
                                 Arrays.asList(CREDIT_OPTION_MIN_CREDITS, LUUIConstants.CREDIT_OPTION_MIN_CREDITS_LABEL_KEY, OPTIONAL),
 686  
                                 Arrays.asList(CREDIT_OPTION_MAX_CREDITS, LUUIConstants.CREDIT_OPTION_MAX_CREDITS_LABEL_KEY, OPTIONAL),
 687  
                                 Arrays.asList("resultValues", LUUIConstants.CREDIT_OPTION_FIXED_CREDITS_LABEL_KEY, OPTIONAL)),
 688  
                                 customBindings);
 689  
 
 690  
         //Massive workaround for result values problem where we dont want to show them on certain selections,
 691  
         //in most cases you want to just use the optional flag and have it be based on empty/null data
 692  
         //but since this data is sometimes not empty/null when we dont want to show it, it requires a show
 693  
         //condition callback
 694  0
         courseBriefSection.addShowRowCallback(new ShowRowConditionCallback(){
 695  
                         @Override
 696  
                         public void processShowConditions(SummaryTableFieldRow row,
 697  
                                         DataModel column1, DataModel column2) {
 698  0
                                 if(row.getFieldDescriptor1() != null &&
 699  
                                                 row.getFieldDescriptor1().getFieldKey().contains(CREDIT_OPTIONS) &&
 700  
                                                 row.getFieldDescriptor1().getFieldKey().contains("resultValues")){
 701  0
                                     String type = row.getFieldDescriptor1().getFieldKey().replace("resultValues", CreditCourseConstants.TYPE);
 702  0
                                     Object data1 = null;
 703  0
                                     Object data2 = null;
 704  0
                                     if(column1 != null){
 705  0
                                             data1 = column1.get(type);
 706  
                                     }
 707  0
                                     if(column2 != null){
 708  0
                                             data2 = column2.get(type);
 709  
                                     }
 710  
 
 711  0
                                     if(data1 != null && data1 instanceof String){
 712  0
                                             if(!((String)data1).equals("kuali.resultComponentType.credit.degree.multiple")){
 713  0
                                                     row.setShown(false);
 714  
                                             }
 715  
                                     }
 716  0
                                     else if(data2 != null && data2 instanceof String){
 717  0
                                             if(!((String)data2).equals("kuali.resultComponentType.credit.degree.multiple")){
 718  0
                                                     row.setShown(false);
 719  
                                             }
 720  
                                     }
 721  
                             }
 722  0
                         }
 723  
                 });
 724  0
         block.addSummaryMultiplicity(outcomesConfig);
 725  
 
 726  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + TERMS_OFFERED, generateMessageInfo(LUUIConstants.TERMS_OFFERED_LABEL_KEY)));
 727  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + GRADING_OPTIONS, generateMessageInfo(LUUIConstants.LEARNING_RESULT_ASSESSMENT_SCALE_LABEL_KEY)));
 728  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + PASS_FAIL, generateMessageInfo(LUUIConstants.LEARNING_RESULT_PASS_FAIL_LABEL_KEY), true));
 729  0
         block.addSummaryTableFieldRow(getFieldRow(COURSE + "/" + AUDIT, generateMessageInfo(LUUIConstants.LEARNING_RESULT_AUDIT_LABEL_KEY), true));
 730  0
         MultiplicityConfiguration formatsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS,
 731  
                         LUUIConstants.FORMAT_LABEL_KEY,
 732  
                         null);
 733  0
         MultiplicityConfiguration activitiesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FORMATS + QueryPath.getPathSeparator()
 734  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + ACTIVITIES,
 735  
                         LUUIConstants.ACTIVITY_LITERAL_LABEL_KEY,
 736  
                         Arrays.asList(
 737  
                                 Arrays.asList(ACTIVITY_TYPE, LUUIConstants.ACTIVITY_TYPE_LABEL_KEY),
 738  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitQuantity", LUUIConstants.CONTACT_HOURS_LABEL_KEY),
 739  
                                 Arrays.asList(CONTACT_HOURS + "/" + "unitType", "per"),
 740  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "atpDurationTypeKey", LUUIConstants.DURATION_TYPE_LABEL_KEY),
 741  
                                 Arrays.asList(CreditCourseActivityConstants.DURATION + "/" + "timeQuantity", LUUIConstants.DURATION_LITERAL_LABEL_KEY),
 742  
                                 Arrays.asList(DEFAULT_ENROLLMENT_ESTIMATE, LUUIConstants.CLASS_SIZE_LABEL_KEY)));
 743  0
         formatsConfig.setNestedConfig(activitiesConfig);
 744  0
         block.addSummaryMultiplicity(formatsConfig);
 745  
         //Fees
 746  0
         MultiplicityConfiguration feesConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES,
 747  
                         LUUIConstants.FEE,
 748  
                         Arrays.asList(
 749  
                                 Arrays.asList("rateType", "Rate Type"),
 750  
                                 Arrays.asList("feeType", "Fee Type")));
 751  
         //Note the use of empty string to remove the additional row from display in the summary table
 752  0
         MultiplicityConfiguration amountsConfig = getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + FEES + QueryPath.getPathSeparator()
 753  
                         + QueryPath.getWildCard() + QueryPath.getPathSeparator() + "feeAmounts",
 754  
                         "",
 755  
                         Arrays.asList(
 756  
                                 Arrays.asList("currencyQuantity", "Amount")));
 757  0
                 feesConfig.setNestedConfig(amountsConfig);
 758  0
                 block.addSummaryMultiplicity(feesConfig);
 759  
 /*        block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + CROSS_LISTINGS,
 760  
                         LUConstants.CROSS_LISTED_ITEM_LABEL_KEY,
 761  
                         Arrays.asList(
 762  
                                 Arrays.asList(SUBJECT_AREA, LUConstants.SUBJECT_CODE_LABEL_KEY),
 763  
                                 Arrays.asList(COURSE_NUMBER_SUFFIX, LUConstants.COURSE_NUMBER_LABEL_KEY))));
 764  
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + JOINTS,
 765  
                         LUConstants.JOINT_OFFER_ITEM_LABEL_KEY,
 766  
                         Arrays.asList(
 767  
                                 Arrays.asList(CreditCourseJointsConstants.COURSE_ID, LUConstants.COURSE_NUMBER_OR_TITLE_LABEL_KEY))));
 768  
         block.addSummaryMultiplicity(getMultiplicityConfig(COURSE + QueryPath.getPathSeparator() + VERSIONS,
 769  
                         LUConstants.VERSION_CODE_LABEL_KEY,
 770  
                         Arrays.asList(
 771  
                                 Arrays.asList("variationCode", LUConstants.VERSION_CODE_LABEL_KEY),
 772  
                                 Arrays.asList("variationTitle", LUConstants.TITLE_LABEL_KEY))));*/
 773  0
                 courseBriefSection.addSummaryTableFieldBlock(block);
 774  0
         VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.BRIEF, "At a Glance", modelId, false);
 775  0
         verticalSection.addSection(courseBriefSection);
 776  
 
 777  0
         return verticalSection;
 778  
         }
 779  
 
 780  
         public VerticalSectionView generateCourseCatalogSection() {
 781  0
                 VerticalSectionView verticalSection = new VerticalSectionView(ViewCourseSections.CATALOG, "Catalog View", modelId, false);
 782  0
                 FieldDescriptorReadOnly catalogField = new FieldDescriptorReadOnly("", null, null, new HTML());
 783  0
                 catalogField.hideLabel();
 784  0
                 catalogField.setWidgetBinding(new ModelWidgetBinding<HTML>(){
 785  
 
 786  
                         @Override
 787  
                         public void setModelValue(HTML widget, DataModel model, String path) {
 788  
                                 // TODO Auto-generated method stub
 789  
 
 790  0
                         }
 791  
 
 792  
                         @Override
 793  
                         public void setWidgetValue(HTML widget, DataModel model, String path) {
 794  0
                                 String code = model.get("code");
 795  0
                                 String title = model.get(COURSE + "/" + COURSE_TITLE);
 796  0
                                 String credits = "";
 797  0
                                 String outcomesKey = COURSE + QueryPath.getPathSeparator() + CREDIT_OPTIONS;
 798  0
                                 Data outcomes = model.get(outcomesKey);
 799  0
                                 if(outcomes !=null){
 800  0
                                         Iterator<Property> iter = outcomes.realPropertyIterator();
 801  0
                                         String list = "";
 802  0
                                         ListToTextBinding binding = new ListToTextBinding();
 803  0
                                         while(iter.hasNext()){
 804  0
                                                 Property prop = iter.next();
 805  0
                                                 if (prop.getKey() instanceof Integer){
 806  0
                                         Integer number = (Integer)prop.getKey();
 807  0
                                         Object value = outcomes.get(number);
 808  0
                                         if(value instanceof Data){
 809  0
                                                 list = list + binding.getStringList(model, outcomesKey + "/" + number +"/" + "resultValues") + ", ";
 810  
                                         }
 811  
                                 }
 812  0
                                         }
 813  
 
 814  0
                                         if(!list.isEmpty()){
 815  0
                                                 list = list.trim();
 816  0
                                                 list = list.substring(0, list.length() - 1);
 817  0
                                     credits = "(" + list + ")";
 818  
                             }
 819  
                                 }
 820  
 
 821  0
                                 String description = model.get(COURSE + "/" + PROPOSAL_DESCRIPTION + "/" + RichTextInfoConstants.PLAIN);
 822  0
                                 String catalogText = "<b> " + code + " " + title + " " + credits + "</b> " + description + " ";
 823  0
                                 catalogText.replace(" null ", "");
 824  0
                                 catalogText.trim();
 825  0
                                 widget.setHTML(catalogText);
 826  
 
 827  0
                         }
 828  
                 });
 829  0
                 verticalSection.addField(catalogField);
 830  
 
 831  0
                 return verticalSection;
 832  
         }
 833  
 }