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

java.lang.Object
  extended bycom.google.gwt.user.client.ui.UIObject
      extended bycom.google.gwt.user.client.ui.Widget
          extended bycom.google.gwt.user.client.ui.Panel
              extended bycom.google.gwt.user.client.ui.SimplePanel
All Implemented Interfaces:
EventListener, HasWidgets
Direct Known Subclasses:
FocusPanel, FormPanel, PopupPanel, ScrollPanel

public class SimplePanel
extends Panel

Abstract base class for panels that contain only one widget.


Constructor Summary
  SimplePanel()
          Creates an empty panel that uses a DIV for its contents.
protected SimplePanel(Element elem)
          Creates an empty panel that uses the specified browser element for its contents.
 
Method Summary
 void add(Widget w)
          Adds a widget to this panel.
protected  Element getContainerElement()
          Override this method to specify that an element other than the root element be the container for the panel's child widget.
 Widget getWidget()
          Gets the panel's child widget.
 java.util.Iterator iterator()
          Gets an iterator for the contained widgets.
 boolean remove(Widget w)
          Removes a child widget.
 void setWidget(Widget w)
          Sets this panel's widget.
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, clear, disown, onAttach, onDetach
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onBrowserEvent, onLoad, onUnload, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getTitle, isVisible, isVisible, removeStyleName, resetStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimplePanel

public SimplePanel()
Creates an empty panel that uses a DIV for its contents.


SimplePanel

protected SimplePanel(Element elem)
Creates an empty panel that uses the specified browser element for its contents.

Parameters:
elem - the browser element to use
Method Detail

add

public void add(Widget w)
Adds a widget to this panel.

Specified by:
add in interface HasWidgets
Overrides:
add in class Panel
Parameters:
w - the child widget to be added

getWidget

public Widget getWidget()
Gets the panel's child widget.

Returns:
the child widget, or null if none is present

iterator

public java.util.Iterator iterator()
Description copied from interface: HasWidgets
Gets an iterator for the contained widgets. This iterator is required to implement Iterator.remove().


remove

public boolean remove(Widget w)
Description copied from interface: HasWidgets
Removes a child widget.

Parameters:
w - the widget to be removed
Returns:
true if the widget was present

setWidget

public void setWidget(Widget w)
Sets this panel's widget. Any existing child widget will be removed.

Parameters:
w - the panel's new widget (null will clear the panel)

getContainerElement

protected Element getContainerElement()
Override this method to specify that an element other than the root element be the container for the panel's child widget. This can be useful when you want to create a simple panel that decorates its contents.

Returns:
the element to be used as the panel's container