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.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  public class VerticalSectionView extends SectionView {
24  
25  
26      public VerticalSectionView(Enum<?> viewEnum, String name, String modelId) {
27          this(viewEnum, name, modelId, true);
28      }
29  
30      public VerticalSectionView(Enum<?> viewEnum, String name, String modelId, boolean showTitle) {
31          super(viewEnum, name);
32          this.modelId = modelId;
33          if (name != null && !name.isEmpty()) {
34              SectionTitle sectionTitle = SectionTitle.generateH2Title(getName());
35              if (showTitle) {
36                  layout = new VerticalFieldLayout(sectionTitle);
37              } else {
38                  layout = new VerticalFieldLayout();
39              }
40          } else {
41              layout = new VerticalFieldLayout();
42          }
43          this.add(layout);
44      }
45  
46      public VerticalSectionView(Enum<?> viewEnum, String name, String programModelId, Widget titleWidget) {
47          super(viewEnum, name);
48          this.modelId = programModelId;
49          layout = new VerticalFieldLayout(titleWidget);
50          this.add(layout);
51      }
52  
53      /**
54       * This updates the model
55       *
56       * @see org.kuali.student.common.ui.client.mvc.View#updateModel()
57       */
58      @Override
59      @SuppressWarnings("unchecked")
60      public void updateModel() {
61          if (model != null && isValidationEnabled()) {
62              super.updateModel(model);
63          }
64      }
65  
66      @Override
67      public void clear() {
68          // TODO Auto-generated method stub
69      }
70  
71      public void setSectionTitle(String title) {
72          layout.setLayoutTitle(SectionTitle.generateH2Title(title));
73      }
74  }