Coverage Report - org.kuali.student.common.ui.client.configurable.mvc.SectionTitle
 
Classes in this File Line Coverage Branch Coverage Complexity
SectionTitle
0%
0/33
0%
0/2
1.083
 
 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;
 17  
 
 18  
 import com.google.gwt.dom.client.Element;
 19  
 import com.google.gwt.user.client.DOM;
 20  
 import com.google.gwt.user.client.ui.ComplexPanel;
 21  
 import com.google.gwt.user.client.ui.Widget;
 22  
 
 23  
 /**
 24  
  * This is a description of what this class does - hjohnson don't forget to fill this in.
 25  
  *
 26  
  * @author Kuali Student Team (kuali-student@googlegroups.com)
 27  
  *
 28  
  */
 29  
 public class SectionTitle extends ComplexPanel {
 30  
 
 31  
 
 32  
 
 33  0
     private SectionTitle(Element e) {
 34  0
         this.setElement(e);
 35  0
     }
 36  
 
 37  
     public static SectionTitle generateEmptyTitle() {
 38  0
         return generateTitle(DOM.createSpan(), null);
 39  
     }
 40  
 
 41  
     public static SectionTitle generateH1Title(String titletext) {
 42  
 
 43  0
             Element headerElement = DOM.createElement("H1");
 44  0
             headerElement.setInnerText(titletext);
 45  0
         return generateTitle(headerElement, "KS-H1-Section-Title");
 46  
     }
 47  
 
 48  
     public static SectionTitle generateH2Title(String titletext) {
 49  
 
 50  0
             Element headerElement = DOM.createElement("H2");
 51  0
             headerElement.setInnerText(titletext);
 52  0
         return generateTitle(headerElement, "KS-H2-Section-Title");
 53  
     }
 54  
 
 55  
     public static SectionTitle generateH3Title(String titletext) {
 56  
 
 57  0
             Element headerElement = DOM.createElement("H3");
 58  0
             headerElement.setInnerText(titletext);
 59  0
         return generateTitle(headerElement, "KS-H3-Section-Title");
 60  
     }
 61  
 
 62  
     public static SectionTitle generateH4Title(String titletext) {
 63  
 
 64  0
             Element headerElement = DOM.createElement("H4");
 65  0
             headerElement.setInnerText(titletext);
 66  0
         return generateTitle(headerElement, "KS-H4-Section-Title");
 67  
     }
 68  
 
 69  
     public static SectionTitle generateH5Title(String titletext) {
 70  
 
 71  0
             Element headerElement = DOM.createElement("H5");
 72  0
             headerElement.setInnerText(titletext);
 73  0
         return generateTitle(headerElement, "KS-H5-Section-Title");
 74  
     }
 75  
 
 76  
     public static SectionTitle generateH6Title(String titletext) {
 77  
 
 78  0
             Element headerElement = DOM.createElement("H6");
 79  0
             headerElement.setInnerText(titletext);
 80  0
         return generateTitle(headerElement, "KS-H6-Section-Title");
 81  
     }
 82  
 
 83  
     private static SectionTitle generateTitle(Element header, String styleName) {
 84  0
             SectionTitle thisTitle = new SectionTitle(header);
 85  0
             thisTitle.addStyleName("KS-Section-Title");
 86  0
         if(styleName != null){
 87  0
                 thisTitle.addStyleName(styleName);
 88  
         }
 89  0
         return thisTitle;
 90  
     }
 91  
 
 92  
 /*    private static SectionTitle generateTitle(String text, String styleName) {
 93  
         SectionTitle thisTitle = new SectionTitle();
 94  
         thisTitle.setHTML(text);
 95  
         thisTitle.addStyleName(KS_SECTION_TITLE);
 96  
         if(styleName != null){
 97  
                 thisTitle.addStyleName(styleName);
 98  
         }
 99  
         return thisTitle;
 100  
     }*/
 101  
 
 102  
     public void setText(String text){
 103  0
             this.getElement().setInnerText(text);
 104  
             
 105  0
     }
 106  
     
 107  
     public void setHTML(String html){
 108  0
             this.getElement().setInnerHTML(html);
 109  0
     }
 110  
     
 111  
           /**
 112  
            * Adds a new child widget to the panel.
 113  
            * 
 114  
            * @param w the widget to be added
 115  
            */
 116  
           @Override
 117  
           public void add(Widget w) {
 118  0
             add(w, getElement());
 119  0
           }
 120  
 }
 121  
 
 122