Package ej.widget.container
Class SimpleDock
- java.lang.Object
-
- ej.mwt.Widget
-
- ej.mwt.Container
-
- ej.widget.container.SimpleDock
-
public class SimpleDock extends ej.mwt.ContainerLays out three children vertically or horizontally.The three children are laid out on the same horizontal or vertical line, one at the center and the two others on each side.
In a horizontal simple dock, the first and last widgets will have the height of the available space and will have their optimal width. In a vertical simple dock, the first and last widgets will have the width of the available space and will have their optimal height. Regardless of the orientation of the simple dock, the center widget will have the size of the remaining space.
Horizontal:
Vertical:

-
-
Constructor Summary
Constructors Constructor Description SimpleDock(boolean orientation)Creates a simple dock specifying its orientation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeContentOptimalSize(ej.mwt.util.Size size)ej.mwt.WidgetgetCenterChild()Gets the center widget of this simple dock.ej.mwt.WidgetgetFirstChild()Gets the first widget of this simple dock.ej.mwt.WidgetgetLastChild()Gets the last widget of this simple dock.booleangetOrientation()Gets the orientation of this simple dock.protected voidlayOutChildren(int contentWidth, int contentHeight)voidremoveAllChildren()voidremoveChild(ej.mwt.Widget widget)voidsetCenterChild(ej.mwt.Widget child)Sets the center widget of this simple dock.voidsetFirstChild(ej.mwt.Widget child)Sets the first widget of this simple dock.voidsetLastChild(ej.mwt.Widget child)Sets the last widget of this simple dock.voidsetOrientation(boolean orientation)Sets the orientation of this simple dock.-
Methods inherited from class ej.mwt.Container
addChild, changeChildIndex, computeChildOptimalSize, getChild, getChildIndex, getChildren, getChildrenCount, getContentBounds, getContentHeight, getContentWidth, getContentX, getContentY, getWidgetAt, insertChild, layOutAlignedChild, layOutChild, renderChild, renderContent, replaceChild, setHiddenChild, setHiddenChildren, setShownChild, setShownChildren, updateStyle
-
Methods inherited from class ej.mwt.Widget
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
-
-
-
-
Constructor Detail
-
SimpleDock
public SimpleDock(boolean orientation)
Creates a simple dock specifying its orientation.- Parameters:
orientation- the orientation of the simple dock (seeLayoutOrientation).
-
-
Method Detail
-
setOrientation
public void setOrientation(boolean orientation)
Sets the orientation of this simple dock.- Parameters:
orientation- the orientation to set (seeLayoutOrientation).
-
getOrientation
public boolean getOrientation()
Gets the orientation of this simple dock.- Returns:
- the orientation of this simple dock (see
LayoutOrientation).
-
setFirstChild
public void setFirstChild(ej.mwt.Widget child)
Sets the first widget of this simple dock. If this simple dock is horizontal, the first widget is on the left side, otherwise it is on the top side.- Parameters:
child- the widget to add.- Throws:
java.lang.NullPointerException- if the given widget isnull.java.lang.IllegalArgumentException- if the specified widget is already in a hierarchy (already contained in a container or desktop).- See Also:
Container.addChild(Widget)
-
getFirstChild
@Nullable public ej.mwt.Widget getFirstChild()
Gets the first widget of this simple dock.- Returns:
- the first widget of this simple dock, or
nullis it has not been set.
-
setLastChild
public void setLastChild(ej.mwt.Widget child)
Sets the last widget of this simple dock. If this simple dock is horizontal, the last widget is on the right side, otherwise it is on the bottom side.- Parameters:
child- the widget to add.- Throws:
java.lang.NullPointerException- if the given widget isnull.java.lang.IllegalArgumentException- if the specified widget is already in a hierarchy (already contained in a container or desktop).- See Also:
Container.addChild(Widget)
-
getLastChild
@Nullable public ej.mwt.Widget getLastChild()
Gets the last widget of this simple dock.- Returns:
- the last widget of this simple dock, or
nullis it has not been set.
-
setCenterChild
public void setCenterChild(ej.mwt.Widget child)
Sets the center widget of this simple dock.- Parameters:
child- the widget to add.- Throws:
java.lang.NullPointerException- if the given widget isnull.java.lang.IllegalArgumentException- if the specified widget is already in a hierarchy (already contained in a container or desktop).- See Also:
Container.addChild(Widget)
-
getCenterChild
@Nullable public ej.mwt.Widget getCenterChild()
Gets the center widget of this simple dock.- Returns:
- the center widget of this simple dock, or
nullis it has not been set.
-
removeChild
public void removeChild(ej.mwt.Widget widget)
- Overrides:
removeChildin classej.mwt.Container
-
removeAllChildren
public void removeAllChildren()
- Overrides:
removeAllChildrenin classej.mwt.Container
-
computeContentOptimalSize
protected void computeContentOptimalSize(ej.mwt.util.Size size)
- Specified by:
computeContentOptimalSizein classej.mwt.Widget
-
layOutChildren
protected void layOutChildren(int contentWidth, int contentHeight)- Specified by:
layOutChildrenin classej.mwt.Container
-
-