Class HeaderPanel
- 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.HeaderPanel
-
- All Implemented Interfaces:
HasAttachHandlers,HasHandlers,EventListener,HasVisibility,HasWidgets,HasWidgets.ForIsWidget,IsWidget,RequiresResize,java.lang.Iterable<Widget>
public class HeaderPanel extends Panel implements RequiresResize
A panel that includes a header (top), footer (bottom), and content (middle) area. The header and footer areas resize naturally. The content area is allocated all of the remaining space between the header and footer area.
-
-
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
Constructors Constructor Description HeaderPanel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Widget w)Adds a widget to this panel.WidgetgetContentWidget()Get the content widget that appears between the header and footer.WidgetgetFooterWidget()Get the footer widget at the bottom of the panel.WidgetgetHeaderWidget()Get the header widget at the top of the panel.java.util.Iterator<Widget>iterator()Gets an iterator for the contained widgets.voidonAttach()This method is called when a widget is attached to the browser's document.voidonDetach()This method is called when a widget is detached from the browser's document.voidonResize()This method must be called whenever the implementor's size has been modified.booleanremove(Widget w)Removes a child widget.voidsetContentWidget(Widget w)Set the widget in the content portion between the header and footer.voidsetFooterWidget(Widget w)Set the widget in the footer portion at the bottom of the panel.voidsetHeaderWidget(Widget w)Set the widget in the header portion at the top of the panel.-
Methods inherited from class com.google.gwt.user.client.ui.Panel
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, onBrowserEvent, 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
-
-
-
-
Method Detail
-
add
public void add(Widget w)
Adds a widget to this panel.- Specified by:
addin interfaceHasWidgets- Overrides:
addin classPanel- Parameters:
w- the child widget to be added- See Also:
HasWidgets.add(Widget)
-
getContentWidget
public Widget getContentWidget()
Get the content widget that appears between the header and footer.- Returns:
- the content
Widget
-
getFooterWidget
public Widget getFooterWidget()
Get the footer widget at the bottom of the panel.- Returns:
- the footer
Widget
-
getHeaderWidget
public Widget getHeaderWidget()
Get the header widget at the top of the panel.- Returns:
- the header
Widget
-
iterator
public java.util.Iterator<Widget> 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 interfacejava.lang.Iterable<Widget>
-
onAttach
public void onAttach()
Description copied from class:WidgetThis method is called when a widget is attached to the browser's document. To receive notification after a Widget has been added to the document, override the
Widget.onLoad()method or useWidget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler).It is strongly recommended that you override
Widget.onLoad()orWidget.doAttachChildren()instead of this method to avoid inconsistencies between logical and physical attachment states.Subclasses that override this method must call
super.onAttach()to ensure that the Widget has been attached to its underlying Element.- Overrides:
onAttachin classWidget- See Also:
Widget.onLoad(),Widget.doAttachChildren()
-
onDetach
public void onDetach()
Description copied from class:WidgetThis method is called when a widget is detached from the browser's document. To receive notification before a Widget is removed from the document, override the
Widget.onUnload()method or useWidget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler).It is strongly recommended that you override
Widget.onUnload()orWidget.doDetachChildren()instead of this method to avoid inconsistencies between logical and physical attachment states.Subclasses that override this method must call
super.onDetach()to ensure that the Widget has been detached from the underlying Element. Failure to do so will result in application memory leaks due to circular references between DOM Elements and JavaScript objects.- Overrides:
onDetachin classWidget- See Also:
Widget.onUnload(),Widget.doDetachChildren()
-
onResize
public void onResize()
Description copied from interface:RequiresResizeThis method must be called whenever the implementor's size has been modified.- Specified by:
onResizein interfaceRequiresResize
-
remove
public boolean remove(Widget w)
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
-
setContentWidget
public void setContentWidget(Widget w)
Set the widget in the content portion between the header and footer.- Parameters:
w- the widget to use as the content
-
setFooterWidget
public void setFooterWidget(Widget w)
Set the widget in the footer portion at the bottom of the panel.- Parameters:
w- the widget to use as the footer
-
setHeaderWidget
public void setHeaderWidget(Widget w)
Set the widget in the header portion at the top of the panel.- Parameters:
w- the widget to use as the header
-
-