public class Dock extends Container
Each child is laid out individually on one of the sides of the remaining space, following the order in which they have been added to the dock. If a widget is set at the center of the dock, it will take the final remaining space.
In a dock, all widgets docked on the left side and on the right side will have the height of the remaining space and will have their optimal width. All widgets docked on the top side and on the bottom side will have the width of the remaining space and will have their optimal height. The center widget will have the size of the remaining space.
Example of dock that contains (added in this order):

NO_CONSTRAINT| Constructor and Description |
|---|
Dock()
Creates a dock.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChildOnBottom(Widget child)
Adds a child which will be docked on the bottom side.
|
void |
addChildOnLeft(Widget child)
Adds a child which will be docked on the left side.
|
void |
addChildOnRight(Widget child)
Adds a child which will be docked on the right side.
|
void |
addChildOnTop(Widget child)
Adds a child which will be docked on the top side.
|
protected void |
computeContentOptimalSize(Size size)
Computes the optimal size of the widget.
|
Widget |
getCenterChild()
Gets the child at the center of this dock.
|
protected void |
layOutChildren(int contentWidth,
int contentHeight)
Lays out the children of this container.
|
void |
removeAllChildren()
Removes all the children of this container.
|
void |
removeChild(Widget child)
Removes the specified widget from the list of children of this container.
|
void |
setCenterChild(Widget child)
Sets the child which will be at the center.
|
addChild, changeChildIndex, computeChildOptimalSize, getChild, getChildIndex, getChildren, getChildrenCount, getContentBounds, getContentHeight, getContentWidth, getContentX, getContentY, getWidgetAt, insertChild, layOutChild, renderChild, renderContent, replaceChild, setHiddenChild, setHiddenChildren, setShownChild, setShownChildren, updateStyleaddClassSelector, contains, containsWidget, getAbsoluteX, getAbsoluteY, getDesktop, getHeight, getParent, getStyle, getWidth, getX, getY, handleEvent, hasClassSelector, isAttached, isEnabled, isInState, isShown, isTransparent, onAttached, onDetached, onHidden, onLaidOut, onShown, removeAllClassSelectors, removeClassSelector, render, requestLayOut, requestRender, requestRender, setClassSelectors, setEnabled, setPosition, setStylepublic void addChildOnBottom(Widget child)
child - the widget to add.NullPointerException - if the given widget is null.IllegalArgumentException - if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)public void addChildOnLeft(Widget child)
child - the widget to add.NullPointerException - if the given widget is null.IllegalArgumentException - if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)public void addChildOnRight(Widget child)
child - the widget to add.NullPointerException - if the given widget is null.IllegalArgumentException - if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)public void addChildOnTop(Widget child)
child - the widget to add.NullPointerException - if the given widget is null.IllegalArgumentException - if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)protected void computeContentOptimalSize(Size size)
WidgetThis method does not consider the border, margin, padding and dimension specified in the style.
The given size is the available size for this widget in its parent. A width or a height equal to
Widget#NO_CONSTRAINT means that there is no constraint on this dimension.
The given size is modified to set the optimal size.
computeContentOptimalSize in class Widgetsize - the size available for the content.@Nullable public Widget getCenterChild()
null is it has not been set.protected void layOutChildren(int contentWidth,
int contentHeight)
ContainerThe given size is the size of this container minus the border, margin and padding specified in the style.
When this method returns the children of this container have been lay out using
Container.layOutChild(Widget, int, int, int, int).
layOutChildren in class ContainercontentWidth - the width available for the content.contentHeight - the height available for the content.public void removeAllChildren()
ContainerThe container needs to be laid out again.
Should be called in the display thread to avoid concurrency issues.
removeAllChildren in class ContainerWidget.requestLayOut()public void removeChild(Widget child)
ContainerThe container needs to be laid out again.
If the widget is not in the list of children of the container, nothing is done.
Should be called in the display thread to avoid concurrency issues.
removeChild in class Containerchild - the widget to remove.Widget.requestLayOut()public void setCenterChild(Widget child)
child - the widget to add.NullPointerException - if the given widget is null.IllegalArgumentException - if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)