LayoutContainer container = new LayoutContainer(); container.setLayout(new ColumnLayout()); container.add(new Button("100px"), new ColumnData(100)); container.add(new Button("30%"), new ColumnData(.3)); container.add(new Button("50px"), new ColumnData(50));
@see ColumnData
This is the layout style of choice for creating structural layouts in a multi-column format where the width of each column can be specified as a percentage or fixed width, but the height is allowed to vary based on the content.
ColumnLayout does not have any direct config options (other than inherited ones), but it does support a specific config property of columnWidth that can be included in the config of any panel added to it. The layout will use the width (if pixels) or columnWidth (if percent) of each panel during layout to determine how to size each panel. If width or columnWidth is not specified for a given panel, its width will default to the panel's width (or auto).
The width property is always evaluated as pixels, and must be a number greater than or equal to 1. The columnWidth property is always evaluated as a percentage, and must be a decimal value greater than 0 and less than 1 (e.g., .25).
The basic rules for specifying column widths are pretty simple. The logic makes two passes through the set of contained panels. During the first layout pass, all panels that either have a fixed width or none specified (auto) are skipped, but their widths are subtracted from the overall container width. During the second pass, all panels with columnWidths are assigned pixel widths in proportion to their percentages based on the total remaining container width. In other words, percentage width panels are designed to fill the space left over by all the fixed-width or auto-width panels. Because of this, while you can specify any number of columns with different percentages, the columnWidths must always add up to 1 (or 100%) when added together, otherwise your layout may not render as expected. @author Sanjiv Jivan @see com.gwtext.client.widgets.layout.ColumnLayoutData
isAligned
method returns true
, or the layout's fixedWidth
flag is set (via the two parameter constructor).
ColumnLayout
is the model used to support any 1 to n column-based layout. ColumnLayout
is constrained by a number columns that will not be exceeded, even if a fragment specifies a column outside of this constraint. Any fragment exceeded the specified column constraint will be deposited into the right-most column.
null
.When any move*() method is invoked and a portlet is actually moved (see indvidual methods for what causes these circumstances), an initial LayoutEvent is dispatched. This may cause a cascade of LayoutEvents to be fired in turn if the movement of the target fragment cause other fragments to be repositioned. In this case a LayoutEvent is dispatched for each portlet moved, which in turn may our may not cause another LayoutEvent to be fired.
@see org.apache.jetspeed.portlets.layout.LayoutEvent @see org.apache.jetspeed.portlets.layout.LayoutEventListener @see org.apache.jetspeed.portlets.layout.LayoutCoordinate @see org.apache.jetspeed.om.page.Fragment @authorIn addition, the layout attempts to 'fill the space' equally i.e. to avoid large gaps at the and of the last column.
Child controls are layed out according to their 'natural' (preferred) size. For 'stretchy' controls that do not have natural preferred size, it is possible to set width and/or height hints using ColumnLayoutData objects. @see ColumnLayoutData @since 3.0
|
|
|
|
|
|
|
|