Package com.google.gwt.user.client.ui
Class HTMLPanel
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.ComplexPanel
com.google.gwt.user.client.ui.HTMLPanel
- All Implemented Interfaces:
HasAttachHandlers
,HasHandlers
,EventListener
,HasVisibility
,HasWidgets
,HasWidgets.ForIsWidget
,IndexedPanel
,IndexedPanel.ForIsWidget
,IsWidget
,Iterable<Widget>
A panel that contains HTML, and which can attach child widgets to identified
elements within that HTML.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
-
Field Summary
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSink
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
Constructor Summary
ConstructorDescriptionInitializes the panel's HTML from a givenSafeHtml
object.Creates an HTML panel with the specified HTML contents inside a DIV element.Creates an HTML panel whose root element has the given tag, and with the specified HTML contents. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child widget to the panel.void
Adds a child widget to the panel, contained within an HTML element.void
Adds a child widget to the panel, contained within the HTML element specified by a given id.void
addAndReplaceElement
(IsWidget widget, Element toReplace) Overloaded version for IsWidget.void
addAndReplaceElement
(IsWidget widget, Element toReplace) Deprecated.void
addAndReplaceElement
(IsWidget widget, String id) Overloaded version for IsWidget.final 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, String id) Adds a child widget to the panel, replacing the HTML element specified by a given id.static String
A helper method for creating unique IDs for elements within dynamically- generated HTML.getElementById
(String id) Finds anelement
within this panel by its id.static HTMLPanel
Creates an HTML panel that wraps an existing element.Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, doLogicalClear, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
Methods inherited from class com.google.gwt.user.client.ui.Widget
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
Methods inherited from class com.google.gwt.user.client.ui.UIObject
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
HTMLPanel
Creates an HTML panel with the specified HTML contents inside a DIV element. Any element within this HTML that has a specified id can contain a child widget.- Parameters:
html
- the panel's HTML
-
HTMLPanel
Creates an HTML panel whose root element has the given tag, and with the specified HTML contents. Any element within this HTML that has a specified id can contain a child widget.- Parameters:
tag
- the tag of the root elementhtml
- the panel's HTML
-
-
Method Details
-
createUniqueId
A helper method for creating unique IDs for elements within dynamically- generated HTML. This is important because no two elements in a document should have the same id.- Returns:
- a new unique identifier
-
wrap
Creates an HTML panel that wraps an existing element. This element must already be attached to the document. If the element is removed from the document, you must callWidget.removeFromParent()
.- Parameters:
element
- the element to be wrapped
-
add
Adds a child widget to the panel.- Specified by:
add
in interfaceHasWidgets
- Overrides:
add
in classPanel
- Parameters:
widget
- the widget to be added- See Also:
-
add
Adds a child widget to the panel, contained within the HTML element specified by a given id.- Parameters:
widget
- the widget to be addedid
- the id of the element within which it will be contained
-
add
Adds a child widget to the panel, contained within an HTML element. It is up to the caller to ensure that the given element is a child of this panel's root element.- Overrides:
add
in classComplexPanel
- Parameters:
widget
- the widget to be addedelem
- the element within which it will be contained
-
addAndReplaceElement
Adds a child widget to the panel, replacing the HTML element.- Parameters:
widget
- the widget to be addedtoReplace
- the element to be replaced by the widget
-
addAndReplaceElement
Deprecated.Adds a child widget to the panel, replacing the HTML element.- Parameters:
widget
- the widget to be addedtoReplace
- the element to be replaced by the widget
-
addAndReplaceElement
Deprecated.Overloaded version for IsWidget.- See Also:
-
addAndReplaceElement
Overloaded version for IsWidget.- See Also:
-
addAndReplaceElement
Adds a child widget to the panel, replacing the HTML element specified by a given id.- Parameters:
widget
- the widget to be addedid
- the id of the element to be replaced by the widget
-
addAndReplaceElement
Overloaded version for IsWidget.- See Also:
-
getElementById
Finds anelement
within this panel by its id. This method usesDocument.getElementById(String)
, so the id must still be unique within the document.- Parameters:
id
- the id of the element to be found- Returns:
- the element with the given id, or
null
if none is found
-
addAndReplaceElement(IsWidget, Element)