Component Container Panel MlPanel MlGrid
A Grid consists of cells in rows and columns. There are two basic cell types, defined by the nature of the cell content: string cells and image cells. String cells may allow editing. Cells and regions within the Grid may be formatted with borders and shadowing. Rows and columns may be fixed on the top, bottom, left and right to remain in view while scrolling horizontally or vertically. There may be heading and footer rows at the top and bottom, and heading and footer columns at the left and right, in addition to the content rows and columns in the center of the Grid. While headings and footers must be fixed, content rows may scroll or may also be fixed on the top, bottom, left and right.
The Grid resources defined below affect its overall layout and appearance. Definitions of resources affecting rows, columns and cells follow the Grid resource definitions.
Name Type Default allowColumnHide Boolean false allowColumnResize Boolean false allowRowHide Boolean false allowRowResize Boolean false autoSelect Boolean true blankBackground Color #ffffff bottomFixedCount Integer 0 bottomFixedMargin Integer 0 bottomShadowColor Color #e1e1e1 columns Integer 0 debugLevel Integer 0 doubleBuffer Boolean true footerColumns Integer 0 footerRows Integer 0 globalImageHeight Integer 0 globalImageWidth Integer 0 headingColumns Integer 0 headingRows Integer 0 highlightColor Color #000000 highlightRowMode Boolean true highlightThickness Integer 2 horizontalSizePolicy SizePolicy SIZE_FIXED hsbDisplayPolicy SBDisplayPolicy DISPLAY_AS_NEEDED immediateDraw Boolean false layoutFrozen Boolean false leftFixedCount Integer 0 leftFixedMargin Integer 0 rightFixedCount Integer 0 rightFixedMargin Integer 0 rows Integer 0 scrollbarMargin Integer 2 scrollbarSize Integer 15 scrollColumn Integer 0 scrollRow Integer 0 selectionPolicy SelectPolicy SELECT_BROWSE_ROW selectBackground Color #000078 selectForeground Color #ffffff shadowRegions Integer 511 shadowThickness Integer 1 shadowType Shadow SHADOW_IN simpleHeadings String null simpleWidths String null topFixedCount Integer 0 topFixedMargin Integer 0 topShadowColor Color #3c3c3c useAverageFontWidth Boolean true userObject Object null verticalSizePolicy SizePolicy SIZE_FIXED visibleColumns Integer 0 visibleRows Integer 0 vsbDisplayPolicy SBDisplayPolicy DISPLAY_AS_NEEDED
allowColumnHide
This resource only has effect when allowColumnResize is true.
If the user is able to resize columns, this resource controls
whether a user can hide a column by resizing it to a zero width.
If true, a user may size columns to a zero width (hiding them) and
if false (the default), a user will not be able to resize a column
to a zero width.
allowColumnResize
If true, the user may resize a column by dragging the right
edge of a cell in a heading row. When the user resizes a column,
the column's columnSizePolicy is set to SIZE_FIXED and the
column's columnWidth is set to the pixel width chosen by the
user. If the Grid contains no heading rows, this resource has no
effect. If false, interactive column resizing is disabled.
allowRowHide
This resource only has effect when allowRowResize is true.
If the user is able to resize rows, this resource controls
whether a user can hide a row by resizing it to a zero height.
If true, a user may size rows to a zero height (hiding them) and
if false (the default), a user will not be able to resize a row
to a zero height.
allowRowResize
If true, the user may resize a row by dragging the bottom edge of
a cell in a heading column. When the user resizes a row, the
row's rowSizePolicy is set to SIZE_FIXED and the row's
rowHeight is set to the pixel height chosen by the user. If
the Grid contains no heading columns, this resource has no effect.
If false, interactive row resizing is disabled.
autoSelect
If set to true (the default) and the Grid's selectionPolicy is
SELECT_BROWSE_ROW, the Grid will select its first row when it
is is added to its parent. No event is generated by this action.
If false, no initial row will be selected.
blankBackground
If a Grid has a horizontal scrollbar which is scrolled completely
to the right or a vertical scrollbar which is scrolled to the
bottom, an empty area can exist after the last set of scrolling cells. The
color of this empty region is set by the blankBackground
resource. It will only be visible when the Grid is scrolled fully
to the right or bottom.
bottomFixedCount
The number of fixed rows at the bottom of the Grid including
footer rows. Since footer rows must be fixed, this value may not
be set smaller than the number of footer rows. If this value is
greater than the total number of rows, then as additional rows
are added they will be fixed until this value is reached.
bottomFixedMargin
The height, in pixels, of the margin between the bottom fixed
rows and any rows above them.
bottomShadowColor
The bottom color of the shadow regions in the Grid.
columns
The number of content columns. Setting this value will add content
columns to the Grid if the value set is greater than the current number
of content columns. Likewise, setting this value to a number less
than the current number of content columns will cause content columns
to be deleted. The Grid updates this resource to reflect the
current number of content columns every time a content column is
added or removed. To get the total number of columns (heading,
content and footer) add this value to the number of heading and
footer columns.
debugLevel
If set to a value greater than 0, debugging messages will be
printed to system output. When set to 0 (the default) only error
messages will be reported.
doubleBuffer
If true, the Grid will double buffer all its drawing operations. If
false, the Grid will paint directly to the screen.
footerColumns
The number of footer columns. Setting this value will add footer
columns to the Grid if the value set is greater than the current number
of footer columns. Likewise, setting this value to a number less
than the current number of footer columns will cause footer columns
to be deleted. The Grid updates this resource to reflect the
current number of footer columns every time a footer column is
added or removed.
footerRows
The number of footer rows. Setting this value will add footer rows
to the Grid if the value set is greater than the current number
of footer rows. Likewise, setting this value to a number less
than the current number of footer rows will cause footer rows
to be deleted. The Grid updates this resource to reflect the
current number of footer rows every time a footer row is
added or removed.
globalImageHeight
If non-zero, this value specifies the height of every image
contained in the cells of the Grid. You should set this resource
only if all cell images have equal size. If you set this resource,
you should also set globalImageHeight to the height of the images.
Setting this value will increase performance when setting
cell images since if this value is not set, the Grid will
need to perform a query to determine the dimensions of any
image set. You should leave this value at 0 (the default)
if you have images of varying size in the Grid.
globalImageWidth
This resource should be used with globalImageHeight. See
globalImageHeight for details.
headingColumns
The number of heading columns. Setting this value will add heading
columns to the Grid if the value set is greater than the current number
of heading columns. Likewise, setting this value to a number less
than the current number of heading columns will cause heading columns
to be deleted. The Grid updates this resource to reflect the
current number of heading columns every time a heading column is
added or removed.
headingRows
The number of heading rows. Setting this value will add heading rows
to the Grid if the value set is greater than the current number
of heading rows. Likewise, setting this value to a number less
than the current number of heading rows will cause heading rows
to be deleted. The Grid updates this resource to reflect the
current number of heading rows every time a heading row is
added or removed.
highlightColor
The color of the highlight rectangle.
highlightRowMode
If true, a highlight is drawn around the entire row containing the
cell which has focus instead of just around the current cell
which has focus. If false, when a cell has focus, the highlight
will be drawn only around that cell.
highlightThickness
The thickness of the highlight rectangle drawn when the Grid has focus.
This value must be 0 or 2.
horizontalSizePolicy
If set to SIZE_TO_FIT, the Grid will set the width of its preferredSize()
to a width which would fit all the columns in the Grid horizontally.
In this case, the Grid expects to be placed in a Container which
will size the Grid to its full width. If the value is SIZE_TO_FIT and
the Grid is placed in a Container which does not give the Grid its
full width, the Grid may appear truncated, without a horizontal scrollbar.
When set to SIZE_TO_FIT, a horizontal scrollbar will never appear since
the Grid expects to be at its full width.
If set to SIZE_FIXED (the default), a horizontal scrollbar will appear if the
Container the Grid is placed in does not give the Grid a horizontal size
which will fit all its columns.
SIZE_FIXED horizontal scrollbar displays to allow scrolling of the Grid SIZE_TO_FIT preferred width will be set to a value which will fit all columns in the table horizontally and horizontal scrollbar will never appear
hsbDisplayPolicy
This resource controls whether to display the horizontal scroll bar if
all rows fit in the viewing area. Possible values:
DISPLAY_ALWAYS scrollbar always displays DISPLAY_AS_NEEDED scrolbar only displayed when scrolling is possible
immediateDraw
If false (the default), the Grid queues up and compresses
drawing events. For example, if you change a cell's background
and later change the cell's foreground, the Grid will only
draw the cell once to reflect the changes. If set to true, the Grid
will draw every time a request to change its appearance is made.
layoutFrozen
If true, the Grid's layout is frozen and the Grid will not
recompute its layout until this resource is set to false. When
this resource is set back to false, the layout will be recomputed
and the entire Grid will redraw. When rows or columns are added
to or deleted from the Grid, or if row heights, column widths or
margins are changed, the Grid must recompute its layout by determining which
cells to display on the screen. If a number of changes to the
Grid layout are going to take place, then by setting this resource
to true before executing the first change and setting it to false after
the last change is requested, the Grid will not recompute its
layout after each change. Setting this value will not affect what
is displayed on the screen as it is only used to increase performance. If
only a single layout change is requested, such as when adding or
deleting a single range of rows or columns, this resource should
not be used in an attempt to increase performance as the change
may not require a redraw of the Grid. This resource should also
not be used around code which does not cause the Grid to recompute
its layout, such as changing cell or border colors, as that
would decrease performance.
leftFixedCount
The number of fixed columns at the left of the Grid including
heading columns. Since heading columns must be fixed, this
value may not be set smaller than the number of heading columns. If
this value is greater than the total number of columns, then
as additional columns are added they will be fixed until this
value is reached.
leftFixedMargin
The width, in pixels, of the margin between the left fixed
columns and any columns to their right.
rightFixedCount
The number of fixed columns at the right of the Grid including
footer columns. Since footer columns must be fixed, this value
may not be set smaller than the number of footer columns. If
this value is greater than the total number of columns, then
as additional columns are added they will be fixed until this
value is reached.
rightFixedMargin
The width, in pixels, of the margin between the right fixed
columns and any columns to their left.
rows
The number of content rows. Setting this value will add content
rows to the Grid if the value set is greater than the current number
of content rows. Likewise, setting this value to a number less
than the current number of content rows will cause content rows
to be deleted. The Grid updates this resource to reflect the
current number of content rows every time a content row is
added or removed. To get the total number of rows in the
Grid (heading, content and footer) add this value to the number
of heading and footer rows.
scrollbarMargin
The margin, in pixels, between the ScrollBars and the displayed cells.
scrollbarSize
The width of the vertical scrollbar and the height of the horizontal
scrollbar.
scrollColumn
The left-most scrolling content column currently displayed.
This value may be set to change the current scroll position.
If this value is set greater than the
last possible scrolling column, the Grid will scroll to the last
possible scrolling column. If this value is set less than the first possible
scrolling column, the Grid will scroll to the first possible scrolling column.
scrollRow
The top scrolling content row currently displayed. This value
may be set to change the current scroll position.
If this value is set greater than the
last possible scrolling row, the Grid will scroll to the last
possible scrolling row. If this value is set less than the first possible
scrolling row, the Grid will scroll to the first possible scrolling row.
selectionPolicy
Determines the types of selections allowed in the Grid.
In SELECT_NONE mode, user selections have no effect by default and
cell select events are generated each time a user selects a cell. The
application may set selections of rows/columns or cells. In
SELECT_SINGLE_ROW mode, one or zero content rows may be selected.
In SELECT_BROWSE_ROW mode, one content row must be selected at all
times. Initially, however, no rows are selected (the application should
select a first row) unless autoSelect is on. In SELECT_MULTIPLE_ROW,
multiple content rows may be selected.
In any of the SELECT_..._ROW modes, when cells
in heading or footer rows are selected by a user, the Grid will
generate cell select events. Therefore, the application must
be sure to check the type of selection made in its event handler for
selections. In SELECT_CELL mode, arbitrary regions of cells
in content rows and content columns may be selected. A user
may select cells in heading rows to select columns and cells
in heading columns to select rows. Possible values:
SELECT_NONE no selections SELECT_SINGLE_ROW 0 or 1 row selection SELECT_BROWSE_ROW 1 row selection SELECT_MULTIPLE_ROW multiple row selection SELECT_CELL multiple row, column, cell selections
selectBackground
The background color of cells, rows or columns which are
currently selected.
selectForeground
The foreground color of cells, rows or columns which are
currently selected.
shadowRegions
Determines which regions are drawn with shadows. There are 9 regions
in the Grid numbered as follows:
1 2 4 8 16 32 64 128 256Where 1, 2 and 4 combine to make the top fixed rows. 1, 8 and 64 combine into the left fixed columns, 16 is the scrolling region, etc. The value should be set to the summation of the regions numbers which should be drawn with a shadow. For example, if this value is set to 428 (64 + 128 + 256) the Grid will draw a shadow box around each region in the bottom row. Regions not included are drawn without shadows.
shadowThickness
The thickness, in pixels, of the shadows drawn in the shadow regions.
shadowType
The type of shadows to draw around the regions of the Grid.
Possible values:
SHADOW_IN inset appearance SHADOW_OUT outset appearance
simpleHeadings
This resource may be used to set cell strings in the first
heading row in a Grid with a simple string. The value passed
should be a String containing headings separated by the pipe symbol.
A heading row must exist at the time of this call which contains the
number of cells which will be affected or the Grid will generate a warning.
simpleWidths
This resource may be used to set the widths of columns in a Grid.
The value passed should be a String containing
numbers specifying widths and a letter 'p' or 'c' following the
number to indicate whether the width is in pixels or characters.
A space should be used after each letter to separate columns.
The columns affected by the call must exist at the time
a value is set, or the Grid will generate a warning.
topFixedCount
The number of fixed rows at the top of the Grid including
heading rows. Since heading rows must be fixed, this value may
not be set smaller than the number of heading rows. If this value is
greater than the total number of rows, then as additional rows
are added they will be fixed until this value is reached.
topFixedMargin
The height, in pixels, of the margin between the top fixed rows
and any rows below them.
topShadowColor
The top color of the shadow regions in the Grid.
useAverageFontWidth
Cells in the Grid which contain text calculate their preferred
width based on the character width of the font
assigned to the cell. The Grid calculates the font's character
width when fonts are assigned to cells. If the value of
this resource is true, the font's character width will be
calculated by averaging all of the glyph widths in the font. If this
value is false, the font's character width will equal the
the maximum glyph width in the font. Changing this resource
only affects fonts assigned after this value is changed, it does not
affect the current layout of the Grid. Also, this resource
only affects cells containing proportional fonts since a fixed
width font's average glyph width will equal its maximum glyph width.
userObject
A reference value unused by the Grid. This allows you to attach
an aribitrary object to the Grid.
verticalSizePolicy
If set to SIZE_TO_FIT, the Grid will set the height of its preferredSize()
to a height which would fit all the rows in the Grid vertically.
In this case, the Grid expects to be placed in a Container which
will size the Grid to its full height. If the value is SIZE_TO_FIT and
the Grid is placed in a Container which does not give the Grid its
full height, the Grid may appear truncated, without a vertical scrollbar.
When set to SIZE_TO_FIT, a vertical scrollbar will never appear since
the Grid expects to be at its full height.
If set to SIZE_FIXED (the default), a vertical scrollbar will appear if the
Container the Grid is placed in does not give the Grid a vertical size
which will fit all its rows.
SIZE_FIXED vertical scrollbar displays to allow vertical scrolling of the Grid SIZE_TO_FIT preferred height will be set to a value which will fit all rows in the table vertically and vertical scrollbar will never appear
visibleColumns
Setting this value causes the Grid to set the width of its preferredSize()
to the default column width times this value. You should only use this
resource when horizontalSizePolicy is SIZE_FIXED since if horizontalSizePolicy
is SIZE_TO_FIT, the Grid expects to be a width which will fit all its
columns horizontally.
visibleRows
Setting this value causes the Grid to set the height of its preferredSize()
to the default row height times this value. You should only use this
resource when verticalSizePolicy is SIZE_FIXED since if verticalSizePolicy
is SIZE_TO_FIT, the Grid expects to be a height which will fit all its
rows vertically.
vsbDisplayPolicy
This resource controls whether to display the vertical scroll bar if
all rows fit in the viewing area. Possible values:
DISPLAY_ALWAYS scrollbar always displays DISPLAY_AS_NEEDED scrolbar only displayed when scrolling is possible
Grid defines the resources in the table below affecting rows, columns and cells. A setValues() call can set values for a single column using column or for a range of columns using columnRangeStart and columnRangeEnd. Row values can be set using row or rowRangeStart and rowRangeEnd. Cell values can be set for a single cell using column and row, or a range of cells using a variety of combinations of row and column specifications.
Name Type Default cellAlignment Alignment ALIGNMENT_CENTER cellBackground Color #C0C0C0 cellBottomBorderColor Color #464646 cellBottomBorderType Border BORDER_LINE cellBottomMargin Integer 0 cellColumnSpan Integer 0 cellDefaults Boolean false cellEditable Boolean false cellFont Font Helvetica 12 cellForeground Color #000000 cellImage Image null cellLeftBorderColor Color #e1e1e1 cellLeftBorderType Border BORDER_LINE cellLeftMargin Integer 0 cellRightBorderColor Color #464646 cellRightBorderType Border BORDER_LINE cellRightMargin Integer 0 cellRowSpan Integer 0 cellString String null cellTopBorderColor Color #e1e1e1 cellTopBorderType Border BORDER_LINE cellTopMargin Integer 0 cellType Integer STRING_CELL cellUserObject Object null column Integer -1 columnDefaults Boolean false columnRangeEnd Integer -1 columnRangeStart Integer -1 columnSizePolicy SizePolicy SIZE_TO_FIT columnStep Integer 1 columnType RowCol CONTENT columnUserObject Object null columnWidth Integer 8 row Integer -1 rowDefaults Boolean false rowHeight Integer 1 rowRangeEnd Integer -1 rowRangeStart Integer -1 rowSizePolicy SizePolicy SIZE_TO_FIT rowStep Integer 1 rowType RowCol CONTENT rowUserObject Object null
cellAlignment
Determines the alignment of cell contents:
ALIGNMENT_LEFT left, centered vertically ALIGNMENT_CENTER centered horizontally and vertically ALIGNMENT_RIGHT right, centered vertically ALIGNMENT_TOP_LEFT top left ALIGNMENT_TOP top, centered horizontally ALIGNMENT_TOP_RIGHT top right ALIGNMENT_BOTTOM_LEFT bottom left ALIGNMENT_BOTTOM bottom, centered horizontally ALIGNMENT_BOTTOM_RIGHT bottom right
cellBackground
The cell's background color.
cellBottomBorderColor
The color of the cell's bottom border. If the cell's bottom
border type is BORDER_NONE, no bottom border will be drawn and this
resource has no effect.
cellBottomBorderType
Determines the type of border to draw at the bottom of
the cell. Possible values:
BORDER_NONE no border BORDER_LINE line border
cellBottomMargin
The height, in pixels, of the margin between the bottom of
the cell and the cell's contents.
cellColumnSpan
The number of columns to the right that are spanned by this cell.
You may combine this with a row span to span both rows and columns.
When a cell spans into adjacent cells, those spanned cells are
not displayed; instead, the contents of the spanning cell are
displayed in the spanned area. This effectively makes the spanning
cell larger while not changing the cell's row or column size.
If cell spans overlap, the visual behavior of the spanned cells
will become undefined. If rows or columns are added or deleted
inside a spanned area, the visual behavior of the spanned
cells will become undefined. If rows or columns are moved or
reordered in a way which does not preserve existing cell spans,
the visual behavior of the spanned cells will become undefined.
Setting a column span on a cell
sets its preferred cell width to 4 pixels. All cells in a span must
exist at the time the span is set.
cellDefaults
Setting this value to true in a setValues() call indicates that
the call is setting the default cell values. The default cell
values can be assigned on a per-column basis by setting this
resource to true and setting a column (using column) or a
range of columns in the call to set resources.
cellEditable
Allow (true) or disallow (false) a user to edit the cell.
cellFont
The font used for the cell's text. Changing this
value may cause the row or column containing the cell to resize if
the row's rowSizePolicy or the column's columnSizePolicy
is SIZE_TO_FIT.
cellForeground
The cell's foreground color.
cellImage
The Image to draw in the cell. Changing this value may cause the row
or column containing the cell to resize if the row's rowSizePolicy
or the column's columnSizePolicy is SIZE_TO_FIT. This value may be null.
cellLeftBorderColor
The color of the cell's left border. If the cell's left border
type is BORDER_NONE, no left border will be drawn and this resource
has no effect.
cellLeftBorderType
Determines the type of border to draw at the left of the cell.
Possible values:
BORDER_NONE no border BORDER_LINE line border
cellLeftMargin
The width, in pixels, of the margin between the left of
the cell and the cell's contents.
cellRightBorderColor
The color of the cell's right border. If the cell's right border
type is BORDER_NONE, no right border will be drawn and this resource
has no effect.
cellRightBorderType
Determines the type of border to draw at the right of the cell.
Possible values:
BORDER_NONE no border BORDER_LINE line border
cellRightMargin
The width, in pixels, of the margin between the right of
the cell and the cell's contents.
cellRowSpan
The number of rows below that are spanned by this cell. You may
combine this with a column span to span both rows and columns.
When a cell spans into adjacent cells, those spanned cells
are not displayed; instead, the contents of the spanning cell
are displayed in the spanned area. This effectively makes the
spanning cell larger while not changing the cell's row or column size.
If cell spans overlap, the visual behavior of the spanned cells
will become undefined. If rows or columns are added or deleted
inside a spanned area, the visual behavior of the spanned cells will
become undefined. If rows or columns are moved or reordered in
a way which does not preserve existing cell spans, the visual
behavior of the spanned cells will become undefined.
Setting a row span on a cell sets its preferred
cell height to 4 pixels. All cells in a span must exist at the time
the span is set.
cellString
The string to draw in the cell. This value may be null.
cellTopBorderColor
The color of the cell's top border. If the cell's top border
type is BORDER_NONE, no top border will be drawn and this resource
has no effect.
cellTopBorderType
Determines the type of border to draw at the top of the cell.
Possible values:
BORDER_NONE no border BORDER_LINE line border
cellTopMargin
The height, in pixels, of the margin between the top of
the cell and the cell's contents.
cellType
The type of the cell. Possible values:
STRING_CELL cell displaying a String IMAGE_CELL cell displaying an ImageChanging this value may cause the row or column containing the cell to resize if the row's rowSizePolicy or the column's columnSizePolicy is SIZE_TO_FIT.
cellUserObject
A reference value unused by the Grid. This resource allows you
to attach an object reference to any cell in the Grid.
column
Defines which column(s) or cell(s) a setValues() will affect.
A value of -1 (the default) means all columns.
The value of 0 defines the first column of a column type.
columnDefaults Setting this value to true in a setValues() call indicates that the call is setting the default column values. The default column values are the values assigned to columns when they are created.
columnRangeEnd
Defines the last column or column of cells in a range which a
setValues() call will affect.
This resource must be used with the columnRangeStart resource.
columnRangeStart
Defines the first column or column of cells in a range which
a setValues() call will affect.
This resource must be used with the columnRangeEnd resource.
columnSizePolicy
Defines how the column width is determined. Possible values:
SIZE_FIXED column size is fixed SIZE_TO_FIT column may resize when cell size changesIf SIZE_TO_FIT, the column will size itself to the maximum preferred width of the column's cells. For cells containing text, this usually equals the cell's average or maximum font glyph width multiplied by the columnWidth (plus space for borders, etc). If SIZE_FIXED, the columnWidth value is assumed to be in pixels and the column width will equal that value.
columnStep
Defines the column increment when setting values of multiple
columns or cells in a setValues() call.
For example, a column step of 2 will skip every other column.
columnType
Defines which type of columns or cells a call setting resources
will affect. Possible values:
ALL_TYPES all column types - heading, content and footer CONTENT columns containing the Grid's contents HEADING heading columns on the far left FOOTER footer columns on the far rightThis resource is used along with column or columnRangeStart and columnRangeEnd and determines which type of column the column or column range specifies. By default, this value is set to CONTENT.
columnUserObject
A reference value unused by the Grid. This resource allows you
to attach a reference to any column in the Grid.
columnWidth
If columnSizePolicy is SIZE_TO_FIT, the value of this resource
represents the column width in characters and if a font in
any cell in the column is changed, the column will resize
if required. The pixel width of a column is determined by the
maximum preferred width of the column's cells. Cells containing
text usually determine their preferred width by multiplying the
cell's average or maximum font glyph width by the column's
columnWidth. Image cells ignore this resource since their
preferred width is the width of their pixmap. If
columnSizePolicy is SIZE_FIXED, the value of this resource
represents the column width in pixels.
row
Defines which row(s) or cell(s) a setValues() call will affect.
A value of -1 (the default) means all rows. The value of 0
defines the first row of a row type.
rowDefaults
Setting this value to true in a setValues() call indicates that
the call is setting the default row values. The default
row values are the values assigned to rows when they are created.
rowHeight
If rowSizePolicy is SIZE_TO_FIT, the value of this resource
represents the row height in characters and if a font in
any cell in this row is changed, the row will resize if required. The
pixel height of a row is determined by the maximum preferred
height of the row's cells. Cells containing text usually determine
their preferred height by taking their maximum font
character height and multiplying it by the row's rowHeight.
Image cells ignore this resource since their preferred height
is the height of their pixmap. If rowSizePolicy is
SIZE_FIXED, the value of this resource represents the row height in pixels.
rowRangeEnd
Defines the last row or row of cells in a range which a setValues()
call will affect. This resource must be used with
the rowRangeStart resource.
rowRangeStart
Defines the first row or row of cells in a range which a setValues()
call will affect. This resource must be used with the rowRangeEnd resource.
rowSizePolicy
Defines how the row height is determined. Possible values:
SIZE_FIXED row size is fixed SIZE_TO_FIT row may resize when cell size changesIf SIZE_TO_FIT, the row will size itself to the maximum preferred height of the row's cells. For cells containing text, this usually equals the cell's maximum font glyph height multiplied by the rowHeight (plus space for borders, etc). If SIZE_FIXED, the rowHeight value is assumed to be in pixels and the row height will equal that value.
rowStep
Defines the row increment when setting values of multiple rows
or cells in a call setting resources. For example, a row step of 2 will
skip every other row.
rowType
Defines which type of rows or cells a call setting resource values
will affect. Possible values:
ALL_TYPES all row types - heading/content and footer CONTENT rows containing the Grid's contents HEADING heading rows on the top FOOTER footer rows on the bottomThis resource is used along with row or rowRangeStart and rowRangeEnd and determines which type of row the row or row range specifies. By default, this value is set to CONTENT.
rowUserObject
A reference value unused by the Grid. This resource allows you
to attach an object reference to any row in the Grid.
Grid posts the following Events:
Event Called When ACTION_EVENT Cell is activated with Return or double-click CELL_FOCUS_IN Cell gains focus CELL_FOCUS_OUT Cell loses focus DESELECT_CELL Cell is deselected DESELECT_COLUMN Column is deselected DESELECT_ROW Row is deselected EDIT_BEGIN Cell edit begins EDIT_CANCEL Cell edit is canceled EDIT_COMPLETE Cell edit is complete EDIT_INSERT Cell edit insert begins RESIZE_ROW Row is resized RESIZE_COLUMN Column is resized SCROLL_ROW Grid is scrolled (vertically) to a new row SCROLL_COLUMN Grid is scrolled (horizontally) to a new column SELECT_CELL Cell is selected SELECT_COLUMN Column is selected SELECT_ROW Row is selectedEach of the above events are posted with a MlGridEvent object. A MlGridEvent is an extension of an Event which holds additional row and/or column information. Its basic structure is shown below:
public class MlGridEvent extends Event { public int rowType; public int row; public int columnType; public int column; }
public void addColumns(int count)
Adds count content columns.
public void addColumns(int type, int position, int count)
Adds count columns of the given type at the specified
position. A position of 0 indicates the first column
of the given type. A position of -1 specifies after the last
position of that column type. The Grid will remain
scrolled to the column scrolled to prior to the addition of
columns, and focus will remain in the column which had focus
prior to the addition of the columns.
public void addRows(int count)
Adds count content rows.
public void addRows(int type, int position, int count)
Adds count rows of the given type at the specified
position. A position of 0 indicates the first row
of the given type. A position of -1 specifies after the last
position of that row type. The Grid will remain
scrolled to the row scrolled to prior to the addition of
rows, and focus will remain in the row which had focus
prior to the addition of the rows.
public boolean columnIsVisible(int column)
Determines visibility of a content column.
Returns true if any part of the content column given is visible
to the user, and false otherwise.
public void deleteAllColumns()
Deletes all content columns.
public void deleteAllColumns(int type)
Deletes all columns of the given type.
public void deleteAllRows()
Deletes all content rows.
public void deleteAllRows(int type)
Deletes all rows of the given type.
public void deleteColumns(int type, int position, int count)
Deletes count columns of the given type in the Grid at
the specified position. A position of 0 indicates the
first column of the given type.
If possible, the focus will remain in the column which had
focus prior to the deletion of columns. If the cell which has
focus is in one of the columns deleted, the Grid will generate a
CELL_FOCUS_OUT event before that column is deleted. If a cell
in one of the columns is currently being edited, the Grid will
generate an EDIT_CANCEL event before that column is deleted.
public void deleteRows(int type, int position, int count)
Deletes count rows of the given type in the Grid at
the specified position. A position of 0 indicates the
first row of the given type.
If possible, the focus will remain in the row which had
focus prior to the deletion of rows. If the cell which has
focus is in one of the rows deleted, the Grid will generate a
CELL_FOCUS_OUT event before that row is deleted. If a cell
in one of the rows is currently being edited, the Grid will
generate an EDIT_CANCEL event before that row is deleted.
public void deselectAllCells(boolean notify)
Deselects all content cells in the Grid. If notify is true,
the Grid will generate DESELECT_CELL events for each cell deselected.
public void deselectAllColumns(boolean notify)
Deselects all content columns in the Grid. If notify is true,
the Grid will generate DESELECT_COLUMN events for each column deselected.
public void deselectAllRows(boolean notify)
Deselects all content rows in the Grid. If notify is true,
the Grid will generate DESELECT_ROW events for each row deselected.
public void deselectCell(int row, int column, boolean notify)
Deselects the cell in the Grid at the content row and
content column specified. If notify is true
and the cell is currently selected, the Grid will generate a
DESELECT_CELL event.
public void deselectColumn(int column, boolean notify)
Deselects the specified content column in the Grid. If
notify is true and the column is currently selected,
the Grid will generate a DESELECT_COLUMN event.
public void deselectRow(int row, boolean notify)
Deselects the specified content row in the Grid. If
notify is true and the row is currently selected,
the Grid will generate a DESELECT_ROW event.
public boolean editBegin(boolean insert, int row, int column)
Begin editing a cell at the given content row and content
column. If insert is true, the edit will begin with the
text field containing the existing cell contents. If false, the text
field will be cleared when the edit begins. If the method is
successful, the Grid will generate an EDIT_BEGIN or EDIT_INSERT
event. If the cell position specified is invalid or the cell
can not be edited, false will be returned. A value of true
is returned if this method is successful.
public void editCancel()
Cancels a cell edit which is in progress. If a cell is being edited,
the Grid will generate an EDIT_CANCEL event.
public void editComplete()
Completes a cell edit which is in progress. If a cell is being edited,
the Grid will generate an EDIT_COMPLETE event.
public Object getCellValue(int row, int column, String name)
Returns the value of the the cell resource given by name at
the given content row and column. The type of the
value returned is determined by the resource. Integer values
will return as Integer objects, boolean values as Boolean objects, etc.
public Object getCellValue(int rowType, int row, int columnType, int column, String name) Returns the value of the the cell resource given by name at the given row of type rowType and column of type columnType. The type of the value returned is determined by the resource. Integer values will return as Integer objects, boolean values as Boolean objects, etc.
public MlGridColumn getColumn(int columnType, int column)
Returns a reference to the column at position column of
type type or null if the location is invalid.
public Object getColumnValue(int column, String name)
Returns the value of the the column resource given by name at
the given content column. The type of the
value returned is determined by the resource. Integer values
will return as Integer objects, boolean values as Boolean objects, etc.
public Object getColumnValue(int columnType, int column,
String name)
Returns the value of the the column resource given by name at
the given column of type columnType. The type of the
value returned is determined by the resource. Integer values
will return as Integer objects, boolean values as Boolean objects, etc.
public boolean getFocusIn()
Returns true if the Grid currently has focus.
public MlGridPos getFocusPos()
Returns a position object containing the content row and
column which currently has focus. You may use the
method getFocusIn() to determine if the Grid has focus.
The row or column in the position returned may be set to -1 which
indicates that no cell in the Grid has focus.
public MlGridRow getRow(int rowType, int row)
Returns a reference to the row at position row of
type type or null if the location is invalid;
public Object getRowValue(int row, String name)
Returns the value of the the row resource given by name at
the given content row. The type of the
value returned is determined by the resource. Integer values
will return as Integer objects, boolean values as Boolean objects, etc.
public Object getRowValue(int rowType, int row, String name)
Returns the value of the the row resource given by name at
the given row of type rowType. The type of the
value returned is determined by the resource. Integer values
will return as Integer objects, boolean values as Boolean objects, etc.
public MlGridPos []getSelectedCells()
Returns an array of position objects containing the locations
of the currently selected cells. The length of the array is
the number of currently selected cells. This method returns null
if there are no currently selected cells. Row, column and cell
selections are independent. For example, if you have a single
row selected in the Grid and no cells selected, a call to this
method would return null.
public int []getSelectedColumns()
Returns an integer array containing the positions of the currently
selected content columns. The length of the array is the number
of selected columns. This method returns null if there are no columns
selected.
public int getSelectedRow()
Returns the position of the selected content row. If no row
is selected, this method returns -1.
public int []getSelectedRows()
Returns an integer array containing the positions of the currently
selected content rows. The length of the array is the number
of selected rows. This method returns null if there are no rows
selected.
public void moveColumns(int newPosition, int position, int count)
Moves count content columns at position to
newPosition.
public void moveRows(int newPosition, int position, int count)
Moves count content rows at position to
newPosition.
public void redrawAll()
Redraws all the cells in a Grid.
This method is normally only used to redraw a Grid subclass which
performs drawing using a customized drawCell() method.
public void redrawCell(int rowType, int row,
int columnType, int column)
Redraws the cell at the column of type columnType
and row of type rowType.
This method is normally only used to redraw a Grid subclass which
performs drawing using a customized drawCell() method.
public void redrawColumn(int type, int column)
Redraws the column at position column of type type.
This method is normally only used to redraw a Grid subclass which
performs drawing using a customized drawCell() method.
public void redrawRow(int type, int row)
Redraws the row at position row of type type.
This method is normally only used to redraw a Grid subclass which
performs drawing using a customized drawCell() method.
public void reorderColumns(int position, int newPositions[])
Changes the positions of content columns starting at position
to the positions specified in the newPositions array.
public void reorderRows(int position, int newPositions[])
Changes the positions of content rows starting at position to
the positions specified in the newPositions array.
public Rectangle rowColumnToXY(int rowType, int row,
int columnType, int column, boolean clipped)
Returns the current coordinates of the cell specified by the row
of type rowType and column of type columnType.
If clipped is true, the rectangle returned will be the cell's
rectangle clipped to the current viewing area.
If clipped is false, the rectangle returned will be
the cell's unclipped rectangle, a rectangle with the full width and
height of the cell, not clipped to the viewport. The unclipped
cell rectangle is usually used to determine positioning based
on cell alignment.
This method will return null if the position given is invalid or
if the cell is not currently visible.
public boolean rowIsVisible(int row)
Returns true if any part of the content row given is visible
to the user, and false otherwise.
public void selectAllCells(boolean notify)
Selects all content cells in the Grid. If notify is true,
the Grid will generate SELECT_CELL events for each cell selected.
public void selectAllColumns(boolean notify)
Selects all content columns in the Grid. If notify is true,
the Grid will generate SELECT_COLUMN events for each column selected.
public void selectAllRows(boolean notify)
Selects all content rows in the Grid. If notify is true,
the Grid will generate SELECT_ROW events for each row selected.
public void selectCell(int row, int column, boolean notify)
Selects the cell at the specified content row and column.
If notify is true and the cell is currently deselected, the Grid
will generate a SELECT_CELL event.
public void selectColumn(int column, boolean notify)
Selects the specified content column. If notify
is true and the column is currently deselected, the Grid
will generate a SELECT_COLUMN event.
public void selectRow(int row, boolean notify)
Selects the specified content row. If notify
is true and the row is currently deselected, the Grid
will generate a SELECT_ROW event.
public boolean setFocus(int row, int column)
Set focus to the cell at the given content row and
column. Upon success, true will be returned. A value
of false will be returned if the cell position specified is
invalid or the cell can not accept focus.
public int setStrings(String data)
Sets cell strings in the Grid starting at the top left cell
with the strings contained in data. The string data should
be in pipe-separated format where pipes signify the start of
a new column and new-lines signify the start of new rows.
The rows and columns set must exist at the time of this call.
Returns the number of cells which had values set by this method.
public int setStrings(int row, String data)
Sets cell strings in the Grid starting at the left-most cell
of the given content row with the strings contained in
data. The string data should be in pipe-separated format
where pipes signify the start of new columns.
The rows and columns set must exist at the time of this call.
Returns the number of cells which had values set by this method.
public int setStrings(int rowType, int row, int columnType,
int column, String data)
Sets cell strings in the Grid with the strings contained in
data, starting at the row and column specified by the given
rowType, row, columnType, and column.
The string data should be in pipe-separated format where pipes
signify the start of a new column and new-lines signify the start
of new rows. The rows and columns set must exist at the time
of this call.
Returns the number of cells which had values set by this method.
public MlGridPos XYToRowColumn(int x, int y)
Returns the position of the cell at (containing) the x and
y coordinates specified. Upon success, a position object
containing the rowType, row, columnType and column of the cell is returned.
If no cell exists at the location specified, null will be returned.