public class HTMLPanel extends ComplexPanel
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
IndexedPanel.ForIsWidget
HasWidgets.ForIsWidget
eventsToSink
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
Constructor and Description |
---|
HTMLPanel(SafeHtml safeHtml)
Initializes the panel's HTML from a given
SafeHtml object. |
HTMLPanel(java.lang.String html)
Creates an HTML panel with the specified HTML contents inside a DIV
element.
|
HTMLPanel(java.lang.String tag,
java.lang.String html)
Creates an HTML panel whose root element has the given tag, and with the
specified HTML contents.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Widget widget)
Adds a child widget to the panel.
|
void |
add(Widget widget,
Element elem)
Adds a child widget to the panel, contained within an HTML
element.
|
void |
add(Widget widget,
java.lang.String id)
Adds a child widget to the panel, contained within the HTML element
specified by a given id.
|
void |
addAndReplaceElement(IsWidget widget,
Element toReplace)
Deprecated.
|
void |
addAndReplaceElement(IsWidget widget,
Element toReplace)
Overloaded version for IsWidget.
|
void |
addAndReplaceElement(IsWidget widget,
java.lang.String id)
Overloaded version for IsWidget.
|
void |
addAndReplaceElement(Widget widget,
Element toReplace)
Adds a child widget to the panel, replacing the HTML element.
|
void |
addAndReplaceElement(Widget widget,
Element toReplace)
Deprecated.
|
void |
addAndReplaceElement(Widget widget,
java.lang.String id)
Adds a child widget to the panel, replacing the HTML element specified by a
given id.
|
static java.lang.String |
createUniqueId()
A helper method for creating unique IDs for elements within dynamically-
generated HTML.
|
Element |
getElementById(java.lang.String id)
Finds an
element within this panel by its id. |
static HTMLPanel |
wrap(Element element)
Creates an HTML panel that wraps an existing element.
|
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, doLogicalClear, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
public HTMLPanel(java.lang.String html)
html
- the panel's HTMLpublic HTMLPanel(SafeHtml safeHtml)
SafeHtml
object.
Similar to HTMLPanel(String)
safeHtml
- the html to set.public HTMLPanel(java.lang.String tag, java.lang.String html)
tag
- the tag of the root elementhtml
- the panel's HTMLpublic static java.lang.String createUniqueId()
public static HTMLPanel wrap(Element element)
RootPanel.detachNow(Widget)
.element
- the element to be wrappedpublic void add(Widget widget)
add
in interface HasWidgets
add
in class Panel
widget
- the widget to be addedHasWidgets.add(Widget)
public void add(Widget widget, java.lang.String id)
widget
- the widget to be addedid
- the id of the element within which it will be containedpublic void add(Widget widget, Element elem)
add
in class ComplexPanel
widget
- the widget to be addedelem
- the element within which it will be containedpublic final void addAndReplaceElement(Widget widget, Element toReplace)
widget
- the widget to be addedtoReplace
- the element to be replaced by the widget@Deprecated public void addAndReplaceElement(Widget widget, Element toReplace)
addAndReplaceElement(Widget, Element)
widget
- the widget to be addedtoReplace
- the element to be replaced by the widget@Deprecated public void addAndReplaceElement(IsWidget widget, Element toReplace)
addAndReplaceElement(IsWidget, Element)
addAndReplaceElement(Widget,Element)
public void addAndReplaceElement(IsWidget widget, Element toReplace)
addAndReplaceElement(Widget,Element)
public void addAndReplaceElement(Widget widget, java.lang.String id)
widget
- the widget to be addedid
- the id of the element to be replaced by the widgetpublic void addAndReplaceElement(IsWidget widget, java.lang.String id)
addAndReplaceElement(Widget,String)
public Element getElementById(java.lang.String id)
element
within this panel by its id.
This method uses
Document.getElementById(String)
, so the
id must still be unique within the document.id
- the id of the element to be foundnull
if none is found