com.google.gwt.widgetideas.client
Class LazyPanel<T extends com.google.gwt.user.client.ui.Widget>

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.SimplePanel
                  extended by com.google.gwt.widgetideas.client.LazyPanel<T>
Type Parameters:
T - widget type
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets

public abstract class LazyPanel<T extends com.google.gwt.user.client.ui.Widget>
extends com.google.gwt.user.client.ui.SimplePanel

Convenience class to help lazy loading. A LazyPanel is only actually rendered when setVisible(true) or ensureWidget is called.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
LazyPanel()
           
 
Method Summary
static void addTabListener(com.google.gwt.user.client.ui.TabPanel panel)
          Adds a tab listener to ensure that any LazyPanel instances are loaded when a tab panel selects the lazy panel's tab.
abstract  T createWidget()
          Create the widget contained within the LazyPanel.
 T ensureWidget()
          Ensures the existence of the LazyPanel widget.
 T getWidget()
          Gets the panel's child widget.
 void setVisible(boolean visible)
           
 
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, getContainerElement, 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
getParent, isAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setWidth, sinkEvents, 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

addTabListener

public static void addTabListener(com.google.gwt.user.client.ui.TabPanel panel)
Adds a tab listener to ensure that any LazyPanel instances are loaded when a tab panel selects the lazy panel's tab.

Parameters:
panel - to add listener to

createWidget

public abstract T createWidget()
Create the widget contained within the LazyPanel.

Returns:
the lazy widget

ensureWidget

public T ensureWidget()
Ensures the existence of the LazyPanel widget.

Returns:
the widget

getWidget

public T getWidget()
Gets the panel's child widget. Will not create the widget, call ensureWidget to ensure that the widget exists.

Overrides:
getWidget in class com.google.gwt.user.client.ui.SimplePanel
Returns:
the child widget, or null if none is present

setVisible

public void setVisible(boolean visible)
Overrides:
setVisible in class com.google.gwt.user.client.ui.UIObject