public class DockPanel extends CellPanel implements HasAlignment
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
).
DockLayoutPanel
Modifier and Type | Class and Description |
---|---|
static class |
DockPanel.DockLayoutConstant
DockPanel layout constant, used in
add(Widget, DockPanel.DockLayoutConstant) . |
(package private) static class |
DockPanel.LayoutData |
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstant
HasVerticalAlignment.VerticalAlignmentConstant
IndexedPanel.ForIsWidget
HasWidgets.ForIsWidget
Modifier and Type | Field and Description |
---|---|
static DockPanel.DockLayoutConstant |
CENTER
Specifies that a widget be added at the center of the dock.
|
static DockPanel.DockLayoutConstant |
EAST
Specifies that a widget be added at the east edge of the dock.
|
static DockPanel.DockLayoutConstant |
LINE_END
Specifies that a widget be added at the end of the line direction
for the layout.
|
static DockPanel.DockLayoutConstant |
LINE_START
Specifies that a widget be added at the beginning of the line direction
for the layout.
|
static DockPanel.DockLayoutConstant |
NORTH
Specifies that a widget be added at the north edge of the dock.
|
static DockPanel.DockLayoutConstant |
SOUTH
Specifies that a widget be added at the south edge of the dock.
|
static DockPanel.DockLayoutConstant |
WEST
Specifies that a widget be added at the west edge of the dock.
|
eventsToSink
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT
ALIGN_BOTTOM, ALIGN_MIDDLE, ALIGN_TOP
Constructor and Description |
---|
DockPanel()
Creates an empty dock panel.
|
Modifier and Type | Method and Description |
---|---|
void |
add(IsWidget widget,
DockPanel.DockLayoutConstant direction)
Overloaded version for IsWidget.
|
void |
add(Widget widget,
DockPanel.DockLayoutConstant direction)
Adds a widget to the specified edge of the dock.
|
HasHorizontalAlignment.HorizontalAlignmentConstant |
getHorizontalAlignment()
Gets the horizontal alignment.
|
HasVerticalAlignment.VerticalAlignmentConstant |
getVerticalAlignment()
Gets the vertical alignment.
|
DockPanel.DockLayoutConstant |
getWidgetDirection(Widget w)
Gets the layout direction of the given child widget.
|
protected void |
onEnsureDebugId(java.lang.String baseID)
DockPanel supports adding more than one cell in a direction, so an
integer will be appended to the end of the debug id. |
boolean |
remove(Widget w)
Removes a child widget.
|
void |
setCellHeight(Widget w,
java.lang.String height)
Sets the height of the cell associated with the given widget, related to
the panel as a whole.
|
void |
setCellHorizontalAlignment(Widget w,
HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment of the given widget within its cell.
|
void |
setCellVerticalAlignment(Widget w,
HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the vertical alignment of the given widget within its cell.
|
void |
setCellWidth(Widget w,
java.lang.String width)
Sets the width of the cell associated with the given widget, related to the
panel as a whole.
|
void |
setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the default horizontal alignment to be used for widgets added to this
panel.
|
void |
setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the default vertical alignment to be used for widgets added to this
panel.
|
getBody, getSpacing, getTable, getWidgetTd, setBorderWidth, setCellHeight, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellHorizontalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellVerticalAlignment, setCellWidth, setSpacing
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, doLogicalClear, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove
add, add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
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
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, toString
public static final DockPanel.DockLayoutConstant CENTER
public static final DockPanel.DockLayoutConstant LINE_START
public static final DockPanel.DockLayoutConstant LINE_END
public static final DockPanel.DockLayoutConstant EAST
public static final DockPanel.DockLayoutConstant NORTH
public static final DockPanel.DockLayoutConstant SOUTH
public static final DockPanel.DockLayoutConstant WEST
public void add(Widget widget, DockPanel.DockLayoutConstant direction)
remove(Widget)
had already been called.widget
- the widget to be addeddirection
- the widget's direction in the dockjava.lang.IllegalArgumentException
- when adding to the CENTER
and
there is already a different widget therepublic void add(IsWidget widget, DockPanel.DockLayoutConstant direction)
add(Widget,DockLayoutConstant)
public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
HasHorizontalAlignment
getHorizontalAlignment
in interface HasHorizontalAlignment
HasHorizontalAlignment.ALIGN_LEFT
,
HasHorizontalAlignment.ALIGN_CENTER
,
HasHorizontalAlignment.ALIGN_RIGHT
,
HasHorizontalAlignment.ALIGN_JUSTIFY
, or
null).public HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()
HasVerticalAlignment
getVerticalAlignment
in interface HasVerticalAlignment
public DockPanel.DockLayoutConstant getWidgetDirection(Widget w)
w
- the widget to be queriednull
if it is not
a child of this panelpublic boolean remove(Widget w)
Panel
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.Panel.orphan(Widget)
first while the child
Widget is still attached.WidgetCollection
.remove
in interface HasWidgets
remove
in class ComplexPanel
w
- the widget to be removedtrue
if the child was presentpublic void setCellHeight(Widget w, java.lang.String height)
CellPanel
setCellHeight
in class CellPanel
w
- the widget whose cell height is to be setheight
- the cell's height, in CSS unitspublic void setCellHorizontalAlignment(Widget w, HasHorizontalAlignment.HorizontalAlignmentConstant align)
CellPanel
setCellHorizontalAlignment
in class CellPanel
w
- the widget whose horizontal alignment is to be setalign
- the widget's horizontal alignment, as defined in
HasHorizontalAlignment
.public void setCellVerticalAlignment(Widget w, HasVerticalAlignment.VerticalAlignmentConstant align)
CellPanel
setCellVerticalAlignment
in class CellPanel
w
- the widget whose vertical alignment is to be setalign
- the widget's vertical alignment, as defined in
HasVerticalAlignment
.public void setCellWidth(Widget w, java.lang.String width)
CellPanel
setCellWidth
in class CellPanel
w
- the widget whose cell width is to be setwidth
- the cell's width, in CSS unitspublic void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
setHorizontalAlignment
in interface HasHorizontalAlignment
align
- the horizontal alignment (
HasHorizontalAlignment.ALIGN_LEFT
,
HasHorizontalAlignment.ALIGN_CENTER
,
HasHorizontalAlignment.ALIGN_RIGHT
,
HasHorizontalAlignment.ALIGN_JUSTIFY
,
HasHorizontalAlignment.ALIGN_LOCALE_START
, or
HasHorizontalAlignment.ALIGN_LOCALE_END
).HasHorizontalAlignment.setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant)
public void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
setVerticalAlignment
in interface HasVerticalAlignment
align
- the vertical alignment (
HasVerticalAlignment.ALIGN_TOP
,
HasVerticalAlignment.ALIGN_MIDDLE
, or
HasVerticalAlignment.ALIGN_BOTTOM
).HasVerticalAlignment.setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant)
protected void onEnsureDebugId(java.lang.String baseID)
DockPanel
supports 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 a Widget
is added,
so you must call this method after adding a new Widget
or all debug
IDs will be lost.
Affected Elements:
onEnsureDebugId
in class UIObject
baseID
- the base ID used by the main elementUIObject.onEnsureDebugId(String)