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

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

    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.ComplexPanel

All Implemented Interfaces:
  EventListener, HasWidgets, IndexedPanel

Direct Known Subclasses:
  AbsolutePanel, CellPanel, DeckPanel, FlowPanel, HTMLPanel, StackPanel

    public abstract class ComplexPanel

extends Panel
implements IndexedPanel

Abstract base class for panels that can contain multiple child widgets.

Constructor Summary
`ComplexPanel()`

Method Summary
`protected void` | `add(Widget child, Element container)` Adds a new child widget to the panel, attaching its Element to the specified container Element.
`protected int` | `adjustIndex(Widget child, int beforeIndex)` Adjusts beforeIndex to account for the possibility that the given widget is already a child of this panel.
`protected void` | `checkIndexBoundsForAccess(int index)` Checks that `index` is in the range [0, getWidgetCount()), which is the valid range on accessible indexes.
`protected void` | `checkIndexBoundsForInsertion(int index)` Checks that `index` is in the range [0, getWidgetCount()], which is the valid range for indexes on an insertion.
`protected WidgetCollection` | `getChildren()` Gets the list of children contained in this panel.
`Widget` | `getWidget(int index)` Gets the child widget at the specified index.
`int` | `getWidgetCount()` Gets the number of child widgets in this panel.
`int` | `getWidgetIndex(Widget child)` Gets the index of the specified child widget.
`protected void` | `insert(Widget child, Element container, int beforeIndex)` Deprecated. Use `insert(Widget, Element, int, boolean)`.
`protected void` | `insert(Widget child, Element container, int beforeIndex, boolean domInsert)` Insert a new child Widget into this Panel at a specified index, attaching its Element to the specified container Element.
`java.util.Iterator` | `iterator()` Gets an iterator for the contained widgets.
`boolean` | `remove(int index)` Removes the widget at the specified index.
`boolean` | `remove(Widget w)` Removes a child widget.

Methods inherited from class com.google.gwt.user.client.ui.Panel
`add, 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, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, 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

### ComplexPanel

    public ComplexPanel()

Method Detail

### getWidget

    public Widget getWidget(int index)

  Description copied from interface: `IndexedPanel`
  Gets the child widget at the specified index.

  Specified by:
    `getWidget` in interface `IndexedPanel`
  Parameters:
    `index` - the child widget's index
  Returns:
    the child widget

### getWidgetCount

    public int getWidgetCount()

  Description copied from interface: `IndexedPanel`
  Gets the number of child widgets in this panel.

  Specified by:
    `getWidgetCount` in interface `IndexedPanel`
  Returns:
    the number of children

### getWidgetIndex

    public int getWidgetIndex(Widget child)

  Description copied from interface: `IndexedPanel`
  Gets the index of the specified child widget.

  Specified by:
    `getWidgetIndex` in interface `IndexedPanel`
  Parameters:
    `child` - the widget to be found
  Returns:
    the widget's index, or `-1` if it is not a child of this panel

### 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()`.

  Specified by:
    `iterator` in interface `HasWidgets`

### remove

    public boolean remove(int index)

  Description copied from interface: `IndexedPanel`
  Removes the widget at the specified index.

  Specified by:
    `remove` in interface `IndexedPanel`
  Parameters:
    `index` - the index of the widget to be removed
  Returns:
    `false` if the widget is not present

### remove

    public boolean remove(Widget w)

  Description copied from class: `Panel`
  Removes a child widget.

  How to Override this Method

  There are several important things that must take place in the correct order to properly remove a Widget from a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.

  1. Validate: Make sure this Panel is actually the parent of the child Widget; return `false` if it is not.
  2. Orphan: Call `Panel.orphan(Widget)` first while the child Widget is still attached.
  3. Physical Detach: Adjust the DOM to account for the removal of the child Widget. The Widget's Element must be physically removed from the DOM.
  4. Logical Detach: Update the Panel's state variables to reflect the removal of the child Widget. Example: the Widget is removed from the Panel's `WidgetCollection`.

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

### add

    protected void add(Widget child,
                       Element container)

  Adds a new child widget to the panel, attaching its Element to the specified container Element.

  Parameters:
    `child` - the child widget to be added
    `container` - the element within which the child will be contained

### adjustIndex

    protected int adjustIndex(Widget child,
                              int beforeIndex)

  Adjusts beforeIndex to account for the possibility that the given widget is already a child of this panel.

  Parameters:
    `child` - the widget that might be an existing child
    `beforeIndex` - the index at which it will be added to this panel
  Returns:
    the modified index

### checkIndexBoundsForAccess

    protected void checkIndexBoundsForAccess(int index)

  Checks that `index` is in the range [0, getWidgetCount()), which is the valid range on accessible indexes.

  Parameters:
    `index` - the index being accessed

### checkIndexBoundsForInsertion

    protected void checkIndexBoundsForInsertion(int index)

  Checks that `index` is in the range [0, getWidgetCount()], which is the valid range for indexes on an insertion.

  Parameters:
    `index` - the index where insertion will occur

### getChildren

    protected WidgetCollection getChildren()

  Gets the list of children contained in this panel.

  Returns:
    a collection of child widgets

### insert

    protected void insert(Widget child,
                          Element container,
                          int beforeIndex)

  Deprecated. Use `insert(Widget, Element, int, boolean)`.

  This method was used by subclasses to insert a new child Widget. It is now deprecated because it was ambiguous whether the `child` should be appended to `container` element versus inserted into `container` at `beforeIndex`. Use `insert(Widget, Element, int, boolean)`, which clarifies this ambiguity.

### insert

    protected void insert(Widget child,
                          Element container,
                          int beforeIndex,
                          boolean domInsert)

  Insert a new child Widget into this Panel at a specified index, attaching its Element to the specified container Element. The child Element will either be attached to the container at the same index, or simply appended to the container, depending on the value of `domInsert`.

  Parameters:
    `child` - the child Widget to be added
    `container` - the Element within which `child` will be contained
    `beforeIndex` - the index before which `child` will be inserted
    `domInsert` - if `true`, insert `child` into `container` at `beforeIndex`; otherwise append `child` to the end of `container`.

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