public abstract class Composite extends Widget implements IsRenderable
The composite is useful for creating a single widget out of an aggregate of multiple other widgets contained in a single panel.
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
DEBUG_ID_PREFIX
Constructor and Description |
---|
Composite() |
Modifier and Type | Method and Description |
---|---|
void |
claimElement(Element element)
Replace the previous contents of the receiver with the given element,
presumed to have been created and stamped via a previous call to
IsRenderable.render(com.google.gwt.user.client.ui.RenderableStamper) . |
protected Widget |
getWidget()
Provides subclasses access to the topmost widget that defines this
composite.
|
void |
initializeClaimedElement()
Perform any initialization needed when the widget is not attached to
the document.
|
protected void |
initWidget(Widget widget)
Sets the widget to be wrapped by the composite.
|
boolean |
isAttached()
Determines whether this widget is currently attached to the browser's
document (i.e., there is an unbroken chain of widgets between this widget
and the underlying browser document).
|
protected void |
onAttach()
This method is called when a widget is attached to the browser's document.
|
void |
onBrowserEvent(Event event)
Fired whenever a browser event is received.
|
protected void |
onDetach()
This method is called when a widget is detached from the browser's
document.
|
SafeHtml |
render(RenderableStamper stamper) |
void |
render(RenderableStamper stamper,
SafeHtmlBuilder builder)
Tells this object to render itself as HTML and append it to the given builder.
|
protected Element |
resolvePotentialElement()
EXPERIMENTAL and subject to change.
|
protected void |
setWidget(Widget widget)
Deprecated.
Use
initWidget(Widget) instead |
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, 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, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
public void claimElement(Element element)
IsRenderable
IsRenderable.render(com.google.gwt.user.client.ui.RenderableStamper)
.claimElement
in interface IsRenderable
public void initializeClaimedElement()
IsRenderable
IsRenderable.claimElement(com.google.gwt.dom.client.Element)
.initializeClaimedElement
in interface IsRenderable
public boolean isAttached()
Widget
isAttached
in interface HasAttachHandlers
isAttached
in class Widget
true
if the widget is attachedpublic void onBrowserEvent(Event event)
EventListener
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
event
- the event receivedpublic SafeHtml render(RenderableStamper stamper)
render
in interface IsRenderable
TODO(rdcastro): Remove this once UiBinder doesn't rely on it anymore.
public void render(RenderableStamper stamper, SafeHtmlBuilder builder)
IsRenderable
render
in interface IsRenderable
protected Widget getWidget()
protected void initWidget(Widget widget)
Widget
methods on this object, or adding it
to a panel. This method may only be called once for a given composite.widget
- the widget to be wrappedprotected void onAttach()
Widget
This method is called when a widget is attached to the browser's document.
To receive notification after a Widget has been added to the document,
override the Widget.onLoad()
method or use Widget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler)
.
It is strongly recommended that you override Widget.onLoad()
or
Widget.doAttachChildren()
instead of this method to avoid inconsistencies
between logical and physical attachment states.
Subclasses that override this method must call
super.onAttach()
to ensure that the Widget has been attached
to its underlying Element.
onAttach
in class Widget
Widget.onLoad()
,
Widget.doAttachChildren()
protected void onDetach()
Widget
This method is called when a widget is detached from the browser's
document. To receive notification before a Widget is removed from the
document, override the Widget.onUnload()
method or use Widget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler)
.
It is strongly recommended that you override Widget.onUnload()
or
Widget.doDetachChildren()
instead of this method to avoid inconsistencies
between logical and physical attachment states.
Subclasses that override this method must call
super.onDetach()
to ensure that the Widget has been detached
from the underlying Element. Failure to do so will result in application
memory leaks due to circular references between DOM Elements and JavaScript
objects.
onDetach
in class Widget
Widget.onUnload()
,
Widget.doDetachChildren()
protected Element resolvePotentialElement()
UIObject
To be overridden by IsRenderable
subclasses that initialize
themselves by by calling
setElement(PotentialElement.build(this))
.
The receiver must:
Element
to replace its PotentialElement
#setElement()
with the new Element
This method is called when the receiver's element is about to be
added to a parent node, as a side effect of DOM.appendChild(com.google.gwt.dom.client.Element, com.google.gwt.dom.client.Element)
.
Note that this method is normally called only on the top element
of an IsRenderable tree. Children instead will receive IsRenderable.render(com.google.gwt.user.client.ui.RenderableStamper)
and IsRenderable.claimElement(Element)
.
resolvePotentialElement
in class UIObject
PotentialElement
,
IsRenderable
@Deprecated protected void setWidget(Widget widget)
initWidget(Widget)
insteadinitWidget(Widget)
.Copyright © 2018. All rights reserved.