Package com.google.gwt.user.client.ui
Class SimplePanel
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.SimplePanel
- All Implemented Interfaces:
HasAttachHandlers,HasHandlers,EventListener,AcceptsOneWidget,HasOneWidget,HasVisibility,HasWidgets,HasWidgets.ForIsWidget,IsWidget,Iterable<Widget>
- Direct Known Subclasses:
DecoratorPanel,FocusPanel,FormPanel,LazyPanel,PopupPanel,ResizeLayoutPanel,ScrollPanel,SimpleLayoutPanel
Base class for panels that contain only one widget.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget -
Field Summary
FieldsFields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSinkFields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates an empty panel that uses a DIV for its contents.protectedSimplePanel(Element elem) Creates an empty panel that uses the specified browser element for its contents.SimplePanel(Widget child) Create a panel with the specified child widget. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a widget to this panel.protected ElementOverride this method to specify that an element other than the root element be the container for the panel's child widget.Gets the panel's child widget.iterator()Gets an iterator for the contained widgets.booleanRemoves a child widget.voidSet the only widget of the receiver, replacing the previous widget if there was one.voidSets this panel's widget.Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, removeMethods 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, unsinkEventsMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
widget
Widget widget
-
-
Constructor Details
-
SimplePanel
public SimplePanel()Creates an empty panel that uses a DIV for its contents. -
SimplePanel
Create a panel with the specified child widget.- Parameters:
child- the child to add to the panel
-
SimplePanel
Creates an empty panel that uses the specified browser element for its contents.- Parameters:
elem- the browser element to use
-
-
Method Details
-
add
Adds a widget to this panel.- Specified by:
addin interfaceHasWidgets- Overrides:
addin classPanel- Parameters:
w- the child widget to be added- See Also:
-
getWidget
Gets the panel's child widget.- Specified by:
getWidgetin interfaceHasOneWidget- Returns:
- the child widget, or
nullif none is present
-
iterator
Description copied from interface:HasWidgetsGets an iterator for the contained widgets. This iterator is required to implementIterator.remove().- Specified by:
iteratorin interfaceHasWidgets- Specified by:
iteratorin interfaceIterable<Widget>
-
remove
Description copied from class:PanelRemoves 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
falseif 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:
removein interfaceHasWidgets- Specified by:
removein classPanel- Parameters:
w- the widget to be removed- Returns:
trueif the child was present
- Validate: Make sure this Panel is actually the parent of the
child Widget; return
-
setWidget
Description copied from interface:AcceptsOneWidgetSet the only widget of the receiver, replacing the previous widget if there was one.- Specified by:
setWidgetin interfaceAcceptsOneWidget- Parameters:
w- the widget, ornullto remove the widget- See Also:
-
setWidget
Sets this panel's widget. Any existing child widget will be removed.- Specified by:
setWidgetin interfaceHasOneWidget- Parameters:
w- the panel's new widget, ornullto clear the panel
-
getContainerElement
Override this method to specify that an element other than the root element be the container for the panel's child widget. This can be useful when you want to create a simple panel that decorates its contents. Note that this method continues to return theElementclass defined in theUsermodule to maintain backwards compatibility.- Returns:
- the element to be used as the panel's container
-