Class HorizontalPanel

public class HorizontalPanel
extends CellPanel
implements HasAlignment
A panel that lays all of its widgets out in a single horizontal column.

Constructors

HorizontalPanel()Creates an empty horizontal panel.

Methods

add(Widget)
getHorizontalAlignment()Gets the horizontal alignment.
getVerticalAlignment()Gets the vertical alignment.
insert(Widget, int)Inserts a widget into the panel
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 default horizontal alignment to be used for widgets added to this panel.
setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant)Sets the default vertical alignment to be used for widgets added to this panel.

Constructor Detail

HorizontalPanel

public HorizontalPanel()
Creates an empty horizontal panel.

Method Detail

add

public boolean add(Widget w)

Parameters

w

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.

insert

public boolean insert(Widget w, int beforeIndex)
Inserts a widget into the panel

Parameters

w
the widget to be inserted
beforeIndex
the index before which it will be inserted

Return Value

true on success (some panels place restrictions on how children may be added or inserted)

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 default horizontal alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.

Parameters

align

See Also

HasHorizontalAlignment.setHorizontalAlignment(HorizontalAlignmentConstant)

setVerticalAlignment

public void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)
Sets the default vertical alignment to be used for widgets added to this panel. It only applies to widgets added after this property is set.

Parameters

align

See Also

HasVerticalAlignment.setVerticalAlignment(VerticalAlignmentConstant)