Coverage Report - org.kuali.student.common.ui.client.widgets.field.layout.layouts.Header
 
Classes in this File Line Coverage Branch Coverage Complexity
Header
0%
0/28
0%
0/2
1.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.widgets.field.layout.layouts;
 17  
 
 18  
 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
 19  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrButton;
 20  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrButton.AbbrButtonType;
 21  
 
 22  
 import com.google.gwt.event.dom.client.ClickHandler;
 23  
 import com.google.gwt.user.client.ui.Composite;
 24  
 import com.google.gwt.user.client.ui.FlowPanel;
 25  
 
 26  
 public class Header extends Composite{
 27  0
         private FlowPanel header = new FlowPanel();
 28  
     private SectionTitle title;
 29  0
         private AbbrButton help = new AbbrButton(AbbrButtonType.HELP);
 30  0
         private AbbrButton delete = new AbbrButton(AbbrButtonType.DELETE);
 31  
     boolean updateable;
 32  
         
 33  0
         public Header(SectionTitle title, boolean updateable){
 34  0
                 this.title = title;
 35  0
         this.updateable = updateable;
 36  
 
 37  0
         FlowPanel actions = new FlowPanel();
 38  
         //actions.add(help);
 39  0
         if (updateable)
 40  0
                     actions.add(delete);
 41  
                 
 42  0
         header.add(title);
 43  0
                 header.add(actions);
 44  0
         FlowPanel clearDiv = new FlowPanel();
 45  0
         header.add(clearDiv);
 46  
                 
 47  0
                 clearDiv.setStyleName("clearboth");
 48  0
                 header.setStyleName("ks-form-bordered-header");
 49  0
                 actions.setStyleName("ks-form-header-title-actions");
 50  
 
 51  0
                 this.initWidget(header);
 52  0
         }
 53  
 
 54  
         public void addDeleteHandler(ClickHandler handler){
 55  0
                 delete.addClickHandler(handler);
 56  0
         }
 57  
         
 58  
         public void addHelpHandler(ClickHandler handler){
 59  0
                 help.addClickHandler(handler);
 60  0
         }
 61  
         
 62  
         public void setHeaderTitle(String title){
 63  0
                 this.title.setText(title);
 64  0
         }
 65  
         
 66  
         public void setHeaderTitle(SectionTitle title){
 67  0
                 header.remove(this.title);
 68  0
                 this.title = title;
 69  0
                 header.insert(title, 0);
 70  0
         }
 71  
 }