1
2
3
4
5
6
7
8
9
10
11
12
13
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
25
26
27
28
29 public class SectionTitle extends ComplexPanel {
30
31
32
33 private SectionTitle(Element e) {
34 this.setElement(e);
35 }
36
37 public static SectionTitle generateEmptyTitle() {
38 return generateTitle(DOM.createSpan(), null);
39 }
40
41 public static SectionTitle generateH1Title(String titletext) {
42
43 Element headerElement = DOM.createElement("H1");
44 headerElement.setInnerText(titletext);
45 return generateTitle(headerElement, "KS-H1-Section-Title");
46 }
47
48 public static SectionTitle generateH2Title(String titletext) {
49
50 Element headerElement = DOM.createElement("H2");
51 headerElement.setInnerText(titletext);
52 return generateTitle(headerElement, "KS-H2-Section-Title");
53 }
54
55 public static SectionTitle generateH3Title(String titletext) {
56
57 Element headerElement = DOM.createElement("H3");
58 headerElement.setInnerText(titletext);
59 return generateTitle(headerElement, "KS-H3-Section-Title");
60 }
61
62 public static SectionTitle generateH4Title(String titletext) {
63
64 Element headerElement = DOM.createElement("H4");
65 headerElement.setInnerText(titletext);
66 return generateTitle(headerElement, "KS-H4-Section-Title");
67 }
68
69 public static SectionTitle generateH5Title(String titletext) {
70
71 Element headerElement = DOM.createElement("H5");
72 headerElement.setInnerText(titletext);
73 return generateTitle(headerElement, "KS-H5-Section-Title");
74 }
75
76 public static SectionTitle generateH6Title(String titletext) {
77
78 Element headerElement = DOM.createElement("H6");
79 headerElement.setInnerText(titletext);
80 return generateTitle(headerElement, "KS-H6-Section-Title");
81 }
82
83 private static SectionTitle generateTitle(Element header, String styleName) {
84 SectionTitle thisTitle = new SectionTitle(header);
85 thisTitle.addStyleName("KS-Section-Title");
86 if(styleName != null){
87 thisTitle.addStyleName(styleName);
88 }
89 return thisTitle;
90 }
91
92 public void setText(String text){
93 this.getElement().setInnerText(text);
94
95 }
96
97 public void setHTML(String html){
98 this.getElement().setInnerHTML(html);
99 }
100
101
102
103
104
105
106 @Override
107 public void add(Widget w) {
108 add(w, getElement());
109 }
110 }
111
112