|
|||||||||
| 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.ScrollView
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. |
|
protected int |
firstFocus(int direction)
Retrieves the child field that should be given focus when this Manager receives focus. |
|
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 the 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. |
|
protected void |
sublayout(int width,
int height)
Implements custom layout features for this manager. |
|
protected void |
subpaint(Graphics graphics)
Paints the children of this manager. |
|
| Methods inherited from class net.rim.device.api.ui.ScrollView |
|---|
configurationChanged, getHorizontalAdjustment, getVerticalAdjustment, getVisibleHeight, getVisibleWidth, onExposed, setCurrentLocation, setExtent, setHorizontalAdjustment, setHorizontalScroll, setHorizontalScroll, setScrollListener, setVerticalAdjustment, setVerticalScroll, setVerticalScroll, valueChanged, waitForScrolling |
| 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 manager| Method Detail |
|---|
public void add(Field field)
add in class Managerfield - the field to add to the grid
IllegalStateException - if the grid is already full
public 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 full
public 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 full
public 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 Managerfield - the field to remove
public 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()
ManagerInvoking this method has the same effect as
manager.deleteRange( 0, manager.getFieldCount() )
deleteAll in class ManagerManager.deleteAll()
public void deleteRange(int start,
int count)
deleteRange in class Managerstart - 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 invalid
public 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 invalidprotected int firstFocus(int direction)
firstFocus in class Managerdirection - -1 if focus is coming in to the bottom of the manager, 1
if focus is coming in to the top of the manager, and 0 if focus is being
explicitly set to this manager.
public int getColumnCount()
public int getFieldCount()
getFieldCount in class Managerpublic 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 Managerfield - 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)
This method is called by the framework during a trackball focus move operation.
nextFocus in class Managerdirection - The direction the focus is moving within the field; a
value of 1 indicates that the focus is moving forward (generally down
and to the right), a value of -1 indicates that the focus is moving
backwards (generally up and to the left).axis - The axis of movement; can be one of Field.AXIS_SEQUENTIAL,
Field.AXIS_HORIZONTAL, or Field.AXIS_VERTICAL.
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_SIZEvalue - 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_SIZEvalue - 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
protected void sublayout(int width,
int height)
If implementing a manager with custom layout features, extend the
Manager class and implement this method.
Invoking the sublayout method prompts your manager subclass
to lay out controlled fields appropriately. Manager.layout(int, int) invokes this
method to perform custom layout handling.
A manager must call Manager.setPositionChild(net.rim.device.api.ui.Field, int, int) for each child during
sublayout. Note that ScrollView.setExtent(int, int)
must also be called, but it is the field's responsibility to do this in
layout.
sublayout in class Managerwidth - The width available for this manager.height - The height available for this manager.protected void subpaint(Graphics graphics)
The default implementation may call Manager.paintChild(net.rim.device.api.ui.Graphics, net.rim.device.api.ui.Field) on all child
fields, with or without regard to the clipping region.
paintChild, however, may not result in a call to
child.paint if the field would be entirely clipped.
A custom implementation of this method can optimize painting by using
details of the layout to determine which fields are in the current
visible region. To paint a controlled field, invoke Manager.paintChild(net.rim.device.api.ui.Graphics, net.rim.device.api.ui.Field).
subpaint in class Managergraphics - The graphics object used for painting.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal