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

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.ComplexPanel
                  extended by com.google.gwt.user.client.ui.AbsolutePanel
All Implemented Interfaces:
EventListener, HasWidgets, IndexedPanel, java.lang.Iterable<Widget>
Direct Known Subclasses:
RootPanel

public class AbsolutePanel
extends ComplexPanel

An absolute panel positions all of its children absolutely, allowing them to overlap.

Note that this panel will not automatically resize itself to allow enough room for its absolutely-positioned children. It must be explicitly sized in order to make room for them.

Once a widget has been added to an absolute panel, the panel effectively "owns" the positioning of the widget. Any existing positioning attributes on the widget may be modified by the panel.


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
  AbsolutePanel()
          Creates an empty absolute panel.
protected AbsolutePanel(Element elem)
          Creates an AbsolutePanel with the given element.
 
Method Summary
 void add(Widget w)
          Adds a child widget to this panel.
 void add(Widget w, int left, int top)
          Adds a widget to the panel at the specified position.
 int getWidgetLeft(Widget w)
          Gets the position of the left outer border edge of the widget relative to the left outer border edge of the panel.
 int getWidgetTop(Widget w)
          Gets the position of the top outer border edge of the widget relative to the top outer border edge of the panel.
 boolean remove(Widget w)
          Overrides ComplexPanel.remove(Widget) to change the removed Widget's element back to static positioning.This is done so that any positioning changes to the widget that were done by the panel are undone when the widget is disowned from the panel.
 void setWidgetPosition(Widget w, int left, int top)
          Sets the position of the specified child widget.
protected  void setWidgetPositionImpl(Widget w, int left, int top)
           
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, insert, insert, iterator, remove
 
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
 
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, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbsolutePanel

public AbsolutePanel()
Creates an empty absolute panel.


AbsolutePanel

protected AbsolutePanel(Element elem)
Creates an AbsolutePanel with the given element. This is protected so that it can be used by RootPanel or a subclass that wants to substitute another element. The element is presumed to be a <div>.

Parameters:
elem - the element to be used for this panel.
Method Detail

add

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

Specified by:
add in interface HasWidgets
Overrides:
add in class Panel
Parameters:
w - the child widget to be added
See Also:
HasWidgets.add(Widget)

add

public void add(Widget w,
                int left,
                int top)
Adds a widget to the panel at the specified position. Setting a position of (-1, -1) will cause the child widget to be positioned statically.

Parameters:
w - the widget to be added
left - the widget's left position
top - the widget's top position

getWidgetLeft

public int getWidgetLeft(Widget w)
Gets the position of the left outer border edge of the widget relative to the left outer border edge of the panel.

Parameters:
w - the widget whose position is to be retrieved
Returns:
the widget's left position

getWidgetTop

public int getWidgetTop(Widget w)
Gets the position of the top outer border edge of the widget relative to the top outer border edge of the panel.

Parameters:
w - the widget whose position is to be retrieved
Returns:
the widget's top position

remove

public boolean remove(Widget w)
Overrides ComplexPanel.remove(Widget) to change the removed Widget's element back to static positioning.This is done so that any positioning changes to the widget that were done by the panel are undone when the widget is disowned from the panel.

Specified by:
remove in interface HasWidgets
Overrides:
remove in class ComplexPanel
Parameters:
w - the widget to be removed
Returns:
true if the child was present

setWidgetPosition

public void setWidgetPosition(Widget w,
                              int left,
                              int top)
Sets the position of the specified child widget. Setting a position of (-1, -1) will cause the child widget to be positioned statically.

Parameters:
w - the child widget to be positioned
left - the widget's left position
top - the widget's top position

setWidgetPositionImpl

protected void setWidgetPositionImpl(Widget w,
                                     int left,
                                     int top)