|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jetspeed.portlets.layout.ColumnLayout
public class ColumnLayout
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.
LayoutEvent
,
LayoutEventListener
,
LayoutCoordinate
,
Fragment
,
Serialized FormField Summary | |
---|---|
private SortedMap |
columns
SortedMap of Columns (which are also sorted maps |
private String[] |
columnWidths
Width settings for eacah column |
private Map |
coordinates
maps Fragments (key) to it's current LayoutCoordinate (value) in this layout |
private List |
eventListeners
All of the LayoutEventListeners registered to this layout |
private int[] |
nextRowNumber
Efficent way to always be aware of the next available row in a column |
private int |
numberOfColumns
Constrains the columns for this layout |
private static DecimalFormat |
PERCENTAGE_WIDTH_FORMAT
Percentage widths format |
private static double |
PERCENTAGE_WIDTH_GUTTER
Percentage widths gutter width |
Constructor Summary | |
---|---|
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. |
|
ColumnLayout(int numberOfColumns,
String layoutType,
String[] columnWidths)
|
Method Summary | |
---|---|
void |
addFragment(org.apache.jetspeed.om.page.Fragment fragment)
Adds a fragment to the layout using fragment properties of row and column as hints on where to put
this fragment. |
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,
org.apache.jetspeed.om.page.Fragment fragment)
Adds a fragment at the indicated columnNumber
and rowNumber . |
protected void |
doMove(org.apache.jetspeed.om.page.Fragment fragment,
LayoutCoordinate oldCoordinate,
LayoutCoordinate newCoordinate)
Performs the actual movement of a fragment. |
protected int |
getColumn(org.apache.jetspeed.om.page.Fragment fragment)
Gets the row number of this fragment to looking the layoutType
property column. |
Collection |
getColumn(int columnNumber)
|
String |
getColumnFloat(int columnNumber)
returns the float to be used with the specified column. |
protected SortedMap |
getColumnMap(int columnNumber)
Retrieves this specified columnNumber as a
SortedMap. |
Collection |
getColumns()
|
String |
getColumnWidth(int columnNumber)
returns the width to be used with the specified column. |
LayoutCoordinate |
getCoordinate(org.apache.jetspeed.om.page.Fragment fragment)
|
Collection |
getFirstColumn()
|
org.apache.jetspeed.om.page.Fragment |
getFragmentAt(int columnNumber,
int rowNumber)
Retrieves the fragment at the specified loaction. |
org.apache.jetspeed.om.page.Fragment |
getFragmentAt(LayoutCoordinate coodinate)
Retrieves the fragment at the specified loaction. |
Collection |
getFragments()
Returns an immutable Collection of all the Fragments contained within this ColumnLayout in no sepcific order. |
Collection |
getLastColumn()
|
int |
getLastRowNumber(int columnNumber)
Returns the index of the last row in the specified column. |
int |
getNumberOfColumns()
|
protected int |
getRow(int currentColumn,
org.apache.jetspeed.om.page.Fragment fragment)
Gets the row number of this fragment to looking the layoutType
property row. |
void |
moveDown(org.apache.jetspeed.om.page.Fragment fragment)
|
void |
moveLeft(org.apache.jetspeed.om.page.Fragment fragment)
Moves a fragment one column to the left. |
void |
moveRight(org.apache.jetspeed.om.page.Fragment fragment)
Moves a fragment one column to the right. |
void |
moveUp(org.apache.jetspeed.om.page.Fragment fragment)
Moves a fragment one row to the up. |
protected void |
processEvent(LayoutEvent event)
Dispatches a LayoutEvent to all LayoutEventListeners registered to this layout. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final double PERCENTAGE_WIDTH_GUTTER
private static final DecimalFormat PERCENTAGE_WIDTH_FORMAT
private final int numberOfColumns
private final SortedMap columns
private final String[] columnWidths
private final int[] nextRowNumber
private final Map coordinates
private final List eventListeners
Constructor Detail |
---|
public ColumnLayout(int numberOfColumns, String layoutType, String[] columnWidths)
numberOfColumns
- the maximum number of columns this layout will have.layoutType
- this value corresponds to the property settings of the
fragments within your psml. Layout type allows segration of
property settings based on the type of layout in use. This
effectively allows for the interchange of multiple layout
formats without one format effecting the settings of another.columnWidths
- widths for each column that accumulate to 100% if percentages
are used.Fragment.getType()
public ColumnLayout(int numberOfColumns, String layoutType, Collection fragments, String[] columnWidths) throws LayoutEventException
numberOfColumns
- the maximum number of columns this layout will have.layoutType
- this value corresponds to the property settings of the
fragments within your psml. Layout type allows segration of
property settings based on the type of layout in use. This
effectively allows for the interchange of multiple layout
formats without one format effecting the settings of another.fragments
- Initial set of fragments to add to this layout.columnWidths
- widths for each column that accumulate to 100% if percentages
are used.
LayoutEventException
ColumnLayout(int numberOfColumns, String layoutType)
Method Detail |
---|
public void addFragment(org.apache.jetspeed.om.page.Fragment fragment) throws LayoutEventException
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:
fragment
- Fragment to add to this layout.
LayoutEventException
Fragment
public void addLayoutEventListener(LayoutEventListener eventListener)
eventListener
- LayoutEventListener
,
LayoutEventListener
public Collection getColumn(int columnNumber) throws InvalidLayoutLocationException
columnNumber
- Number of column to retreive
null.
InvalidLayoutLocationException
- if the column is outisde of the constraints of this layoutpublic String getColumnWidth(int columnNumber)
columnNumber
- whose width has been requested.
public String getColumnFloat(int columnNumber)
columnNumber
- whose width has been requested.
public Collection getColumns()
java.util.Collection
all of columns (also
Collection objects) in order within this layout. All Collections
are immutable.public int getLastRowNumber(int columnNumber)
columnNumber
- column form whom we ant to identify the
last row.
public Collection getFragments()
public org.apache.jetspeed.om.page.Fragment getFragmentAt(int columnNumber, int rowNumber) throws EmptyLayoutLocationException, InvalidLayoutLocationException
columnNumber
- Column coordinate (first column starts at 0)rowNumber
- Row coordinate (first row starts at 0)
null
.
EmptyLayoutLocationException
- if there is no fragment currently located at the specified coordinate.
InvalidLayoutLocationException
- if the coordinate lies outside the confines of this layout, i.e., the
columnNumber
exceeds the max columns setting for this layout.public org.apache.jetspeed.om.page.Fragment getFragmentAt(LayoutCoordinate coodinate) throws EmptyLayoutLocationException, InvalidLayoutLocationException
coodinate
- LayoutCoordinate object that will be used to located a fragment in this
layout.
null
.
EmptyLayoutLocationException
- if there is no fragment currently located at the specified coordinate.
InvalidLayoutLocationException
- if the coordinate lies outside the confines of this layout, i.e., the
columnNumber
exceeds the max columns setting for this layout.LayoutCoordinate
,
LayoutCoordinate
public int getNumberOfColumns()
public Collection getLastColumn()
public Collection getFirstColumn()
public void moveRight(org.apache.jetspeed.om.page.Fragment fragment) throws FragmentNotInLayoutException, LayoutEventException
If the fragment currently resides in right-most column, no action is taking and no event LayoutEvent is fired.
fragment
- fragment to move.
FragmentNotInLayoutException
- if the specified fragment is not currently in the layout.
LayoutEventException
- If a triggered LayoutEvent fails.public void moveLeft(org.apache.jetspeed.om.page.Fragment fragment) throws FragmentNotInLayoutException, LayoutEventException
If the fragment currently resides in left-most column, no action is taking and no event LayoutEvent is fired.
fragment
-
FragmentNotInLayoutException
- if the specified fragment is not currently in the layout.
LayoutEventException
- If a triggered LayoutEvent fails.public void moveUp(org.apache.jetspeed.om.page.Fragment fragment) throws FragmentNotInLayoutException, LayoutEventException
If the fragment currently resides in top-most row, no action is taking and no event LayoutEvent is fired.
fragment
-
FragmentNotInLayoutException
- if the specified fragment is not currently in the layout.
LayoutEventException
- If a triggered LayoutEvent fails.public void moveDown(org.apache.jetspeed.om.page.Fragment fragment) throws FragmentNotInLayoutException, LayoutEventException
fragment
-
FragmentNotInLayoutException
- if the specified fragment is not currently in the layout.
LayoutEventException
- If a triggered LayoutEvent fails.protected void doMove(org.apache.jetspeed.om.page.Fragment fragment, LayoutCoordinate oldCoordinate, LayoutCoordinate newCoordinate) throws InvalidLayoutLocationException, LayoutEventException
fragment
- oldCoordinate
- newCoordinate
-
InvalidLayoutLocationException
LayoutEventException
public LayoutCoordinate getCoordinate(org.apache.jetspeed.om.page.Fragment fragment) throws FragmentNotInLayoutException
fragment
- fragment whose LayoutCoordinate we ant.
FragmentNotInLayoutException
- if the Fragment is not present in this layout.LayoutCoordinate
protected void doAdd(int columnNumber, int rowNumber, org.apache.jetspeed.om.page.Fragment fragment) throws InvalidLayoutLocationException, LayoutEventException
columnNumber
and rowNumber
.
columnNumber
- rowNumber
- fragment
-
InvalidLayoutLocationException
- if the coordinates are outside the bounds of this layout.
LayoutEventException
- id a LayoutEvent failsprotected final SortedMap getColumnMap(int columnNumber) throws InvalidLayoutLocationException
columnNumber
as a
SortedMap.
columnNumber
-
InvalidLayoutLocationException
- if the columnNumber
resides
outside the bounds of this layout.protected final int getRow(int currentColumn, org.apache.jetspeed.om.page.Fragment fragment)
layoutType
property row. If this property is undefined, the bottom-most row
number of currentColumn
is returned.
currentColumn
- fragment
-
protected final int getColumn(org.apache.jetspeed.om.page.Fragment fragment)
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.
fragment
-
protected final void processEvent(LayoutEvent event) throws LayoutEventException
event
-
LayoutEventException
- if an error occurs while processing a the LayoutEvent.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |