Class DockPanel
- All Implemented Interfaces:
HasAttachHandlers,HasHandlers,EventListener,HasAlignment,HasHorizontalAlignment,HasVerticalAlignment,HasVisibility,HasWidgets,HasWidgets.ForIsWidget,IndexedPanel,IndexedPanel.ForIsWidget,IsWidget,Iterable<Widget>
This widget has limitations in standards mode that did not exist in quirks
mode. The child Widgets contained within a DockPanel cannot be sized using
percentages. Setting a child widget's height to 100% will
NOT cause the child to fill the available height.
If you need to work around these limitations, use DockLayoutPanel
instead, but understand that it is not a drop in replacement for this class.
It requires standards mode, and is most easily used under a
RootLayoutPanel (as opposed to a RootPanel).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDockPanel layout constant, used inadd(Widget, DockPanel.DockLayoutConstant).(package private) static classNested 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.HasHorizontalAlignment
HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstantNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
HasVerticalAlignment.VerticalAlignmentConstantNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidgetNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DockPanel.DockLayoutConstantSpecifies that a widget be added at the center of the dock.static final DockPanel.DockLayoutConstantSpecifies that a widget be added at the east edge of the dock.static final DockPanel.DockLayoutConstantSpecifies that a widget be added at the end of the line direction for the layout.static final DockPanel.DockLayoutConstantSpecifies that a widget be added at the beginning of the line direction for the layout.static final DockPanel.DockLayoutConstantSpecifies that a widget be added at the north edge of the dock.static final DockPanel.DockLayoutConstantSpecifies that a widget be added at the south edge of the dock.static final DockPanel.DockLayoutConstantSpecifies that a widget be added at the west edge of the dock.Fields 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_ERRORFields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHTFields inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment
ALIGN_BOTTOM, ALIGN_MIDDLE, ALIGN_TOP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(IsWidget widget, DockPanel.DockLayoutConstant direction) Overloaded version for IsWidget.voidadd(Widget widget, DockPanel.DockLayoutConstant direction) Adds a widget to the specified edge of the dock.Gets the horizontal alignment.Gets the vertical alignment.Gets the layout direction of the given child widget.protected voidonEnsureDebugId(String baseID) DockPanelsupports adding more than one cell in a direction, so an integer will be appended to the end of the debug id.booleanRemoves a child widget.voidsetCellHeight(Widget w, String height) Sets the height of the cell associated with the given widget, related to the panel as a whole.voidSets the horizontal alignment of the given widget within its cell.voidSets the vertical alignment of the given widget within its cell.voidsetCellWidth(Widget w, String width) Sets the width of the cell associated with the given widget, related to the panel as a whole.voidSets the default horizontal alignment to be used for widgets added to this panel.voidSets the default vertical alignment to be used for widgets added to this panel.Methods inherited from class com.google.gwt.user.client.ui.CellPanel
getBody, getSpacing, getTable, getWidgetTd, setBorderWidth, setCellHeight, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellWidth, setSpacingMethods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, doLogicalClear, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, removeMethods inherited from class com.google.gwt.user.client.ui.Panel
add, 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, 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
-
CENTER
Specifies that a widget be added at the center of the dock. -
LINE_START
Specifies that a widget be added at the beginning of the line direction for the layout. -
LINE_END
Specifies that a widget be added at the end of the line direction for the layout. -
EAST
Specifies that a widget be added at the east edge of the dock. -
NORTH
Specifies that a widget be added at the north edge of the dock. -
SOUTH
Specifies that a widget be added at the south edge of the dock. -
WEST
Specifies that a widget be added at the west edge of the dock.
-
-
Constructor Details
-
DockPanel
public DockPanel()Creates an empty dock panel.
-
-
Method Details
-
add
Adds a widget to the specified edge of the dock. If the widget is already a child of this panel, this method behaves as thoughremove(Widget)had already been called.- Parameters:
widget- the widget to be addeddirection- the widget's direction in the dock- Throws:
IllegalArgumentException- when adding to theCENTERand there is already a different widget there
-
add
Overloaded version for IsWidget.- See Also:
-
getHorizontalAlignment
Description copied from interface:HasHorizontalAlignmentGets the horizontal alignment.- Specified by:
getHorizontalAlignmentin interfaceHasHorizontalAlignment- Returns:
- the current horizontal alignment (
HasHorizontalAlignment.ALIGN_LEFT,HasHorizontalAlignment.ALIGN_CENTER,HasHorizontalAlignment.ALIGN_RIGHT,HasHorizontalAlignment.ALIGN_JUSTIFY, or null).
-
getVerticalAlignment
Description copied from interface:HasVerticalAlignmentGets the vertical alignment.- Specified by:
getVerticalAlignmentin interfaceHasVerticalAlignment- Returns:
- the current vertical alignment.
-
getWidgetDirection
Gets the layout direction of the given child widget.- Parameters:
w- the widget to be queried- Returns:
- the widget's layout direction, or
nullif it is not a child of this panel
-
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- Overrides:
removein classComplexPanel- 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
-
setCellHeight
Description copied from class:CellPanelSets the height of the cell associated with the given widget, related to the panel as a whole.- Overrides:
setCellHeightin classCellPanel- Parameters:
w- the widget whose cell height is to be setheight- the cell's height, in CSS units
-
setCellHorizontalAlignment
public void setCellHorizontalAlignment(Widget w, HasHorizontalAlignment.HorizontalAlignmentConstant align) Description copied from class:CellPanelSets the horizontal alignment of the given widget within its cell.- Overrides:
setCellHorizontalAlignmentin classCellPanel- Parameters:
w- the widget whose horizontal alignment is to be setalign- the widget's horizontal alignment, as defined inHasHorizontalAlignment.
-
setCellVerticalAlignment
public void setCellVerticalAlignment(Widget w, HasVerticalAlignment.VerticalAlignmentConstant align) Description copied from class:CellPanelSets the vertical alignment of the given widget within its cell.- Overrides:
setCellVerticalAlignmentin classCellPanel- Parameters:
w- the widget whose vertical alignment is to be setalign- the widget's vertical alignment, as defined inHasVerticalAlignment.
-
setCellWidth
Description copied from class:CellPanelSets the width of the cell associated with the given widget, related to the panel as a whole.- Overrides:
setCellWidthin classCellPanel- Parameters:
w- the widget whose cell width is to be setwidth- the cell's width, in CSS units
-
setHorizontalAlignment
Sets the default horizontal alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.- Specified by:
setHorizontalAlignmentin interfaceHasHorizontalAlignment- Parameters:
align- the horizontal alignment (HasHorizontalAlignment.ALIGN_LEFT,HasHorizontalAlignment.ALIGN_CENTER,HasHorizontalAlignment.ALIGN_RIGHT,HasHorizontalAlignment.ALIGN_JUSTIFY,HasHorizontalAlignment.ALIGN_LOCALE_START, orHasHorizontalAlignment.ALIGN_LOCALE_END).- See Also:
-
setVerticalAlignment
Sets the default vertical alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.- Specified by:
setVerticalAlignmentin interfaceHasVerticalAlignment- Parameters:
align- the vertical alignment (HasVerticalAlignment.ALIGN_TOP,HasVerticalAlignment.ALIGN_MIDDLE, orHasVerticalAlignment.ALIGN_BOTTOM).- See Also:
-
onEnsureDebugId
DockPanelsupports adding more than one cell in a direction, so an integer will be appended to the end of the debug id. For example, the first north cell is labeled "north1", the second is "north2", and the third is "north3". This widget recreates its structure every time aWidgetis added, so you must call this method after adding a newWidgetor all debug IDs will be lost.Affected Elements:
- -center = the center cell.
- -north# = the northern cell.
- -south# = the southern cell.
- -east# = the eastern cell.
- -west# = the western cell.
- Overrides:
onEnsureDebugIdin classUIObject- Parameters:
baseID- the base ID used by the main element- See Also:
-