Clover Coverage Report - Kuali Student 1.2.1-SNAPSHOT (Aggregated)
Coverage timestamp: Wed Nov 2 2011 04:03:58 EST
../../../../../../../../../img/srcFileCovDistChart0.png 42% of files have more coverage
86   237   16   6.14
4   159   0.19   14
14     1.14  
1    
Warning
  • The source file used to generate this report was changed after Clover generated coverage information. The coverage reported may not match the source lines. You should regenerate the coverage information and the report to ensure the files are in sync.
 
  CourseAdminConfigurer       Line # 35 86 0% 16 104 0% 0.0
 
No Tests
 
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.layouts.MenuSectionController;
6    import org.kuali.student.common.ui.client.configurable.mvc.sections.RequiredContainer;
7    import org.kuali.student.common.ui.client.configurable.mvc.sections.Section;
8    import org.kuali.student.common.ui.client.configurable.mvc.sections.VerticalSection;
9    import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
10    import org.kuali.student.common.ui.client.mvc.Callback;
11    import org.kuali.student.common.ui.client.mvc.Controller;
12    import org.kuali.student.common.ui.client.mvc.DataModelDefinition;
13    import org.kuali.student.common.ui.client.mvc.View;
14    import org.kuali.student.common.ui.client.widgets.KSButton;
15    import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
16    import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool;
17    import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool.EditMode;
18    import org.kuali.student.core.document.ui.client.widgets.documenttool.DocumentTool;
19    import org.kuali.student.lum.common.client.lu.LUUIConstants;
20    import org.kuali.student.lum.lu.ui.course.client.controllers.CourseAdminController;
21    import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController;
22    import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsViewController;
23   
24    import com.google.gwt.core.client.GWT;
25    import com.google.gwt.event.dom.client.ClickEvent;
26    import com.google.gwt.event.dom.client.ClickHandler;
27    import com.google.gwt.user.client.ui.Composite;
28   
29   
30    /**
31    * This is the screen configuration and layout for the create/modify admin screens
32    *
33    * @author Will
34    *
 
35    */
36    public class CourseAdminConfigurer extends CourseProposalConfigurer{
37   
38    protected CourseRequirementsViewController requisitesSection;
39   
40    private RequiredContainer requiredContainer = new RequiredContainer();
41   
42   
43    /**
44    * Sets up all the views, sections, and views of the CourseAdminController. This should be called
45    * once for initialization and setup per CourseAdminController instance.
46    *
47    * @param layout
 
48  0 toggle */
49  0 public void configure(final CourseProposalController layout) {
50  0 type = "course";
51  0 state = DtoConstants.STATE_DRAFT;
52    nextState = DtoConstants.STATE_ACTIVE;
53  0
54    groupName = LUUIConstants.COURSE_GROUP_NAME;
55  0
56  0 layout.addContentWidget(layout.getWfUtilities().getProposalStatusLabel());
57  0 if (modelDefinition.getMetadata().isCanEdit()) {
58  0 layout.addInfoWidget(requiredContainer);
59    layout.addView(generateCourseAdminView((CourseAdminController) layout));
60  0 } else {
61  0 CourseSummaryConfigurer summaryConfigurer = GWT.create(CourseSummaryConfigurer.class);
62  0 summaryConfigurer.init(type, state, groupName, (DataModelDefinition) modelDefinition, stmtTypes, (Controller) layout, COURSE_PROPOSAL_MODEL);
63  0 layout.removeMenuNavigation();
64  0 layout.addView(summaryConfigurer.generateProposalSummarySection(false));
65    final CommentTool commentTool = createCommentTool(layout);
66    commentTool.setEditMode(EditMode.VIEW_COMMENT);
67    }
68    }
69   
70    /**
71    * Configuration for the course admin screens
72    *
 
73  0 toggle * @return view
74  0 */
75    protected View generateCourseAdminView(final CourseAdminController layout) {
76  0 VerticalSectionView view =
77    new VerticalSectionView(CourseSections.COURSE_INFO, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), COURSE_PROPOSAL_MODEL, false);
78    view.addStyleName(LUUIConstants.STYLE_SECTION);
79  0
80  0 // Create course admin sections
81  0 Section courseSection = generateCourseInfoSection(initSection(LUUIConstants.INFORMATION_LABEL_KEY));
82  0 Section governanceSection = generateGovernanceSection(initSection(LUUIConstants.GOVERNANCE_LABEL_KEY));
83  0 Section logisticsSection = generateCourseLogisticsSection(initSection(LUUIConstants.LOGISTICS_LABEL_KEY));
84  0 Section loSection = initSection(LUUIConstants.LEARNING_OBJECTIVES_LABEL_KEY);
85  0 loSection.addSection(generateLearningObjectivesNestedSection());
86    Section activeDatesSection = generateActiveDatesSection(initSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY));
87    Section financialSection = generateFinancialsSection(initSection(LUUIConstants.FINANCIALS_LABEL_KEY));
88  0
89    //Create the requisite section
90    requisitesSection = new CourseRequirementsViewController(layout, getLabel(LUUIConstants.REQUISITES_LABEL_KEY), CourseSections.COURSE_REQUISITES, false, false);
91   
92  0 //Create the document upload section
93  0
94  0 documentTool = new DocumentTool(LUUIConstants.REF_DOC_RELATION_PROPOSAL_TYPE,CourseSections.DOCUMENTS, getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY));
95  0 documentTool.setModelDefinition((DataModelDefinition)modelDefinition);
96  0 documentTool.setController(layout);
97    documentTool.setTitle(getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY));
98  0 documentTool.addStyleName(LUUIConstants.STYLE_SECTION);
99   
100    createCommentTool(layout);
101   
102  0
103  0 //Add course admin sections to view
104  0 view.addSection(courseSection);
105  0 view.addSection(governanceSection);
106  0 view.addSection(logisticsSection);
107  0 view.addSection(loSection);
108  0 view.addSection(this.createHiddenRequisitesSection());
109  0 view.addView(requisitesSection);
110  0 view.addSection(LUUIConstants.ACTIVE_DATES_LABEL_KEY,activeDatesSection);
111    view.addSection(financialSection);
112    view.addView(documentTool);
113  0
114  0 //Add menu items for sections
115  0 String sections = getLabel(LUUIConstants.COURSE_SECTIONS);
116  0 layout.addMenu(sections);
117  0 layout.addMenuItemSection(sections, getLabel(LUUIConstants.INFORMATION_LABEL_KEY), LUUIConstants.INFORMATION_LABEL_KEY, courseSection.getLayout());
118  0 layout.addMenuItemSection(sections, getLabel(LUUIConstants.GOVERNANCE_LABEL_KEY), LUUIConstants.GOVERNANCE_LABEL_KEY, governanceSection.getLayout());
119  0 layout.addMenuItemSection(sections, getLabel(LUUIConstants.LOGISTICS_LABEL_KEY), LUUIConstants.LOGISTICS_LABEL_KEY, logisticsSection.getLayout());
120  0 layout.addMenuItemSection(sections, getLabel(LUUIConstants.LEARNING_OBJECTIVE_LABEL_KEY), LUUIConstants.LEARNING_OBJECTIVE_LABEL_KEY, loSection.getLayout());
121  0 layout.addMenuItemSection(sections, getLabel(LUUIConstants.REQUISITES_LABEL_KEY), LUUIConstants.REQUISITES_LABEL_KEY, requisitesSection);
122  0 layout.addMenuItemSection(sections, getLabel(LUUIConstants.ACTIVE_DATES_LABEL_KEY), LUUIConstants.ACTIVE_DATES_LABEL_KEY, activeDatesSection.getLayout());
123    layout.addMenuItemSection(sections, getLabel(LUUIConstants.FINANCIALS_LABEL_KEY), LUUIConstants.FINANCIALS_LABEL_KEY, financialSection.getLayout());
124    layout.addMenuItemSection(sections, getLabel(LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY), LUUIConstants.TOOL_DOCUMENTS_LABEL_KEY, documentTool);
125  0
126  0 //Add buttons to top and bottom of view
127  0 layout.addButtonForView(CourseSections.COURSE_INFO, layout.getApproveAndActivateButton());
128  0 layout.addButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton());
129  0 layout.addButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton());
130  0 layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getApproveAndActivateButton());
131    layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getSaveButton());
132    layout.addTopButtonForView(CourseSections.COURSE_INFO, layout.getCancelButton());
133  0
134  0 // Setup show/hide non-required fields configuration.
135    this.addDocToolLink();
136  0 requiredContainer.setMainSection(view);
137   
138    return view;
 
139  0 toggle }
140   
141  0 private CommentTool createCommentTool(final MenuSectionController layout) {
142  0 //Create and add the comment tool
143  0 final CommentTool commentTool = new CommentTool(CourseSections.COMMENTS, getLabel(LUUIConstants.TOOL_COMMENTS_LABEL_KEY), "kuali.comment.type.generalRemarks", "Proposal Comments");
144    commentTool.setController(layout);
 
145  0 toggle layout.addContentWidget(new KSButton("Comments", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() {
146   
147  0 @Override
148    public void onClick(ClickEvent event) {
149    commentTool.show();
150  0 }
151    }));
152    return commentTool;
153    }
154   
155    /**
156    * Gets the requisite view associated with the CourseAdminConfigurer
157    *
158    * @param layout
 
159  0 toggle * @return The requisite view used by this configurer
160  0 */
161    public CourseRequirementsViewController getRequisitesSection() {
162    return requisitesSection;
163    }
164   
165    /**
166    * Gets the Document Tool View associated with the CourseAdminConfigurer
167    *
168    * @param layout
 
169  0 toggle * @return The DocumentTool used by this configurer
170  0 */
171    public DocumentTool getDocumentTool() {
172    return documentTool;
 
173  0 toggle }
174  0
175    protected VerticalSection initSection(String labelKey) {
176  0 final VerticalSection section = initSection(SectionTitle.generateH2Title(getLabel(labelKey)), NO_DIVIDER);
177    // Add Show All Link on the sections.
 
178  0 toggle section.addShowAllLink(requiredContainer.createShowAllLink(new ClickHandler() {
179   
180  0 @Override
181  0 public void onClick(ClickEvent event) {
182    requiredContainer.processInnerSection(section, true);
183    section.getShowAllLink().setVisible(false);
184    }
185  0 }));
186   
187    return section;
 
188  0 toggle }
189  0
190    private VerticalSection createHiddenRequisitesSection() {
191  0 final VerticalSection section = initSection(SectionTitle.generateH2Title(getLabel(LUUIConstants.REQUISITES_LABEL_KEY)), NO_DIVIDER);
192    // Add Show All Link on the sections.
 
193  0 toggle section.addShowAllLink(requiredContainer.createShowAllLink(new ClickHandler() {
194   
195  0 @Override
196  0 public void onClick(ClickEvent event) {
197  0 requisitesSection.asWidget().setVisible(true);
198    section.getLayout().setVisible(false);
199    section.setSectionId(LUUIConstants.REQUISITES_LABEL_KEY + "_Hidden");
200    }
201    }));
202  0
203    // Setup show/hide non-required fields configuration.
 
204  0 toggle requiredContainer.addCallback(new Callback<Boolean>() {
205   
206  0 @Override
207  0 public void exec(Boolean result) {
208  0 requisitesSection.asWidget().setVisible(result);
209  0 section.getLayout().setVisible(!result);
210    if (result) {
211  0 section.setSectionId(LUUIConstants.REQUISITES_LABEL_KEY + "_Hidden");
212    } else {
213    section.setSectionId(LUUIConstants.REQUISITES_LABEL_KEY);
214    }
215  0 }
216    });
217    return section;
 
218  0 toggle }
219  0
220    private void addDocToolLink(){
 
221  0 toggle Composite container = requiredContainer.createShowAllLink(new ClickHandler() {
222   
223  0 @Override
224    public void onClick(ClickEvent event) {
225    documentTool.showShowAllLink(false);
226    }
227    });
228  0
229    // Setup show/hide non-required fields configuration.
 
230  0 toggle requiredContainer.addCallback(new Callback<Boolean>() {
231   
232  0 @Override
233    public void exec(Boolean result) {
234    documentTool.showShowAllLink(!result);
235  0 }
236    });
237    documentTool.setShowAllLink(container);
238    }
239    }