| java.lang.Object org.apache.jetspeed.portlets.layout.ColumnLayout
ColumnLayout | public class ColumnLayout implements Serializable(Code) | | Basics
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.
Characteristics:
- Columns and rows always start at 0.
- Unless otherwise noted, assume all Collections returned are immutable.
- Unless otherwise noted, assume that no public method will ever return
null .
Layout Events
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 Also: org.apache.jetspeed.portlets.layout.LayoutEvent See Also: org.apache.jetspeed.portlets.layout.LayoutEventListener See Also: org.apache.jetspeed.portlets.layout.LayoutCoordinate See Also: org.apache.jetspeed.om.page.Fragment author: Scott T. Weaver |
Constructor Summary | |
public | ColumnLayout(int numberOfColumns, String layoutType, String[] columnWidths) Parameters: numberOfColumns - the maximum number of columns this layout will have. Parameters: layoutType - this value corresponds to the property settings of thefragments within your psml. | public | ColumnLayout(int numberOfColumns, String layoutType, Collection fragments, String[] columnWidths) Same as ColumnLayout(int numberOfColumns, String layoutType) but also
supplies a Collection of fragmetns to initially populate the layout
with. |
Method Summary | |
public void | addFragment(Fragment fragment)
Adds a fragment to the layout using fragment properties of
row and column as hints on where to put
this fragment. | public void | addLayoutEventListener(LayoutEventListener eventListener) Adds a LayoutEventListener to this layout that will be fired any time
a LayoutEvent is disaptched. | protected void | doAdd(int columnNumber, int rowNumber, Fragment fragment) Adds a fragment at the indicated columnNumber
and rowNumber . | protected void | doMove(Fragment fragment, LayoutCoordinate oldCoordinate, LayoutCoordinate newCoordinate) Performs the actual movement of a fragment. | public Collection | getColumn(int columnNumber) Parameters: columnNumber - Number of column to retreive requested column (as a immutable Collection). | final protected int | getColumn(Fragment fragment) Gets the row number of this fragment to looking the layoutType
property column. | public String | getColumnFloat(int columnNumber) returns the float to be used with the specified column.
Parameters: columnNumber - whose width has been requested. | final protected SortedMap | getColumnMap(int columnNumber) Retrieves this specified columnNumber as a
SortedMap. | public String | getColumnWidth(int columnNumber) returns the width to be used with the specified column. | public Collection | getColumns() java.util.Collection all of columns (alsoCollection objects) in order within this layout. | public LayoutCoordinate | getCoordinate(Fragment fragment) Parameters: fragment - fragment whose LayoutCoordinate we ant. | public Collection | getFirstColumn() The last column in this layout. | public Fragment | getFragmentAt(int columnNumber, int rowNumber) Retrieves the fragment at the specified loaction.
Parameters: columnNumber - Column coordinate (first column starts at 0) Parameters: rowNumber - Row coordinate (first row starts at 0) Fragment at the specified coordinate. | public Fragment | getFragmentAt(LayoutCoordinate coodinate) Retrieves the fragment at the specified loaction.
Parameters: coodinate - LayoutCoordinate object that will be used to located a fragment in thislayout. See Also: LayoutCoordinate Fragment at the specified coordinate. | public Collection | getFragments() Returns an immutable Collection of all the Fragments contained within
this ColumnLayout in no sepcific order. | public Collection | getLastColumn() The last column in this layout. | public int | getLastRowNumber(int columnNumber) Returns the index of the last row in the specified column.
Parameters: columnNumber - column form whom we ant to identify thelast row. | public int | getNumberOfColumns() | final protected int | getRow(int currentColumn, Fragment fragment) Gets the row number of this fragment to looking the layoutType
property row. | public void | moveDown(Fragment fragment) | public void | moveLeft(Fragment fragment) Moves a fragment one column to the left. | public void | moveRight(Fragment fragment) Moves a fragment one column to the right. | public void | moveUp(Fragment fragment) Moves a fragment one row to the up. | final protected void | processEvent(LayoutEvent event) Dispatches a LayoutEvent to all LayoutEventListeners registered to this layout. |
ColumnLayout | public ColumnLayout(int numberOfColumns, String layoutType, String[] columnWidths)(Code) | | Parameters: numberOfColumns - the maximum number of columns this layout will have. Parameters: layoutType - this value corresponds to the property settings of thefragments within your psml. Layout type allows segration ofproperty settings based on the type of layout in use. Thiseffectively allows for the interchange of multiple layoutformats without one format effecting the settings of another. Parameters: columnWidths - widths for each column that accumulate to 100% if percentagesare used. See Also: org.apache.jetspeed.om.page.Fragment.getType |
ColumnLayout | public ColumnLayout(int numberOfColumns, String layoutType, Collection fragments, String[] columnWidths) throws LayoutEventException(Code) | | Same as ColumnLayout(int numberOfColumns, String layoutType) but also
supplies a Collection of fragmetns to initially populate the layout
with. Adding these fragments WILL NOT cause
a LayoutEvent to be dispatched.
See Also: ColumnLayout(int numberOfColumns, String layoutType) Parameters: numberOfColumns - the maximum number of columns this layout will have. Parameters: layoutType - this value corresponds to the property settings of thefragments within your psml. Layout type allows segration ofproperty settings based on the type of layout in use. Thiseffectively allows for the interchange of multiple layoutformats without one format effecting the settings of another. Parameters: fragments - Initial set of fragments to add to this layout. Parameters: columnWidths - widths for each column that accumulate to 100% if percentagesare used. throws: LayoutEventException - |
addFragment | public void addFragment(Fragment fragment) throws LayoutEventException(Code) | |
Adds a fragment to the layout using fragment properties of
row and column as hints on where to put
this fragment. The following rules apply to malformed fragment
definitions:
- Fragments without a row defined are placed at the bottom of their
respective column
- Fragments without a column are placed in the right-most column.
- Fragments with overlapping row numbers. The last fragment has
priority pushing the fragment in that row down one row.
Parameters: fragment - Fragment to add to this layout. throws: LayoutEventException - See Also: org.apache.jetspeed.om.page.Fragment |
getColumn | final protected int getColumn(Fragment fragment)(Code) | | Gets the row number of this fragment to looking the layoutType
property column.
If the column is undefined or exceeds the constriants of this
layout, the value returned is numberOfColumns - 1 . If the
value is less than 0, 0 is returned.
Parameters: fragment - |
getColumnFloat | public String getColumnFloat(int columnNumber)(Code) | | returns the float to be used with the specified column.
Parameters: columnNumber - whose width has been requested. "right" for the last column, "left" if more than onecolumn, or "none" otherwise. |
getColumnWidth | public String getColumnWidth(int columnNumber)(Code) | | returns the width to be used with the specified column. If
there is no specific column setting sfor the specified column
0 is returned.
Parameters: columnNumber - whose width has been requested. the width to be used with the specified column. Or 0 if no valuehas been specified. |
getColumns | public Collection getColumns()(Code) | | java.util.Collection all of columns (alsoCollection objects) in order within this layout. All Collectionsare immutable. |
getFirstColumn | public Collection getFirstColumn()(Code) | | The last column in this layout. The Collection is immutable. |
getFragmentAt | public Fragment getFragmentAt(int columnNumber, int rowNumber) throws EmptyLayoutLocationException, InvalidLayoutLocationException(Code) | | Retrieves the fragment at the specified loaction.
Parameters: columnNumber - Column coordinate (first column starts at 0) Parameters: rowNumber - Row coordinate (first row starts at 0) Fragment at the specified coordinate. Never returns null . throws: EmptyLayoutLocationException - if there is no fragment currently located at the specified coordinate. throws: InvalidLayoutLocationException - if the coordinate lies outside the confines of this layout, i.e., thecolumnNumber exceeds the max columns setting for this layout. |
getFragments | public Collection getFragments()(Code) | | Returns an immutable Collection of all the Fragments contained within
this ColumnLayout in no sepcific order.
Immutable Collection of Fragments. |
getLastColumn | public Collection getLastColumn()(Code) | | The last column in this layout. The Collection is immutable. |
getLastRowNumber | public int getLastRowNumber(int columnNumber)(Code) | | Returns the index of the last row in the specified column.
Parameters: columnNumber - column form whom we ant to identify thelast row. the index of the last row in the specified column. |
getNumberOfColumns | public int getNumberOfColumns()(Code) | | The total number of columns in this layout. |
getRow | final protected int getRow(int currentColumn, Fragment fragment)(Code) | | Gets the row number of this fragment to looking the layoutType
property row. If this property is undefined, the bottom-most row
number of currentColumn is returned.
Parameters: currentColumn - Parameters: fragment - valid row for this fragment within this layout. |
|
|