|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gwt.user.client.ui.UIObject com.google.gwt.user.client.ui.Widget com.google.gwt.user.client.ui.Panel
public abstract class Panel
Abstract base class for all panels, which are widgets that can contain other 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 |
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 | |
---|---|
Panel()
|
Method Summary | |
---|---|
void |
add(IsWidget child)
|
void |
add(Widget child)
Adds a child widget. |
protected void |
adopt(Widget child)
Finalize the attachment of a Widget to this Panel. |
void |
clear()
Removes all child widgets. |
protected void |
doAttachChildren()
If a widget contains one or more child widgets that are not in the logical widget hierarchy (the child is physically connected only on the DOM level), it must override this method and call Widget.onAttach() for each of its
child widgets. |
protected void |
doDetachChildren()
If a widget contains one or more child widgets that are not in the logical widget hierarchy (the child is physically connected only on the DOM level), it must override this method and call Widget.onDetach() for each of its
child widgets. |
protected void |
orphan(Widget child)
This method must be called as part of the remove method of any Panel. |
boolean |
remove(IsWidget child)
|
abstract boolean |
remove(Widget child)
Removes a child widget. |
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 com.google.gwt.user.client.ui.HasWidgets |
---|
iterator |
Constructor Detail |
---|
public Panel()
Method Detail |
---|
public void add(Widget child)
How to Override this Method
There are several important things that must take place in the correct order to properly add or insert a Widget to a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.
ComplexPanel.adjustIndex(Widget, int)
.Widget.removeFromParent()
on the
Widget.WidgetCollection
at the appropriate index.adopt(Widget)
to finalize the add as the
very last step.
add
in interface HasWidgets
child
- the widget to be added
java.lang.UnsupportedOperationException
- if this method is not supported (most
often this means that a specific overload must be called)HasWidgets.add(Widget)
public void add(IsWidget child)
add
in interface HasWidgets.ForIsWidget
public void clear()
HasWidgets
clear
in interface HasWidgets
public abstract boolean remove(Widget child)
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.
false
if it is not.orphan(Widget)
first while the child
Widget is still attached.WidgetCollection
.
remove
in interface HasWidgets
child
- the widget to be removed
true
if the child was presentpublic boolean remove(IsWidget child)
remove
in interface HasWidgets.ForIsWidget
protected final void adopt(Widget child)
Widget.onAttach()
event if this Panel is currently attached.
child
- the widget to be adoptedadd(Widget)
protected void doAttachChildren()
Widget
Widget.onAttach()
for each of its
child widgets.
doAttachChildren
in class Widget
Widget.onAttach()
protected void doDetachChildren()
Widget
Widget.onDetach()
for each of its
child widgets.
doDetachChildren
in class Widget
Widget.onDetach()
protected final void orphan(Widget child)
This method must be called as part of the remove method of any Panel. It
ensures that the Widget's parent is cleared. This method should be called
after verifying that the child Widget is an existing child of the Panel,
but before physically removing the child Widget from the DOM. The child
will now fire its Widget.onDetach()
event if this Panel is
currently attached.
Calls to orphan(Widget)
should be wrapped in a try/finally block
to ensure that the widget is physically detached even if orphan throws an
exception.
child
- the widget to be disownedadd(Widget)
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |