| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AbbrPanel |
|
| 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.user.client.DOM; | |
| 19 | import com.google.gwt.user.client.Element; | |
| 20 | import com.google.gwt.user.client.ui.ComplexPanel; | |
| 21 | import com.google.gwt.user.client.ui.Widget; | |
| 22 | ||
| 23 | public class AbbrPanel extends ComplexPanel { | |
| 24 | ||
| 25 | 0 | public AbbrPanel(String title, String className, String text){ |
| 26 | 0 | Element abbr = DOM.createElement("abbr"); |
| 27 | 0 | abbr.setTitle(title); |
| 28 | 0 | abbr.setClassName(className); |
| 29 | 0 | abbr.setInnerText(text); |
| 30 | 0 | this.setElement(abbr); |
| 31 | ||
| 32 | 0 | } |
| 33 | ||
| 34 | 0 | public AbbrPanel(String title, String className){ |
| 35 | 0 | Element abbr = DOM.createElement("abbr"); |
| 36 | 0 | abbr.setTitle(title); |
| 37 | 0 | abbr.setClassName(className); |
| 38 | 0 | this.setElement(abbr); |
| 39 | ||
| 40 | 0 | } |
| 41 | ||
| 42 | /** | |
| 43 | * Adds a new child widget to the panel. | |
| 44 | * | |
| 45 | * @param w the widget to be added | |
| 46 | */ | |
| 47 | @Override | |
| 48 | public void add(Widget w) { | |
| 49 | 0 | add(w, getElement()); |
| 50 | 0 | } |
| 51 | ||
| 52 | /** | |
| 53 | * Inserts a widget before the specified index. | |
| 54 | * | |
| 55 | * @param w the widget to be inserted | |
| 56 | * @param beforeIndex the index before which it will be inserted | |
| 57 | * @throws IndexOutOfBoundsException if <code>beforeIndex</code> is out of | |
| 58 | * range | |
| 59 | */ | |
| 60 | public void insert(Widget w, int beforeIndex) { | |
| 61 | 0 | insert(w, getElement(), beforeIndex, true); |
| 62 | 0 | } |
| 63 | ||
| 64 | ||
| 65 | public void setText(String text){ | |
| 66 | 0 | this.getElement().setInnerText(text); |
| 67 | 0 | } |
| 68 | } |