| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| KSLabel |
|
| 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; | |
| 17 | ||
| 18 | import org.kuali.student.common.ui.client.util.DebugIdUtils; | |
| 19 | ||
| 20 | import com.google.gwt.user.client.ui.Label; | |
| 21 | ||
| 22 | /** | |
| 23 | * KSLabel wraps gwt Label. This class provides most of the same functionality, but sets KS css styles | |
| 24 | * for its default look (for improved browser compatibility and customizability). | |
| 25 | * | |
| 26 | * @author Kuali Student Team | |
| 27 | * | |
| 28 | */ | |
| 29 | public class KSLabel extends Label{ | |
| 30 | /** | |
| 31 | * Creates an empty label. | |
| 32 | * | |
| 33 | */ | |
| 34 | public KSLabel(){ | |
| 35 | 0 | super(); |
| 36 | 0 | setupDefaultStyle(); |
| 37 | 0 | } |
| 38 | ||
| 39 | /** | |
| 40 | * Creates a label with the specified text. | |
| 41 | * | |
| 42 | * @param text the new label's text | |
| 43 | */ | |
| 44 | public KSLabel(String text){ | |
| 45 | 0 | super(text); |
| 46 | 0 | ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(text)); |
| 47 | 0 | setupDefaultStyle(); |
| 48 | 0 | } |
| 49 | ||
| 50 | /** | |
| 51 | * Creates a label with the specified text and sets the word wrap flag. | |
| 52 | * False will disable word wrap, otherwise word wrap will be enabled. | |
| 53 | * | |
| 54 | * @param text the new label's text | |
| 55 | * @param wordWrap false to disable word wrapping | |
| 56 | */ | |
| 57 | public KSLabel(String text, boolean wordWrap){ | |
| 58 | 0 | super(text, wordWrap); |
| 59 | 0 | ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(text)); |
| 60 | 0 | setupDefaultStyle(); |
| 61 | 0 | } |
| 62 | ||
| 63 | /** | |
| 64 | * This method sets the default style for labels. | |
| 65 | * | |
| 66 | */ | |
| 67 | private void setupDefaultStyle(){ | |
| 68 | 0 | addStyleName("KS-Label"); |
| 69 | //cant think of why you would need a default hover style for labels | |
| 70 | 0 | } |
| 71 | } |