public class Dock extends StyledComposite
Each child can be pushed towards any direction. One child can be set to the center.
The dock manages multiple widgets per side.
Following the addition order, each widget is pushed against the side of the remaining area. The remaining area is decreased by each children size (width for left and right, height for top and bottom). The center widget (if any) fills the remaining area.
Example of dock that contains (added in this order):
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
Dock()
Creates a dock composite.
|
Modifier and Type | Method and Description |
---|---|
void |
addBottom(Widget widget)
Docks a widget to the bottom of this composite.
|
void |
addLeft(Widget widget)
Docks a widget to the left of this composite.
|
void |
addRight(Widget widget)
Docks a widget to the right of this composite.
|
void |
addTop(Widget widget)
Docks a widget to the top of this composite.
|
void |
remove(Widget widget)
Removes the specified widget from the list of children of this composite.
|
void |
removeAllWidgets()
Removes all the widgets from the list of children of this composite.
|
void |
removeCenter()
Removes the center widget of this dock.
|
protected void |
setBoundsContent(Rectangle bounds)
Sets the bounds of this widget by taking into account the border, margin and padding specified in the style.
|
void |
setCenter(Widget widget)
Sets the center widget of this composite.
|
Rectangle |
validateContent(Style style,
Rectangle bounds)
Gets the content size of the renderable without the border, margin and padding specified in the style.
|
add, addClassSelector, contains, gainFocus, getAttribute, getChild, getChildrenCount, getChildrenElements, getParentElement, getStyle, hasClassSelector, isInState, isTransparent, lostFocus, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, renderContent, setBounds, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getFocus, getFocusIndex, getNext, getWidget, getWidgetAt, getWidgets, getWidgetsCount, handleEvent, hideNotify, iterator, requestFocus, requestFocus, requestFocusFrom, showNotify
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, revalidate, revalidateSubTree, setEventHandler, setLocation, setPreferredSize, setSize, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEventHandler, getHeight, getWidth, getX, getY, handleEvent, hideNotify, isShown, repaint, repaint, setEventHandler, showNotify
public void addLeft(Widget widget)
widget
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the given widget or one of its children is already connected to a panel.StyledComposite.add(Widget)
public void addRight(Widget widget)
widget
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the given widget or one of its children is already connected to a panel.StyledComposite.add(Widget)
public void addTop(Widget widget)
widget
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the given widget or one of its children is already connected to a panel.StyledComposite.add(Widget)
public void addBottom(Widget widget)
widget
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the given widget or one of its children is already connected to a panel.StyledComposite.add(Widget)
public void setCenter(Widget widget)
widget
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the given widget or one of its children is already connected to a panel.StyledComposite.add(Widget)
public void remove(Widget widget)
Composite
If the composite is on a panel hierarchy, it is invalidated.
If the widget is not in the list of children of the composite, nothing is done.
remove
in class Composite
widget
- the widget to removeWidget.invalidate()
public void removeCenter()
remove(Widget)
public void removeAllWidgets()
Composite
If the composite is on a panel hierarchy, it is invalidated.
removeAllWidgets
in class Composite
Widget.invalidate()
public Rectangle validateContent(Style style, Rectangle bounds)
StyledComposite
Lays out the children of this composite.
validateContent
in interface StyledRenderable
validateContent
in class StyledComposite
style
- the style to use.bounds
- the bounds available for the content. A width or a height equals to MWT.NONE
means no
constraint on this dimension.protected void setBoundsContent(Rectangle bounds)
StyledComposite
setBoundsContent
in class StyledComposite
bounds
- the bounds available for the content.