|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.ui.Field
net.rim.device.api.ui.Manager
net.rim.device.api.ui.container.GridFieldManager
public class GridFieldManager
A grid-based manager.
A GridFieldManager is created with a fixed number of rows and columns. Fields may be
added to the grid either in the next empty cell with the add()
method or inserted
at a specific row and column location using the insert()
method.
Row and column heights and widths may be specified as fixed sizes or may be automatically sized with the available space divided evenly among the rows and columns.
The grid will scroll vertically if the heights of the rows exceeds the visible height of the grid, and will scroll horizontally if the widths of the columns exceedst he visible width of the grid.
The cells in the grid are indexed from zero to (number of cells - 1).
Field Summary | ||
---|---|---|
static int |
AUTO_SIZE
Indicates that rows or columns should be automatically sized, with the available space divided evently among the rows or columns. |
|
static int |
FIXED_SIZE
Indicates that rows and columns should have fixed sizes which can be specified with either setColumnProperty or setRowProperty |
|
static int |
PREFERRED_SIZE
Indicates that rows and columns should be sized according to the preferred size of the contained fields. |
|
static int |
PREFERRED_SIZE_WITH_MAXIMUM
Indicates that rows and columns should be sized according to the preferred size of the contained fields, with a specified maximum. |
Fields inherited from class net.rim.device.api.ui.Manager |
---|
BOTTOMMOST, DOWNWARD, HORIZONTAL_SCROLL, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_MASK, HORIZONTAL_SCROLL_MASK, LEAVE_BLANK_SPACE, LEFTMOST, LEFTWARD, NO_HORIZONTAL_SCROLL, NO_HORIZONTAL_SCROLLBAR, NO_SCROLL_RESET, NO_VERTICAL_SCROLL, NO_VERTICAL_SCROLLBAR, QUANTA_FONT, RIGHTMOST, RIGHTWARD, TOPMOST, UPWARD, VERTICAL_SCROLL, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_MASK, VERTICAL_SCROLL_MASK |
Constructor Summary | ||
---|---|---|
GridFieldManager(int rows,
int columns,
long style)
Constructs a GridFieldManager |
Method Summary | ||
---|---|---|
void |
add(Field field)
Adds the given field to the first unoccupied cell in the grid. |
|
void |
add(Field field,
long style)
Adds a field to the first unoccupied cell in the grid. |
|
void |
delete(int row,
int column)
Removes a field from this manager. |
|
void |
delete(Field field)
Removes a field from this manager. |
|
void |
deleteAll()
Removes all fields from this manager. |
|
void |
deleteRange(int start,
int count)
Removes a range of fields from this manager. |
|
void |
deleteRange(int startRow,
int startColumn,
int count)
Removes a range of fields |
|
int |
getColumnCount()
Returns the number of columns in the grid. |
|
int |
getColumnPadding()
Returns the padding between columns. |
|
int |
getColumnWidth(int column)
Returns the width of the specified column. |
|
Field |
getFieldAtCell(int row,
int column)
Returns the Field contained in the cell specified by the given row and column |
|
Field |
getFieldAtIndex(int index)
Returns the field at the given index. |
|
int |
getFieldCount()
Retrieves number of fields controlled by this manager. |
|
int |
getRowCount()
Returns the number of rows in the grid. |
|
int |
getRowHeight(int row)
Returns the height of the specified row. |
|
int |
getRowPadding()
Returns the padding between rows. |
|
void |
insert(Field field,
int index)
Inserts a field at a given index. |
|
void |
insert(Field field,
int row,
int column)
Inserts a field at the cell specified by a row and column. |
|
void |
insert(Field field,
int row,
int column,
long style)
Inserts a field at the cell specified by a row and column. |
|
void |
insert(Field field,
int index,
long style)
Inserts a field at a given index. |
|
int |
nextFocus(int direction,
int axis)
Retrieves the index of the next field that should be given focus. |
|
void |
set(Field field,
int row,
int column)
Sets the field at the specified row and column. |
|
void |
set(Field field,
int row,
int column,
long style)
Sets the field at the specified row and column. |
|
void |
setCellPadding(int padding)
Sets the inner cell padding. |
|
void |
setColumnPadding(int padding)
Sets the padding between columns, in pixels. |
|
void |
setColumnProperty(int column,
int property,
int value)
Sets a column property. |
|
void |
setRowPadding(int padding)
Sets the padding between rows, in pixels. |
|
void |
setRowProperty(int row,
int property,
int value)
Sets a row property. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PREFERRED_SIZE
public static final int PREFERRED_SIZE_WITH_MAXIMUM
public static final int AUTO_SIZE
public static final int FIXED_SIZE
setColumnProperty
or setRowProperty
Constructor Detail |
---|
public GridFieldManager(int rows, int columns, long style)
rows
- the number of rows in the gridcolumns
- the number of columns in the gridstyle
- the style bits to be used by the managerMethod Detail |
---|
public void add(Field field)
add
in class Manager
field
- the field to add to the grid
IllegalStateException
- if the grid is already fullpublic void add(Field field, long style)
field
- the field to add to the gridstyle
- allows specification of field alignment
IllegalStateException
- if the grid is already fullpublic void set(Field field, int row, int column)
field
- the field to addrow
- the row at which to add the fieldcolumn
- the column at which to add the field
IllegalStateException
- if the grid is already full
IllegalStateException
- if the grid is already fullpublic void set(Field field, int row, int column, long style)
field
- the field to addrow
- the row at which to add the fieldcolumn
- the column at which to add the fieldstyle
- for specifying the alignment of the field within the cell
IllegalStateException
- if the grid is already fullpublic void delete(Field field)
delete
in class Manager
field
- the field to removepublic void delete(int row, int column)
row
- the row from which to remove the fieldcolumn
- the column from which to remove the field
IllegalArgumentException
- if 'row' or 'column' is invalidpublic void deleteAll()
Manager
Invoking this method has the same effect as
manager.deleteRange( 0, manager.getFieldCount() )
deleteAll
in class Manager
Manager.deleteAll()
public void deleteRange(int start, int count)
deleteRange
in class Manager
start
- the index of the first field to removecount
- the number of fields to remove. Empty cells encountered will contribute to the count of deleted fields.
IndexOutOfBoundsException
- if start or count are invalidpublic void deleteRange(int startRow, int startColumn, int count)
startRow
- the row at which to start deletingstartColumn
- the column at which to start deletingcount
- the number of fields to delete. Empty cells encountered will contribute to the count of deleted fields.
IllegalArgumentException
- if startRow or startColumn are invalidpublic int getColumnCount()
public int getFieldCount()
Manager
getFieldCount
in class Manager
Manager.getFieldCount()
public int getRowCount()
public int getColumnPadding()
public Field getFieldAtIndex(int index)
index
- the cell index of the field
public Field getFieldAtCell(int row, int column)
row
- the row of the cellcolumn
- the column of the cell
public int getRowPadding()
public void insert(Field field, int index)
insert
in class Manager
field
- the field to insertindex
- the index at which to insert the field. The field with occupy the cell at the given index and will push
any fields at a greater or equal index to the next cell.
IllegalStateException
- if grid is already full. Empty cells at an equal or greater value than 'index' will
be filled first.public void insert(Field field, int index, long style)
field
- the field to insertindex
- the index at which to insert the field. The field with occupy the cell at the given index and will push
any fields at a greater or equal index to the next cell.style
- for specification of alignment within the cell
IllegalStateException
- if grid is already full. Empty cells at an equal or greater value than 'index' will
be filled first.public void insert(Field field, int row, int column)
field
- the field to insertrow
- the row at which to insert the fieldcolumn
- the column at which to insert the field
IllegalArgumentException
- if row or column is invalid
IllegalStateException
- if the grid is already full. Empty cells at an equal or greater than the index
indicated by the row and column will be filled first.public void insert(Field field, int row, int column, long style)
field
- the field to insertrow
- the row at which to insert the fieldcolumn
- the column at which to insert the fieldstyle
- allows specification of the field alignment within the cell
IllegalArgumentException
- if row or column is invalid
IllegalStateException
- if the grid is already full. Empty cells at an equal or greater than the index
indicated by the row and column will be filled first.public int getColumnWidth(int column)
column
- the column for which to return the width
public int getRowHeight(int row)
row
- the row for which to return the height
public int nextFocus(int direction, int axis)
Manager
This method is called by the framework during a trackball focus move operation.
The direction parameter indicates the direction in which the focus is moving: a value of 1 indicates that the focus is moving forward (generally down and to the right), while a value of -1 indicates that the focus is moving backwards (generally up and to the left).
The axis parameter indicates which axis of movement the direction is in.
This can be one of Field.AXIS_SEQUENTIAL
, Field.AXIS_HORIZONTAL
or Field.AXIS_VERTICAL
.
nextFocus
in class Manager
direction
- Direction the focus is moving within the field.axis
- The axis of movement.
Manager#nextFocus()
public void setColumnPadding(int padding)
padding
- the padding between columns, in pixels.public void setColumnProperty(int column, int property, int value)
column
- the index of the column whose property to setproperty
- one of GridFieldManager.PREFERRED_SIZE
GridFieldManager.PREFERRED_SIZE_WITH_MAXIMUM
GridFieldManager.AUTO_SIZE
GridFieldManager.FIXED_SIZE
value
- the maximum value for PREFERRED_SIZE_WITH_MAXIMUM
or the number of pixels for GridFieldManager.FIXED_SIZE
. This parameter
is ignored for other properties.public void setRowProperty(int row, int property, int value)
row
- the index of the row whose property to setproperty
- one of GridFieldManager.PREFERRED_SIZE
GridFieldManager.PREFERRED_SIZE_WITH_MAXIMUM
GridFieldManager.AUTO_SIZE
GridFieldManager.FIXED_SIZE
value
- the maximum value for PREFERRED_SIZE_WITH_MAXIMUM
or the number of pixels for GridFieldManager.FIXED_SIZE
. This parameter
is ignored for other propertiespublic void setRowPadding(int padding)
padding
- public void setCellPadding(int padding)
padding
- the padding, in pixels, surrounding the contained field
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.