|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object echopoint.layout.AbstractLayoutManager echopoint.layout.GridLayoutManager
The GridLayoutManager
allows Components to be
laid out using a grid patterm. It maintains a current "cursor"
{col,row} to allow Components to be easily added and it also maintains
a width and height.
The simplest way to use this class is to add Components without
CellConstraints
objects. This will add them in
order (using the cursor) expanding the height of the grid as
necessary. If a Component is already in a cell, then the cursor
will be moved to the next empty cell and the component will be placed
there.
If you want, CellConstraints
objects can be used to allow
Components to be placed at specific positions or to span a number of
columns or rows. When these constraints are used, they must fit within
the current grid dimensions or an OutOfBoundsException
will
be thrown. The grid is never "auto-expanded" when
using CellConstraints
objects.
You must also ensure that the CellConstraints
objects do
not overlap otherwise an OverlapException
will be thrown
If a row has no components in it, for example newLine() is called in the first column, then nothing will be rendered in that row.
Nested Class Summary | |
static class |
GridLayoutManager.CellConstraints
This class is designed to be used as a contraints object with GridLayoutManager. |
class |
GridLayoutManager.OutOfBoundsException
An OutOfBoundsException exception is thrown
if any of the CellConstraints constaints are outside
the width or height of the GridLayoutManager.
|
class |
GridLayoutManager.OverlapException
An OverlapException exception is thrown
if any of the CellConstraints constaints overlap.
|
Field Summary | |
static int |
EVEN_CENTER
Can be OR'ed onto an alignment value to make even columns align center |
static int |
EVEN_LEFT
Can be OR'ed onto an alignment value to make even columns align left |
static int |
EVEN_RIGHT
Can be OR'ed onto an alignment value to make even columns align right |
static int |
HORZ_ALIGNMENT_MASK
a bit mask that removes the ODD/EVEN alignment values |
static int |
ODD_CENTER
Can be OR'ed onto an alignment value to make odd columns align center |
static int |
ODD_LEFT
Can be OR'ed onto an alignment value to make odd columns align left |
static int |
ODD_RIGHT
Can be OR'ed onto an alignment value to make odd columns align right |
Fields inherited from class echopoint.layout.AbstractLayoutManager |
componentMap, layoutManageableWR |
Constructor Summary | |
GridLayoutManager()
Constructs a GridLayoutManager that is define as 1 x 1000. |
|
GridLayoutManager(int width,
int height)
Constructs a GridLayoutManager with the specified width and height. |
Method Summary | |
void |
addLayoutComponent(nextapp.echo.Component comp)
Adds a component to the LayoutManager in the next available cell. |
void |
addLayoutComponent(nextapp.echo.Component comp,
java.lang.Object constraints)
Adds a component to the LayoutManager with the specified contraints object. |
int |
getCellSpacing()
Gets the cellspacing of the GridLayoutManager |
nextapp.echo.Component |
getComponent(int col,
int row)
This returns the Component currently at position {col,row} or null if no component is currently there. |
GridLayoutManager.CellConstraints |
getContraints(int col,
int row)
This returns the GridCellConstraint currently at position {col,row} or null if no component is currently there. |
int |
getCursorColumn()
Returns the current Column position of the Grid cursor. |
int |
getCursorRow()
Returns the current Row position of the Grid cursor |
int |
getHeight()
Gets the height of the GridLayoutManager |
int |
getHorizontalAlignment()
Gets the horizontal alignment of the GridLayoutManager. |
int |
getVerticalAlignment()
Gets the vertical alignment of the GridLayoutManager. |
int |
getWidth()
Sets the height of the GridLayoutManager |
boolean |
isFullHeight()
Returns TRUE if the GridLayoutManager will fill its
parents full height |
boolean |
isFullWidth()
Returns TRUE if the GridLayoutManager will fill its
parents full width |
void |
newLine()
Moves the current cursor position down a row and to the first column (col == 0) in the grid. |
void |
removeLayoutComponent(nextapp.echo.Component comp)
Removes a component from the LayoutManager. |
void |
removeLayoutComponent(int col,
int row)
Removes a component from the GridLayoutManager at the specified position. |
void |
setCellSpacing(int newCellSpacing)
Sets the cell spacing of the GridLayoutManager |
void |
setCursorColumn(int newColumn)
Sets the current Column position of the Grid cursor. |
void |
setCursorRow(int newRow)
Sets the current Row position of the Grid cursor |
void |
setFullHeight(boolean newFullHeight)
If this is TRUE then the GridLayoutManager will fill its
parents full height. |
void |
setFullWidth(boolean newFullWidth)
If this is TRUE then the GridLayoutManager will fill its
parents full width. |
void |
setHeight(int newHeight)
Sets the height of the GridLayoutManager. |
void |
setHorizontalAlignment(int newHorizontalAlignment)
Sets the horizontal alignment of the GridLayoutManager. |
void |
setVerticalAlignment(int newVerticalAlignment)
Sets the vertical alignment of the GridLayoutManager. |
void |
setWidth(int newWidth)
Sets the width of the GridLayoutManager. |
void |
space()
Moves the current cursor position along one column. |
java.lang.String |
toString()
|
Methods inherited from class echopoint.layout.AbstractLayoutManager |
getComponent, getComponentMap, getContraints, getLayoutManageable, invalidateLayout, setLayoutManageable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int ODD_LEFT
public static final int ODD_RIGHT
public static final int ODD_CENTER
public static final int EVEN_LEFT
public static final int EVEN_RIGHT
public static final int EVEN_CENTER
public static final int HORZ_ALIGNMENT_MASK
Constructor Detail |
public GridLayoutManager()
Therefore If you add Components to this grid without
specifying the co-ordinates, then the Components will line up
left to right until you call GridLayoutManager.newLine();
public GridLayoutManager(int width, int height)
Method Detail |
public void addLayoutComponent(nextapp.echo.Component comp) throws GridLayoutManager.OutOfBoundsException, GridLayoutManager.OverlapException
The Component will be added at the current cursor position. If the cell at the current cursor position has a Component it it, the new Component will added at the next available cell, extending the grid down as required.
Also note that the cursor is moved to the next logical position for adding a new Component.
This method is not intended to be called by any other than an LayoutManageable during Component add().
GridLayoutManager.OutOfBoundsException
GridLayoutManager.OverlapException
public void addLayoutComponent(nextapp.echo.Component comp, java.lang.Object constraints) throws GridLayoutManager.OutOfBoundsException, GridLayoutManager.OverlapException
This method is not intended to be called by any other than an LayoutManageable during Component add().
addLayoutComponent
in interface LayoutManager
addLayoutComponent
in class AbstractLayoutManager
GridLayoutManager.OutOfBoundsException
GridLayoutManager.OverlapException
public int getCellSpacing()
public nextapp.echo.Component getComponent(int col, int row)
public GridLayoutManager.CellConstraints getContraints(int col, int row)
public int getCursorColumn()
public int getCursorRow()
public int getHeight()
public int getHorizontalAlignment()
This can be one of the EchoConstant values :
You can also "OR" on the following values to overrride the above
public int getVerticalAlignment()
This can be one of the EchoConstant values :
public int getWidth()
public boolean isFullHeight()
GridLayoutManager
will fill its
parents full height
public boolean isFullWidth()
GridLayoutManager
will fill its
parents full width
public void newLine()
public void removeLayoutComponent(int col, int row)
public void removeLayoutComponent(nextapp.echo.Component comp)
removeLayoutComponent
in interface LayoutManager
removeLayoutComponent
in class AbstractLayoutManager
public void setCellSpacing(int newCellSpacing)
newCellSpacing
- intpublic void setCursorColumn(int newColumn)
public void setCursorRow(int newRow)
public void setFullHeight(boolean newFullHeight)
GridLayoutManager
will fill its
parents full height.
newFullHeight
- booleanpublic void setFullWidth(boolean newFullWidth)
GridLayoutManager
will fill its
parents full width.
newFullWidth
- booleanpublic void setHeight(int newHeight) throws GridLayoutManager.OutOfBoundsException
newHeight
- int
GridLayoutManager.OutOfBoundsException
public void setHorizontalAlignment(int newHorizontalAlignment)
This can be one of the EchoConstant values :
You can also "OR" on the following values to overrride the above
newHorizontalAlignment
- intpublic void setVerticalAlignment(int newVerticalAlignment)
This can be one of the EchoConstant values :
newVerticalAlignment
- intpublic void setWidth(int newWidth) throws GridLayoutManager.OutOfBoundsException
newWidth
- int
GridLayoutManager.OutOfBoundsException
public void space()
public java.lang.String toString()
Object.toString()
|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |