Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
VerticalSectionView |
|
| 1.8333333333333333;1.833 |
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.common.ui.client.configurable.mvc.views; | |
17 | ||
18 | import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; | |
19 | import org.kuali.student.common.ui.client.widgets.field.layout.layouts.VerticalFieldLayout; | |
20 | ||
21 | import com.google.gwt.user.client.ui.Widget; | |
22 | ||
23 | /** | |
24 | * The vertical layout implementation of SectionView. The ui layout behaves exactly the same as | |
25 | * VerticalSection. | |
26 | * | |
27 | * A model id can be passed in to specify a model this particular view uses. | |
28 | * | |
29 | * @author Brian Smith | |
30 | * | |
31 | */ | |
32 | public class VerticalSectionView extends SectionView { | |
33 | ||
34 | ||
35 | /** | |
36 | * Same as VerticalSectionView(Enum<?> viewEnum, String name, String modelId, true) | |
37 | */ | |
38 | public VerticalSectionView(Enum<?> viewEnum, String name, String modelId) { | |
39 | 0 | this(viewEnum, name, modelId, true); |
40 | 0 | } |
41 | ||
42 | /** | |
43 | * @param viewEnum Enumeration of this view - id used for navigation, history, and showing a view | |
44 | * @param name Name of this view - what this view is called in the breadcrumb | |
45 | * @param modelId id of the model to be used for this view when a requestModel call is made on its parent controller | |
46 | * @param showTitle if true, show the view's name as an H2 header | |
47 | */ | |
48 | public VerticalSectionView(Enum<?> viewEnum, String name, String modelId, boolean showTitle) { | |
49 | 0 | super(viewEnum, name); |
50 | 0 | this.modelId = modelId; |
51 | 0 | if (name != null && !name.isEmpty()) { |
52 | 0 | SectionTitle sectionTitle = SectionTitle.generateH2Title(getName()); |
53 | 0 | if (showTitle) { |
54 | 0 | layout = new VerticalFieldLayout(sectionTitle); |
55 | } else { | |
56 | 0 | layout = new VerticalFieldLayout(); |
57 | } | |
58 | 0 | } else { |
59 | 0 | layout = new VerticalFieldLayout(); |
60 | } | |
61 | 0 | this.add(layout); |
62 | 0 | } |
63 | ||
64 | /** | |
65 | * VerticalSectionView with a custom titleWidget defined | |
66 | * @param viewEnum | |
67 | * @param name | |
68 | * @param modelId | |
69 | * @param titleWidget | |
70 | */ | |
71 | public VerticalSectionView(Enum<?> viewEnum, String name, String modelId, Widget titleWidget) { | |
72 | 0 | super(viewEnum, name); |
73 | 0 | this.modelId = modelId; |
74 | 0 | layout = new VerticalFieldLayout(titleWidget); |
75 | 0 | this.add(layout); |
76 | 0 | } |
77 | ||
78 | /** | |
79 | * This updates the model | |
80 | * | |
81 | * @see org.kuali.student.common.ui.client.mvc.View#updateModel() | |
82 | */ | |
83 | @Override | |
84 | @SuppressWarnings("unchecked") | |
85 | public void updateModel() { | |
86 | 0 | if (model != null && isValidationEnabled()) { |
87 | 0 | super.updateModel(model); |
88 | } | |
89 | 0 | } |
90 | ||
91 | @Override | |
92 | public void clear() { | |
93 | // TODO Auto-generated method stub | |
94 | 0 | } |
95 | ||
96 | public void setSectionTitle(String title) { | |
97 | 0 | layout.setLayoutTitle(SectionTitle.generateH2Title(title)); |
98 | 0 | } |
99 | } |