View Javadoc

1   package org.kuali.student.lum.lu.ui.course.client.configuration;
2   
3   import org.kuali.student.common.dto.DtoConstants;
4   import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor;
5   import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
6   import org.kuali.student.common.ui.client.configurable.mvc.sections.Section;
7   import org.kuali.student.common.ui.client.configurable.mvc.sections.VerticalSection;
8   import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
9   import org.kuali.student.common.ui.client.mvc.View;
10  import org.kuali.student.lum.common.client.lu.LUUIConstants;
11  import org.kuali.student.lum.lu.assembly.data.client.constants.base.RichTextInfoConstants;
12  import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminWithoutVersionController;
13  import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController;
14  
15  /**
16   * This is the screen configuration and layout for the modify without version admin screens
17   * 
18   * @author Will
19   *
20   */
21  public class CourseAdminWithoutVersionConfigurer extends CourseProposalConfigurer{
22  
23      /**
24       * Sets up all the views, sections, and views of the CourseAdminController.  This should be called
25       * once for initialization and setup per CourseAdminController instance.
26       * 
27       * @param layout
28       */
29      @Override
30  	public void configure(final CourseProposalController layout) {
31      	type = "course";
32          state = DtoConstants.STATE_APPROVED;
33          nextState = DtoConstants.STATE_ACTIVE;
34          
35      	groupName = LUUIConstants.COURSE_GROUP_NAME;
36  
37      	layout.addView(generateCourseAdminView((CourseAdminWithoutVersionController)layout));
38      }
39  
40  	/**
41  	 * Configuration for the course admin screens
42  	 * 
43  	 * @return view 
44  	 */
45      protected View generateCourseAdminView(final CourseAdminWithoutVersionController layout) {
46          VerticalSectionView view = 
47          	new VerticalSectionView(CourseSections.COURSE_INFO, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), COURSE_PROPOSAL_MODEL, false);
48          view.addStyleName(LUUIConstants.STYLE_SECTION);
49  
50          // Create course admin sections
51          Section courseSection = generateCourseInfoSection(initSection(LUUIConstants.INFORMATION_LABEL_KEY)); 
52          Section governanceSection = generateGovernanceSection(initSection(LUUIConstants.GOVERNANCE_LABEL_KEY));
53          Section logisticsSection = generateCourseLogisticsSection(initSection(LUUIConstants.LOGISTICS_LABEL_KEY));
54          Section loSection = initSection(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY);
55          loSection.addSection(generateLearningObjectivesNestedSection());
56          Section activeDatesSection = generateActiveDatesSection(initSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY));
57          Section financialSection = generateFinancialsSection(initSection(LUUIConstants.FINANCIALS_LABEL_KEY));
58          
59          //Add course admin sections to view
60          view.addSection(courseSection);
61          view.addSection(governanceSection);
62          view.addSection(logisticsSection);        
63          view.addSection(loSection);        
64          view.addSection(activeDatesSection);
65          view.addSection(financialSection);
66          
67          //Add menu items for sections
68          String sections = getLabel(LUUIConstants.COURSE_SECTIONS);
69          layout.addMenu(sections);
70          layout.addMenuItemSection(sections, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), LUUIConstants.INFORMATION_LABEL_KEY, courseSection);
71          layout.addMenuItemSection(sections, getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY), LUUIConstants.GOVERNANCE_LABEL_KEY, governanceSection);
72          layout.addMenuItemSection(sections, getLabel(LUUIConstants.LOGISTICS_LABEL_KEY), LUUIConstants.LOGISTICS_LABEL_KEY, logisticsSection);
73          layout.addMenuItemSection(sections, getLabel(LUUIConstants.LEARNING_OBJECTIVE_LABEL_KEY), LUUIConstants.LEARNING_OBJECTIVE_LABEL_KEY, loSection);
74          layout.addMenuItemSection(sections, getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY), LUUIConstants.ACTIVE_DATES_LABEL_KEY, activeDatesSection);
75          layout.addMenuItemSection(sections, getLabel(LUUIConstants.FINANCIALS_LABEL_KEY), LUUIConstants.FINANCIALS_LABEL_KEY, financialSection);
76          
77          //Add buttons to top and bottom of view
78          layout.addButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton());
79          layout.addButtonForView(CourseSections.COURSE_INFO, layout.getActivateButton());
80          layout.addButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton());
81          layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton());        
82          layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getActivateButton());
83          layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton());    
84  
85          return view;
86  	}
87      
88      protected Section initSection(String labelKey){
89      	return initSection(SectionTitle.generateH2Title(getLabel(labelKey)), NO_DIVIDER);	    
90      }
91  
92      /**
93       * Override {@link CourseProposalConfigurer#generateCourseInfoSection(Section)} to remove configuration
94       * of proposal fields.
95       *  
96       */
97      @Override
98      public Section generateCourseInfoSection(Section section) {
99          addField(section, COURSE + "/" + COURSE_TITLE, generateMessageInfo(LUUIConstants.COURSE_TITLE_LABEL_KEY));
100         addField(section, COURSE + "/" + TRANSCRIPT_TITLE, generateMessageInfo(LUUIConstants.SHORT_TITLE_LABEL_KEY));
101         section.addSection(generateCourseNumberSection());
102     	FieldDescriptor instructorsFd = addField(section, COURSE + "/" + INSTRUCTORS, generateMessageInfo(LUUIConstants.INSTRUCTORS_LABEL_KEY));
103         instructorsFd.setWidgetBinding(new KeyListModelWigetBinding("personId"));
104 
105         section.addSection(generateDescriptionRationaleSection());
106         
107         return section;
108     }
109     
110     /**
111      * Override  {@link CourseProposalConfigurer#generateDescriptionRationaleSection()} to remove configuration of
112      * proposal fields.
113      * 
114      */
115     @Override
116     protected VerticalSection generateDescriptionRationaleSection() {
117         SectionTitle title = getH4Title(LUUIConstants.PROPOSAL_TITLE_SECTION_LABEL_KEY);
118         VerticalSection description = initSection(title, !WITH_DIVIDER);
119         title.setStyleName("cluProposalTitleSection");
120         addField(description, COURSE + "/" + DESCRIPTION + "/" + RichTextInfoConstants.PLAIN, generateMessageInfo(LUUIConstants.DESCRIPTION_LABEL_KEY));
121         return description;
122     }
123     
124 
125 }