Overview | Package | Class | Tree | Deprecated | Index | Help
| GWT 2.0.3
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:
  HasHandlers, EventListener, HasWidgets, 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`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

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`

Methods inherited from class com.google.gwt.user.client.ui.Panel
`adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, 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, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setWidth, toString, unsinkEvents`

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 class: `UIObject`
  Sets whether this object is visible.

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

Overview | Package | Class | Tree | Deprecated | Index | Help
| GWT 2.0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD