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