public abstract class LazyPanel extends SimplePanel
setVisible(boolean)
(true) or ensureWidget()
is
called.
public class LazyPanelExample implements EntryPoint { private static class HelloLazyPanel extends LazyPanel { @Override protected Widget createWidget() { return new Label("Well hello there!"); } } public void onModuleLoad() { final Widget lazy = new HelloLazyPanel(); // Not strictly necessary, but keeps the empty outer div // from effecting layout before it is of any use lazy.setVisible(false); PushButton b = new PushButton("Click me"); b.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { lazy.setVisible(true); } }); RootPanel root = RootPanel.get(); root.add(b); root.add(lazy); } }
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasWidgets.ForIsWidget
widget
eventsToSink
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
Constructor and Description |
---|
LazyPanel() |
Modifier and Type | Method and Description |
---|---|
protected abstract Widget |
createWidget()
Create the widget contained within the
LazyPanel . |
void |
ensureWidget()
Ensures that the widget has been created by calling
createWidget()
if SimplePanel.getWidget() returns null . |
void |
setVisible(boolean visible)
Sets whether this object is visible.
|
add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
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, setWidth, sinkBitlessEvent, toString
protected abstract Widget createWidget()
LazyPanel
.public void ensureWidget()
createWidget()
if SimplePanel.getWidget()
returns null
. Typically it is not
necessary to call this directly, as it is called as a side effect of a
setVisible(true)
call.public void setVisible(boolean visible)
HasVisibility
setVisible
in interface HasVisibility
setVisible
in class UIObject
visible
- true
to show the object, false
to
hide it