Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.user.client.ui
Class LazyPanel

    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.SimplePanel
                      com.google.gwt.user.client.ui.LazyPanel

All Implemented Interfaces:
  HasAttachHandlers, HasHandlers, EventListener, AcceptsOneWidget, HasOneWidget, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IsWidget, java.lang.Iterable<Widget>

    public abstract class LazyPanel

extends SimplePanel

Convenience class to help lazy loading. The bulk of a LazyPanel is not instantiated until `setVisible(boolean)`(true) or `ensureWidget()` is called.

### Example

>     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);
>       }
>     }

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`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.SimplePanel
`widget`

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
`LazyPanel()`

Method Summary
`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.

Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
`add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget`

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, setWidth, sinkBitlessEvent, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LazyPanel

    public LazyPanel()

Method Detail

### createWidget

    protected abstract Widget createWidget()

  Create the widget contained within the `LazyPanel`.

  Returns:
    the lazy widget

### ensureWidget

    public void ensureWidget()

  Ensures that the widget has been created by calling `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.

### setVisible

    public void setVisible(boolean visible)

  Description copied from interface: `HasVisibility`
  Sets whether this object is visible.

  Specified by:
    `setVisible` in interface `HasVisibility`
  Overrides:
    `setVisible` in class `UIObject`
  Parameters:
    `visible` - `true` to show the object, `false` to hide it

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD