Coverage Report - org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView
 
Classes in this File Line Coverage Branch Coverage Complexity
VerticalSectionView
0%
0/38
0%
0/16
2
 
 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  
     public VerticalSectionView() {
 35  0
         super();
 36  0
     }
 37  
 
 38  
     /**
 39  
      * Same as VerticalSectionView(Enum<?> viewEnum, String name, String modelId, true)
 40  
      */
 41  0
     public VerticalSectionView(Enum<?> viewEnum, String name, String modelId) {
 42  0
         init(viewEnum, name, modelId, true);
 43  0
     }
 44  
 
 45  
     /**
 46  
      * @param viewEnum Enumeration of this view - id used for navigation, history, and showing a view
 47  
      * @param name Name of this view - what this view is called in the breadcrumb
 48  
      * @param modelId id of the model to be used for this view when a requestModel call is made on its parent controller
 49  
      * @param showTitle if true, show the view's name as an H2 header
 50  
      */
 51  
     public VerticalSectionView(Enum<?> viewEnum, String name, String modelId, boolean showTitle) {
 52  0
         super(viewEnum, name);
 53  0
         this.modelId = modelId;
 54  0
         if (name != null && !name.isEmpty()) {
 55  0
             SectionTitle sectionTitle = SectionTitle.generateH2Title(getName());
 56  0
             if (showTitle) {
 57  0
                 layout = new VerticalFieldLayout(sectionTitle);
 58  
             } else {
 59  0
                 layout = new VerticalFieldLayout();
 60  
             }
 61  0
         } else {
 62  0
             layout = new VerticalFieldLayout();
 63  
         }
 64  0
         this.add(layout);
 65  0
     }
 66  
 
 67  
     /**
 68  
      * VerticalSectionView with a custom titleWidget defined
 69  
      * @param viewEnum
 70  
      * @param name
 71  
      * @param modelId
 72  
      * @param titleWidget
 73  
      */
 74  
     public VerticalSectionView(Enum<?> viewEnum, String name, String modelId, Widget titleWidget) {
 75  0
         super(viewEnum, name);
 76  0
         this.modelId = modelId;
 77  0
         layout = new VerticalFieldLayout(titleWidget);
 78  0
         this.add(layout);
 79  0
     }
 80  
 
 81  
     public void init(Enum<?> viewEnum, String name, String modelId, boolean showTitle) {
 82  0
         super.init(viewEnum, name);
 83  0
         this.modelId = modelId;
 84  0
         if (name != null && !name.isEmpty()) {
 85  0
             SectionTitle sectionTitle = SectionTitle.generateH2Title(getName());
 86  0
             if (showTitle) {
 87  0
                 layout = new VerticalFieldLayout(sectionTitle);
 88  
             } else {
 89  0
                 layout = new VerticalFieldLayout();
 90  
             }
 91  0
         } else {
 92  0
             layout = new VerticalFieldLayout();
 93  
         }
 94  0
         this.add(layout);
 95  0
     }
 96  
 
 97  
     /**
 98  
      * This updates the model
 99  
      *
 100  
      * @see org.kuali.student.common.ui.client.mvc.View#updateModel()
 101  
      */
 102  
     @Override
 103  
     @SuppressWarnings("unchecked")
 104  
     public void updateModel() {
 105  0
         if (model != null && isValidationEnabled()) {
 106  0
             super.updateModel(model);
 107  
         }
 108  0
     }
 109  
 
 110  
     @Override
 111  
     public void clear() {
 112  
         // TODO Auto-generated method stub
 113  0
     }
 114  
 
 115  
     public void setSectionTitle(String title) {
 116  0
         layout.setLayoutTitle(SectionTitle.generateH2Title(title));
 117  0
     }
 118  
 }