public class RootPanel extends AbsolutePanel
get()
.
Most applications will add widgets to the default root panel in their
EntryPoint.onModuleLoad()
methods.
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
InsertPanel.ForIsWidget
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Modifier and Type | Method and Description |
---|---|
void |
clear(boolean clearDom)
Deprecated.
Simply removing all DOM elements can cause issues with other elements in the page.
|
static void |
detachNow(Widget widget)
Marks a widget as detached and removes it from the detach list.
|
static void |
detachOnWindowClose(Widget widget)
Adds a widget to the detach list.
|
static RootPanel |
get()
Gets the default root panel.
|
static RootPanel |
get(String id)
Gets the root panel associated with a given browser element.
|
static Element |
getBodyElement()
Convenience method for getting the document's body element.
|
static boolean |
isInDetachList(Widget widget)
Determines whether the given widget is in the detach list.
|
add, add, add, getWidgetLeft, getWidgetTop, insert, insert, insert, remove, setWidgetPosition, setWidgetPositionImpl
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, 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
add
getWidgetIndex
getWidget, getWidgetCount, getWidgetIndex, remove
forEach, spliterator
public static void detachNow(Widget widget)
If an element belonging to a widget originally passed to
detachOnWindowClose(Widget)
has been removed from the document,
calling this method will cause it to be marked as detached immediately.
Failure to do so will keep the widget from being garbage collected until
the page is unloaded.
This method may only be called per widget, and only for widgets that were
originally passed to detachOnWindowClose(Widget)
.
widget
- the widget that no longer needs to be cleaned up when the
page closesdetachOnWindowClose(Widget)
public static void detachOnWindowClose(Widget widget)
This method must be called for all widgets that have no parent widgets.
These are most commonly RootPanels
, but can also be any
widget used to wrap an existing element on the page. Failing to do this may
cause these widgets to leak memory. This method is called automatically by
widgets' wrap methods (e.g.
Button.wrap(com.google.gwt.dom.client.Element)
).
This method may not be called on any widget whose element is contained in another widget. This is to ensure that the DOM and Widget hierarchies cannot get into an inconsistent state.
widget
- the widget to be cleaned up when the page closesdetachNow(Widget)
public static RootPanel get()
public static RootPanel get(String id)
id
- the id of the element to be wrapped with a root panel (
null
specifies the default instance, which wraps the
<body> element)null
if no such element was foundpublic static Element getBodyElement()
public static boolean isInDetachList(Widget widget)
widget
- the widget to be checkedtrue
if the widget is in the detach list@Deprecated public void clear(boolean clearDom)
By default Panel.clear()
will only remove children that are GWT widgets.
This method also provides the option to remove all children including the
non-widget DOM elements that are directly added (e.g. elements added via
getElement().appendChild(...)
.
clearDom
- if true
this method will also remove any DOM
elements that are not widgets.Copyright © 2016. All rights reserved.