Package 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:
HasAttachHandlers
,HasHandlers
,EventListener
,HasVisibility
,HasWidgets
,HasWidgets.ForIsWidget
,IndexedPanel
,IndexedPanel.ForIsWidget
,IsWidget
,Iterable<Widget>
- Direct Known Subclasses:
AbsolutePanel
,CellPanel
,DeckLayoutPanel
,DeckPanel
,DockLayoutPanel
,FlowPanel
,HTMLPanel
,LayoutPanel
,RenderablePanel
,StackPanel
Abstract base class for panels that can contain multiple child widgets.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
-
Field Summary
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSink
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Adds a new child widget to the panel, attaching its Element to the specified container Element.protected void
Deprecated.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 thatindex
is in the range [0, getWidgetCount()), which is the valid range on accessible indexes.protected void
checkIndexBoundsForInsertion
(int index) Checks thatindex
is in the range [0, getWidgetCount()], which is the valid range for indexes on an insertion.(package private) void
protected WidgetCollection
Gets the list of children contained in this panel.getWidget
(int index) Gets the child widget at the specified index.int
Gets the number of child widgets in this panel.int
getWidgetIndex
(IsWidget child) int
getWidgetIndex
(Widget child) Gets the index of the specified child widget.protected void
Insert a new child Widget into this Panel at a specified index, attaching its Element to the specified container Element.protected void
Deprecated.Call and overrideinsert(com.google.gwt.user.client.ui.Widget,com.google.gwt.dom.client.Element,int,boolean)
instead.iterator()
Gets an iterator for the contained widgets.boolean
remove
(int index) Removes the widget at the specified index.boolean
Removes a child widget.Methods inherited from class com.google.gwt.user.client.ui.Panel
add, add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents
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, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ComplexPanel
public ComplexPanel()
-
-
Method Details
-
getWidget
Description copied from interface:IndexedPanel
Gets the child widget at the specified index.- Specified by:
getWidget
in interfaceIndexedPanel
- 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 interfaceIndexedPanel
- Returns:
- the number of children
-
getWidgetIndex
Description copied from interface:IndexedPanel
Gets the index of the specified child widget.- Specified by:
getWidgetIndex
in interfaceIndexedPanel
- Parameters:
child
- the widget to be found- Returns:
- the widget's index, or
-1
if it is not a child of this panel
-
getWidgetIndex
- Specified by:
getWidgetIndex
in interfaceIndexedPanel.ForIsWidget
-
iterator
Description copied from interface:HasWidgets
Gets an iterator for the contained widgets. This iterator is required to implementIterator.remove()
.- Specified by:
iterator
in interfaceHasWidgets
- Specified by:
iterator
in interfaceIterable<Widget>
-
remove
public boolean remove(int index) Description copied from interface:IndexedPanel
Removes the widget at the specified index.- Specified by:
remove
in interfaceIndexedPanel
- Parameters:
index
- the index of the widget to be removed- Returns:
false
if the widget is not present
-
remove
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.
- Validate: Make sure this Panel is actually the parent of the
child Widget; return
false
if it is not. - Orphan: Call
Panel.orphan(Widget)
first while the child Widget is still attached. - 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.
- 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 interfaceHasWidgets
- Specified by:
remove
in classPanel
- Parameters:
w
- the widget to be removed- Returns:
true
if the child was present
- Validate: Make sure this Panel is actually the parent of the
child Widget; return
-
add
Adds a new child widget to the panel, attaching its Element to the specified container Element.- Parameters:
child
- the child widget to be addedcontainer
- the element within which the child will be contained
-
add
Deprecated.Call and overrideadd(Widget, Element)
instead. -
adjustIndex
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 childbeforeIndex
- the index at which it will be added to this panel- Returns:
- the modified index
-
checkIndexBoundsForAccess
protected void checkIndexBoundsForAccess(int index) Checks thatindex
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 thatindex
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
Gets the list of children contained in this panel.- Returns:
- a collection of child widgets
-
insert
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 ofdomInsert
.- Parameters:
child
- the child Widget to be addedcontainer
- the Element within whichchild
will be containedbeforeIndex
- the index before whichchild
will be inserteddomInsert
- iftrue
, insertchild
intocontainer
atbeforeIndex
; otherwise appendchild
to the end ofcontainer
.
-
insert
@Deprecated protected void insert(Widget child, Element container, int beforeIndex, boolean domInsert) Deprecated.Call and overrideinsert(com.google.gwt.user.client.ui.Widget,com.google.gwt.dom.client.Element,int,boolean)
instead. -
doLogicalClear
void doLogicalClear()
-
add(Widget, Element)
instead.