litesoft
@ 939
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
package org.litesoft.GWT.client.widgets; import org.litesoft.commonfoundation.annotations.*; import com.google.gwt.safehtml.shared.*; import com.google.gwt.user.client.*; import com.google.gwt.user.client.ui.*; public class SpanPanel extends ComplexPanel { /** * Creates an HTML panel based on a span. */ public SpanPanel() { setElement( DOM.createSpan() ); } /** * Creates an HTML panel with the specified HTML contents inside a span element. * * @param html the panel's HTML */ public SpanPanel( @Nullable String html ) { this(); /* * Normally would call this("div", html), but that method * has some slightly expensive IE defensiveness that we just * don't need for a div */ getElement().setInnerHTML( html ); } /** * Initializes the panel's HTML from a given {@link SafeHtml} object. * * @param safeHtml the html to set. */ public SpanPanel( @NotNull SafeHtml safeHtml ) { this( safeHtml.asString() ); } /** * Adds a child element to the panel. * * @param elem the element to add */ public void add( @Nullable com.google.gwt.dom.client.Element elem ) { if ( elem != null ) { getElement().appendChild( elem ); } } /** * Adds a child widget to the panel. * * @param widget the widget to be added */ @Override public void add( @Nullable Widget widget ) { if ( widget != null ) { add( widget, getElement() ); } } } |