GWT 2.4.0

com.google.gwt.user.client.ui
Class RenderablePanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by com.google.gwt.user.client.ui.RenderablePanel
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsRenderable, IsWidget, java.lang.Iterable<Widget>

public class RenderablePanel
extends ComplexPanel
implements IsRenderable

EXPERIMENTAL and subject to change. Do not use this in production code.

An IsRenderable version of HTMLPanel. This class is a stepping in our transition to the Renderable strategy. Eventually this functionality should be merged into HTMLPanel. The only reason this class doesn't extend HTMLPanel is because it doesn't provide any way to build the panel lazily (which is needed here).


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.IndexedPanel
IndexedPanel.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Field Summary
 Command detachedInitializationCallback
           
protected  SafeHtml html
           
 Command wrapInitializationCallback
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
RenderablePanel(SafeHtml safeHtml)
          Initializes the panel's HTML from a given SafeHtml object.
RenderablePanel(java.lang.String html)
          Creates an HTML panel with the specified HTML contents inside a DIV element.
 
Method Summary
 void add(Widget widget)
          Adds a child widget to the panel.
 void addAndReplaceElement(IsWidget widget, Element toReplace)
          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. use addAndReplaceElement(Widget, Element)
protected  SafeHtml getInnerHtml()
          Returns the HTML to be set as the innerHTML of the container.
protected  boolean isFullyInitialized()
          Whether the initilization of the panel is finished (i.e., the corresponding DOM element has been built).
 void logicalAdd(IsRenderable renderable)
          Adopts the given, but doesn't change anything about its DOM element.
 void performDetachedInitialization()
          Perform any initialization needed when the widget is not attached to the document.
 SafeHtml render(java.lang.String id)
           
 void render(java.lang.String id, SafeHtmlBuilder builder)
          Tells this object to render itself as HTML and append it to the given builder.
 Element resolvePotentialElement()
          EXPERIMENTAL and subject to change.
 void wrapElement(Element element)
          Replace the previous contents of the receiver with the given element, presumed to have been created via a previous call to IsRenderable.render(java.lang.String).
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
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, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

wrapInitializationCallback

public Command wrapInitializationCallback

detachedInitializationCallback

public Command detachedInitializationCallback

html

protected SafeHtml html
Constructor Detail

RenderablePanel

public RenderablePanel(java.lang.String html)
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. The actual element that will hold this HTML isn't initialized until it is needed.

Parameters:
html - the panel's HTML

RenderablePanel

public RenderablePanel(SafeHtml safeHtml)
Initializes the panel's HTML from a given SafeHtml object. Similar to #HTMLPanel(String)

Parameters:
safeHtml - the html to set.
Method Detail

add

public void add(Widget widget)
Adds a child widget to the panel.

Specified by:
add in interface HasWidgets
Overrides:
add in class Panel
Parameters:
widget - the widget to be added
See Also:
HasWidgets.add(Widget)

addAndReplaceElement

public final void addAndReplaceElement(Widget widget,
                                       Element toReplace)
Adds a child widget to the panel, replacing the HTML element.

Parameters:
widget - the widget to be added
toReplace - the element to be replaced by the widget

addAndReplaceElement

@Deprecated
public void addAndReplaceElement(Widget widget,
                                            Element toReplace)
Deprecated. use addAndReplaceElement(Widget, Element)

Adds a child widget to the panel, replacing the HTML element.

Parameters:
widget - the widget to be added
toReplace - the element to be replaced by the widget

addAndReplaceElement

public void addAndReplaceElement(IsWidget widget,
                                 Element toReplace)
Overloaded version for IsWidget.

See Also:
addAndReplaceElement(Widget,Element)

logicalAdd

public void logicalAdd(IsRenderable renderable)
Adopts the given, but doesn't change anything about its DOM element. Should only be used for widgets with elements that are children of this panel's element. No-op if called with an IsRenderable that isn't also IsWidget, but safe to call with such as a convenience.


performDetachedInitialization

public void performDetachedInitialization()
Description copied from interface: IsRenderable
Perform any initialization needed when the widget is not attached to the document. Assumed to be called after IsRenderable.wrapElement(com.google.gwt.dom.client.Element).

Specified by:
performDetachedInitialization in interface IsRenderable

render

public SafeHtml render(java.lang.String id)
Specified by:
render in interface IsRenderable
See Also:
TODO(rdcastro): Remove this once UiBinder doesn't rely on it anymore.

render

public void render(java.lang.String id,
                   SafeHtmlBuilder builder)
Description copied from interface: IsRenderable
Tells this object to render itself as HTML and append it to the given builder. The root element of the HTML must be identifies by the given id.

Specified by:
render in interface IsRenderable

resolvePotentialElement

public Element resolvePotentialElement()
Description copied from class: UIObject
EXPERIMENTAL and subject to change. Do not use this in production code.

To be overridden by IsRenderable subclasses that initialize themselves by by calling setElement(PotentialElement.build(this)).

The receiver must:

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.user.client.Element, com.google.gwt.user.client.Element).

Note that this method is normally called only on the top element of an IsRenderable tree. Children instead will receive IsRenderable.render(java.lang.String) and IsRenderable#wrap.

Overrides:
resolvePotentialElement in class UIObject
See Also:
PotentialElement, IsRenderable

wrapElement

public void wrapElement(Element element)
Description copied from interface: IsRenderable
Replace the previous contents of the receiver with the given element, presumed to have been created via a previous call to IsRenderable.render(java.lang.String). Assumes the element is attached to the document.

Specified by:
wrapElement in interface IsRenderable

getInnerHtml

protected SafeHtml getInnerHtml()
Returns the HTML to be set as the innerHTML of the container.


isFullyInitialized

protected boolean isFullyInitialized()
Whether the initilization of the panel is finished (i.e., the corresponding DOM element has been built).


GWT 2.4.0