Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SpanPanel |
|
| 1.0;1 |
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.element; | |
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 | public class SpanPanel extends ComplexPanel{ | |
24 | ||
25 | 0 | public SpanPanel(){ |
26 | 0 | setElement(DOM.createSpan()); |
27 | 0 | } |
28 | ||
29 | 0 | public SpanPanel(String text){ |
30 | 0 | Element span = DOM.createSpan(); |
31 | 0 | span.setInnerText(text); |
32 | 0 | setElement(span); |
33 | 0 | } |
34 | ||
35 | /** | |
36 | * Adds a new child widget to the panel. | |
37 | * | |
38 | * @param w the widget to be added | |
39 | */ | |
40 | @Override | |
41 | public void add(Widget w) { | |
42 | 0 | add(w, getElement()); |
43 | 0 | } |
44 | ||
45 | /** | |
46 | * Inserts a widget before the specified index. | |
47 | * | |
48 | * @param w the widget to be inserted | |
49 | * @param beforeIndex the index before which it will be inserted | |
50 | * @throws IndexOutOfBoundsException if <code>beforeIndex</code> is out of | |
51 | * range | |
52 | */ | |
53 | public void insert(Widget w, int beforeIndex) { | |
54 | 0 | insert(w, getElement(), beforeIndex, true); |
55 | 0 | } |
56 | ||
57 | public void setText(String text){ | |
58 | 0 | this.getElement().setInnerText(text); |
59 | 0 | } |
60 | ||
61 | public void setHTML(String html){ | |
62 | 0 | this.getElement().setInnerHTML(html); |
63 | 0 | } |
64 | ||
65 | } |