Google Web Toolkit (Beta)
Search this site:

# Class ComplexPanel

public class ComplexPanel
extends Panel
implements IndexedPanel
// Superclass of `StackPanel`, `HTMLPanel`, `FlowPanel`, `DeckPanel`, `CellPanel`, `AbsolutePanel`
Abstract base class for panels that can contain multiple child widgets.

## Methods

add(Widget, Element) | Adds a new child widget to the panel.
getChildren() | Gets the list of children contained in this panel.
getWidget(int) | Gets the child widget at the specified index.
getWidgetCount() | Gets the number of child widgets in this panel.
getWidgetIndex(Widget) | Gets the index of the specified child widget.
insert(Widget, Element, int) | Inserts a new child widget into the panel.
iterator() | Gets an iterator for the contained widgets.
remove(int) | Removes the widget at the specified index.
remove(Widget) | Removes a child widget.

## Method Detail

### add

protected int add(Widget w, Element container)
Adds a new child widget to the panel.

#### Parameters

w
  the child widget to be added
container
  the element within which the child will be contained

#### Return Value

the index at which the widget was added

### getChildren

protected WidgetCollection getChildren()
Gets the list of children contained in this panel.

#### Return Value

a collection of child widgets

### getWidget

public Widget getWidget(int index)
Gets the child widget at the specified index.

#### Parameters

index
  the child widget's index

#### Return Value

the child widget

### getWidgetCount

public int getWidgetCount()
Gets the number of child widgets in this panel.

#### Return Value

the number of children

### getWidgetIndex

public int getWidgetIndex(Widget child)
Gets the index of the specified child widget.

#### Parameters

child
  the widget to be found

#### Return Value

the widget's index, or `-1` if it is not a child of this panel

### insert

protected int insert(Widget w, Element container, int beforeIndex)
Inserts a new child widget into the panel.

#### Parameters

w
  the child widget to be added
container
  the element within which the child will be contained
beforeIndex
  the index before which the widget will be added

#### Return Value

the index at which the widget was added

### iterator

public Iterator iterator()
Gets an iterator for the contained widgets. This iterator is required to implement Iterator.remove().

### remove

public boolean remove(int index)
Removes the widget at the specified index.

#### Parameters

index
  the index of the widget to be removed

#### Return Value

`false` if the widget is not present

### remove

public boolean remove(Widget w)
Removes a child widget.

#### Parameters

w
  the widget to be removed

#### Return Value

`true` if the widget was present