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.SectionTitle;
5   import org.kuali.student.common.ui.client.configurable.mvc.sections.Section;
6   import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
7   import org.kuali.student.common.ui.client.mvc.View;
8   import org.kuali.student.lum.common.client.lu.LUUIConstants;
9   import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminController;
10  import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController;
11  
12  /**
13   * This is the screen configuration and layout for the create/modify admin screens
14   * 
15   * @author Will
16   *
17   */
18  public class CourseAdminConfigurer extends CourseProposalConfigurer{
19  
20      /**
21       * Sets up all the views, sections, and views of the CourseAdminController.  This should be called
22       * once for initialization and setup per CourseAdminController instance.
23       * 
24       * @param layout
25       */
26      public void configure(final CourseProposalController layout) {
27      	type = "course";
28          state = DtoConstants.STATE_DRAFT;
29          nextState = DtoConstants.STATE_APPROVED;
30          
31      	groupName = LUUIConstants.COURSE_GROUP_NAME;
32  
33      	if (modelDefinition.getMetadata().isCanEdit()) {
34              layout.addView(generateCourseAdminView((CourseAdminController)layout));
35      	}
36      }
37  
38  	/**
39  	 * Configuration for the course admin screens
40  	 * 
41  	 * @return view 
42  	 */
43      protected View generateCourseAdminView(final CourseAdminController layout) {
44          VerticalSectionView view = 
45          	new VerticalSectionView(CourseSections.COURSE_INFO, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), COURSE_PROPOSAL_MODEL, false);
46          view.addStyleName(LUUIConstants.STYLE_SECTION);
47  
48          // Create course admin sections
49          Section courseSection = generateCourseInfoSection(initSection(LUUIConstants.INFORMATION_LABEL_KEY)); 
50          Section governanceSection = generateGovernanceSection(initSection(LUUIConstants.GOVERNANCE_LABEL_KEY));
51          Section logisticsSection = generateCourseLogisticsSection(initSection(LUUIConstants.LOGISTICS_LABEL_KEY));
52          Section loSection = initSection(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY);
53          loSection.addSection(generateLearningObjectivesNestedSection());
54          Section activeDatesSection = generateActiveDatesSection(initSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY));
55          Section financialSection = generateFinancialsSection(initSection(LUUIConstants.FINANCIALS_LABEL_KEY));
56          
57          
58          //Add course admin sections to view
59          view.addSection(courseSection);
60          view.addSection(governanceSection);
61          view.addSection(logisticsSection);
62          view.addView(generateCourseRequisitesSection(layout,false));//Test if requisites are added correctly
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.getApproveAndActivateButton());
79          layout.addButtonForView(CourseSections.COURSE_INFO, layout.getApproveButton());
80          layout.addButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton());
81          layout.addButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton());
82          layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getApproveAndActivateButton());
83          layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getApproveButton());
84          layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton());        
85          layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton());    
86  
87          return view;
88  	}
89      
90      protected Section initSection(String labelKey){
91      	return initSection(SectionTitle.generateH2Title(getLabel(labelKey)), NO_DIVIDER);	    
92      }
93  }