Class DockPanel

public class DockPanel
extends CellPanel
implements HasAlignment
A panel that lays its child widgets out "docked" at its outer edges, and allows its last widget to take up the remaining space in its center.

Nested Classes

DockPanel.DockLayoutConstantDockPanel layout constant, used in DockPanel.add(Widget, DockLayoutConstant).

Fields

CENTERSpecifies that a widget be added at the center of the dock.
EASTSpecifies that a widget be added at the east edge of the dock.
NORTHSpecifies that a widget be added at the north edge of the dock.
SOUTHSpecifies that a widget be added at the south edge of the dock.
WESTSpecifies that a widget be added at the west edge of the dock.

Constructors

DockPanel()Creates an empty dock panel.

Methods

add(Widget)
add(Widget, DockPanel.DockLayoutConstant)Adds a widget to the specified edge of the dock.
getHorizontalAlignment()Gets the horizontal alignment.
getVerticalAlignment()Gets the vertical alignment.
onLoad()This method is called when the widget becomes attached to the browser's document.
remove(Widget)
setCellHeight(Widget, String)Sets the height of the cell associated with the given widget, related to the panel as a whole.
setCellHorizontalAlignment(Widget, HasHorizontalAlignment.HorizontalAlignmentConstant)Sets the horizontal alignment of the given widget within its cell
setCellVerticalAlignment(Widget, HasVerticalAlignment.VerticalAlignmentConstant)Sets the vertical alignment of the given widget within its cell
setCellWidth(Widget, String)Sets the width of the cell associated with the given widget, related to the panel as a whole.
setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant)Sets the horizontal alignment.
setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant)Sets the vertical alignment.

Field Detail

CENTER

public static final DockPanel.DockLayoutConstant CENTER
Specifies that a widget be added at the center of the dock.

EAST

public static final DockPanel.DockLayoutConstant EAST
Specifies that a widget be added at the east edge of the dock.

NORTH

public static final DockPanel.DockLayoutConstant NORTH
Specifies that a widget be added at the north edge of the dock.

SOUTH

public static final DockPanel.DockLayoutConstant SOUTH
Specifies that a widget be added at the south edge of the dock.

WEST

public static final DockPanel.DockLayoutConstant WEST
Specifies that a widget be added at the west edge of the dock.

Constructor Detail

DockPanel

public DockPanel()
Creates an empty dock panel.

Method Detail

add

public boolean add(Widget w)

Parameters

w

add

public boolean add(Widget widget, DockPanel.DockLayoutConstant direction)
Adds a widget to the specified edge of the dock.

Parameters

widget
the widget to be added
direction
the widget's direction in the dock

Return Value

true if successful (no widgets may be added after the CENTER widget)

getHorizontalAlignment

public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
Gets the horizontal alignment.

Return Value

the current horizontal alignment.

getVerticalAlignment

public HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()
Gets the vertical alignment.

Return Value

the current vertical alignment.

onLoad

protected void onLoad()
This method is called when the widget becomes attached to the browser's document.

remove

public boolean remove(Widget w)

Parameters

w

setCellHeight

public abstract void setCellHeight(Widget w, String height)
Sets the height of the cell associated with the given widget, related to the panel as a whole.

Parameters

w
the widget whose cell height is to be set
height
the cell's height, in CSS units

setCellHorizontalAlignment

public abstract void setCellHorizontalAlignment(Widget w, HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment of the given widget within its cell

Parameters

w
the widget whose horizontal alignment is to be set
align
the widget's horizontal alignment, as defined in HasHorizontalAlignment.

setCellVerticalAlignment

public abstract void setCellVerticalAlignment(Widget w, HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the vertical alignment of the given widget within its cell

Parameters

w
the widget whose vertical alignment is to be set
align
the widget's vertical alignment, as defined in HasVerticalAlignment.

setCellWidth

public abstract void setCellWidth(Widget w, String width)
Sets the width of the cell associated with the given widget, related to the panel as a whole.

Parameters

w
the widget whose cell width is to be set
width
the cell's width, in CSS units

setHorizontalAlignment

public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment.

Parameters

align
the horizontal alignment ( HasHorizontalAlignment.ALIGN_LEFT, HasHorizontalAlignment.ALIGN_CENTER, or HasHorizontalAlignment.ALIGN_RIGHT).

setVerticalAlignment

public void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the vertical alignment.

Parameters

align
the vertical alignment ( HasVerticalAlignment.ALIGN_TOP, HasVerticalAlignment.ALIGN_MIDDLE, or HasVerticalAlignment.ALIGN_BOTTOM).