litesoft
@ 630
litesoft / trunk / GWT_Sandbox / FormEngine / src / com / temp / client / foundation / widget / ClippingLabel.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
package com.temp.client.foundation.widget; import com.google.gwt.dom.client.Style; import com.temp.client.foundation.widget.input.support.*; import com.temp.shared.utils.SafeHtmlizer; /** * This Widget is a wrapper around a GWT HTML (Label). * * Its key features are: * <ul> * <li>Leading and trailing whitespace is removed</li> * <li>Text will be clipped</li> * </ul> */ public class ClippingLabel extends TextLabel { public ClippingLabel() { initWidget( htmlWidget ); htmlWidget.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN); } public ClippingLabel(String text) { this(); setText(text); } /** * @param text will NOT be null or have any leading/trailing whitespace */ @Override protected String normalizeHTML( String text ) { return SafeHtmlizer.getInstance().noEmpty(text); } } |