View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.lum.lu.ui.course.client.configuration;
17  
18  import java.util.List;
19  
20  import org.kuali.student.r2.common.dto.DtoConstants;
21  import org.kuali.student.r1.core.statement.dto.StatementTypeInfo;
22  import org.kuali.student.common.ui.client.configurable.mvc.layouts.TabMenuController;
23  import org.kuali.student.common.ui.client.mvc.Controller;
24  import org.kuali.student.common.ui.client.mvc.DataModelDefinition;
25  import org.kuali.student.lum.common.client.lu.LUUIConstants;
26  import org.kuali.student.lum.lu.assembly.data.client.constants.base.MetaInfoConstants;
27  import org.kuali.student.lum.lu.assembly.data.client.constants.base.RichTextInfoConstants;
28  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.AffiliatedOrgInfoConstants;
29  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseActivityConstants;
30  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseConstants;
31  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseCourseSpecificLOsConstants;
32  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseDurationConstants;
33  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseExpenditureInfoConstants;
34  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseFormatConstants;
35  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseJointsConstants;
36  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseLearningResultsConstants;
37  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseRevenueInfoConstants;
38  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.CreditCourseVersionsConstants;
39  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.FeeInfoConstants;
40  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.FeeInfoFixedRateFeeConstants;
41  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.LearningObjectiveConstants;
42  import org.kuali.student.lum.lu.assembly.data.client.constants.orch.SingleUseLoConstants;
43  import org.kuali.student.lum.lu.ui.course.client.controllers.ViewCourseController;
44  
45  import com.google.gwt.core.client.GWT;
46  import com.google.gwt.user.client.ui.Widget;
47  
48  
49  /**
50   * This is the configuration factory class for viewing a courss.
51   *
52   * @author Kuali Student Team
53   *
54   */
55  public class ViewCourseConfigurer
56  implements
57  CreditCourseConstants,
58  CreditCourseFormatConstants,
59  CreditCourseActivityConstants,
60  MetaInfoConstants,
61  CreditCourseDurationConstants,
62  FeeInfoConstants,
63  LearningObjectiveConstants,
64  CreditCourseCourseSpecificLOsConstants,
65  SingleUseLoConstants,
66  CreditCourseRevenueInfoConstants,
67  CreditCourseExpenditureInfoConstants,
68  AffiliatedOrgInfoConstants,
69  CreditCourseVersionsConstants,
70  CreditCourseJointsConstants,
71  RichTextInfoConstants,
72  FeeInfoFixedRateFeeConstants,
73  CreditCourseLearningResultsConstants
74  {
75  
76      public static final String COURSE_MODEL = "courseModel";
77  
78      //FIXME: [KSCOR-225] Temp paths waiting for DOL changes
79      private static final String STATEMENTS_PATH = "statements";
80      private static final String ID_TRANSLATION = "id-translation";
81      
82      public static final String CLU_PROPOSAL_MODEL = "courseProposalModel";
83  
84      //FIXME: [KSCOR-225] Initialize type and state from selected cluId
85      private String type = "Course";
86      private String state = DtoConstants.STATE_DRAFT;
87      private String groupName = LUUIConstants.COURSE_GROUP_NAME;
88  
89      private DataModelDefinition modelDefinition;
90      private List<StatementTypeInfo> stmtTypes;
91      private CourseSummaryConfigurer summaryConfigurer;
92  
93      public static enum ViewCourseSections{BRIEF, DETAILED, CATALOG}
94  
95      public void setModelDefinition(DataModelDefinition modelDefinition){
96          this.modelDefinition = modelDefinition;
97      }
98  
99      public void setStatementTypes(List<StatementTypeInfo> stmtTypes) {
100         this.stmtTypes = stmtTypes;
101     }
102 
103     public void generateLayout(ViewCourseController layoutController) {
104         groupName = LUUIConstants.COURSE_GROUP_NAME;
105 
106         //Summary
107         this.generateLayout(layoutController, CLU_PROPOSAL_MODEL);
108         layoutController.addContentWidget(layoutController.getStatusLabel());
109         Widget dropdown = layoutController.generateActionDropDown();
110         layoutController.addContentWidget(dropdown);
111         
112         //this.modelDefinition.getMetadata(path)
113         layoutController.addContentWidget(layoutController.getVersionHistoryWidget());
114         layoutController.showPrint(true);
115     }
116     
117     public void generateLayout(TabMenuController layoutController, String modelId) {
118         groupName = LUUIConstants.COURSE_GROUP_NAME;
119 
120         //Summary
121         summaryConfigurer = GWT.create(CourseSummaryConfigurer.class);
122         summaryConfigurer.init(type, state, groupName, modelDefinition, stmtTypes, 
123         		(Controller)layoutController, modelId);
124         layoutController.addTab(summaryConfigurer.generateCourseBriefSection(), "At a Glance");
125         layoutController.addTab(summaryConfigurer.generateCourseSummarySection(), "Detailed View");
126         layoutController.addTab(summaryConfigurer.generateCourseCatalogSection(), "Catalog View");
127         layoutController.setDefaultView(ViewCourseSections.BRIEF);
128         //layoutController.addContentWidget(layoutController.getStatusLabel());
129         //Widget dropdown = layoutController.generateActionDropDown();
130         //dropdown.addStyleName("KS-Workflow-DropDown");
131         //layoutController.addContentWidget(dropdown);
132 
133     }
134 
135     public CourseSummaryConfigurer getSummaryConfigurer() {
136         return summaryConfigurer;
137     }
138 }