public class Dock
extends ej.mwt.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):
Constructor and Description |
---|
Dock()
Creates a dock.
|
Modifier and Type | Method and Description |
---|---|
void |
addChildOnBottom(ej.mwt.Widget child)
Adds a child which will be docked on the bottom side.
|
void |
addChildOnLeft(ej.mwt.Widget child)
Adds a child which will be docked on the left side.
|
void |
addChildOnRight(ej.mwt.Widget child)
Adds a child which will be docked on the right side.
|
void |
addChildOnTop(ej.mwt.Widget child)
Adds a child which will be docked on the top side.
|
protected void |
computeContentOptimalSize(ej.mwt.util.Size size) |
ej.mwt.Widget |
getCenterChild()
Gets the child at the center of this dock.
|
protected void |
layOutChildren(int contentWidth,
int contentHeight) |
void |
removeAllChildren() |
void |
removeChild(ej.mwt.Widget child) |
void |
setCenterChild(ej.mwt.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, updateStyle
addClassSelector, 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, setStyle
public void addChildOnLeft(ej.mwt.Widget child)
child
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)
public void addChildOnRight(ej.mwt.Widget child)
child
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)
public void addChildOnTop(ej.mwt.Widget child)
child
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)
public void addChildOnBottom(ej.mwt.Widget child)
child
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)
public void setCenterChild(ej.mwt.Widget child)
child
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the specified widget is already in a hierarchy (already contained in a container or desktop).Container.addChild(Widget)
@Nullable public ej.mwt.Widget getCenterChild()
null
is it has not been set.public void removeChild(ej.mwt.Widget child)
removeChild
in class ej.mwt.Container
public void removeAllChildren()
removeAllChildren
in class ej.mwt.Container
protected void computeContentOptimalSize(ej.mwt.util.Size size)
computeContentOptimalSize
in class ej.mwt.Widget
protected void layOutChildren(int contentWidth, int contentHeight)
layOutChildren
in class ej.mwt.Container