Coverage Report - org.kuali.student.common.ui.client.widgets.field.layout.layouts.HeadedLayout
 
Classes in this File Line Coverage Branch Coverage Complexity
HeadedLayout
0%
0/26
0%
0/2
1.077
 
 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  
  * <p/>
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  * <p/>
 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  
  * <p/>
 15  
  *
 16  
  * Date: 14-Jul-2010
 17  
  * Time: 10:52:16 AM
 18  
  */
 19  
 package org.kuali.student.common.ui.client.widgets.field.layout.layouts;
 20  
 
 21  
 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
 22  
 import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonLayout;
 23  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.FieldElement;
 24  
 
 25  
 import com.google.gwt.event.dom.client.ClickHandler;
 26  
 import com.google.gwt.user.client.ui.FlowPanel;
 27  
 import com.google.gwt.user.client.ui.Widget;
 28  
 
 29  
 /**
 30  
  * This abstract class will create a layout with a header containing supplied text, a help action button
 31  
  * and optionally a delete action button.
 32  
  *
 33  
  * Method setLayoutTitle should be overridden in the subclass to set the correct html level of SectionTitle for that instance
 34  
  *
 35  
  */
 36  
 public abstract class HeadedLayout extends FieldLayout {
 37  0
     protected FlowPanel body = new FlowPanel();
 38  0
     protected VerticalFieldLayout verticalLayout = new VerticalFieldLayout();
 39  
     protected Header header;
 40  
     protected boolean updateable;
 41  
     protected SectionTitle title;
 42  
 
 43  
     public HeadedLayout( ){
 44  0
             super();
 45  0
                  this.hasValidation = true;
 46  0
                  this.add(body);
 47  
           
 48  0
     }
 49  
 
 50  
     protected abstract void buildHeader(String titleText, boolean updateable) ;
 51  
     
 52  
     public abstract void setLayoutTitle(SectionTitle layoutTitle) ;
 53  
 
 54  
 
 55  
         @Override
 56  
     public void addFieldToLayout(FieldElement field) {
 57  0
         verticalLayout.addField(field);
 58  
 
 59  0
     }
 60  
 
 61  
     @Override
 62  
     public void addLayoutToLayout(FieldLayout layout) {
 63  0
         verticalLayout.addLayoutToLayout(layout);
 64  
 
 65  0
     }
 66  
 
 67  
     @Override
 68  
     public void addWidgetToLayout(Widget widget) {
 69  0
         verticalLayout.addWidgetToLayout(widget);
 70  0
     }
 71  
 
 72  
     @Override
 73  
     public void removeFieldLayoutComponentFromLayout(
 74  
             FieldLayoutComponent component) {
 75  0
         verticalLayout.removeFieldLayoutComponentFromLayout(component);
 76  
 
 77  0
     }
 78  
 
 79  
     @Override
 80  
     public void removeWidgetFromLayout(Widget widget) {
 81  0
         verticalLayout.removeWidgetFromLayout(widget);
 82  0
     }
 83  
 
 84  
      @Override
 85  
     public void addButtonLayoutToLayout(ButtonLayout buttonLayout) {
 86  0
         if(buttonLayout != null){
 87  0
             body.add(buttonLayout);
 88  
         }
 89  
 
 90  0
     }
 91  
 
 92  
     public void addDeleteHandler(ClickHandler handler) {
 93  0
         getHeader().addDeleteHandler(handler);
 94  
 
 95  0
     }
 96  
 
 97  
     public Header getHeader() {
 98  0
         return header;
 99  
     }
 100  
 
 101  
     public void setHeader(Header header) {
 102  0
         this.header = header;
 103  0
     }
 104  
 
 105  
     public void setUpdateable(boolean updateable) {
 106  0
         this.updateable = updateable;
 107  0
     }
 108  
 
 109  
 
 110  
 
 111  
 }