This Package Previous Next Index
Class CoffeeTable.Grid.GridPanel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----CoffeeTable.Grid.GridPanel
- public class GridPanel
- extends Panel
GridPanel is a UI component for a generic grid object. It takes care of
drawing it's cells, alongwith row and column headers, provides row/column/cell
selection, column resizing, and scrolling support. GridAttributes can be set
for the grid, the row and column headers and individual rows and columns. The
simplest way to use it is to pass it a two dimensional array of strings which
will provide the text data for the grid to display. In addition certain methods can
be overidden to customize it's performance.
- Version:
- 1.2.10 of September 15, 1999 Copyright © 1996-1999 3magic
- Author:
- Anil Bajaj
-
ALWAYS
- ScrollBar display policy to always display the scrollBar.
-
AUTO_RESIZE_COLS
- Automatically resize columns proportionally to fit.
-
AUTO_RESIZE_ROWS
- Automatically resize rows to display wrapped text.
-
CELL_SELECTION
- Enable cell selection flag.
-
COL_LINES
- Display column lines flag.
-
COL_RESIZE_ALL
- Resize all other columns in the Grid proportionally when the user changes the size of any column in the Grid,
if automatic column resizing is enabled.
-
COL_RESIZE_LAST
- Resize last column in the Grid automatically when the user changes the size of any column in the Grid,
if automatic column resizing is enabled.
-
COL_RESIZE_NEXT
- Resize the column right next to the column being sized by the user automatically if automatic
column resizing is enabled.
-
COL_SELECTION
- Enable column selection flag.
-
DEMO_TEXT
- Display Demo text in grid if no text available.
-
DOUBLE_BUFFERING
- Use double buffering while drawing flag.
-
DRAG_SELECT
- Enable drag selection flag.
-
EDIT_TEXT
- Editable text cell type attribute.
-
FORCE_H_SCROLL
- Force horizontal scrollbar flag.
-
FORCE_V_SCROLL
- Force vertical scrollbar flag.
-
H_SCROLL
- Create horizontal scrollbar (if needed) flag.
-
IF_NEEDED
- ScrollBar display policy to display the scrollBar only if needed.
-
IMAGE
- Image cell type attribute.
-
JUST_CENTER
- Center justification attribute.
-
JUST_DEFAULT
- Default (left) justification attribute.
-
JUST_LEFT
- Left justification attribute.
-
JUST_RIGHT
- Right justification attribute.
-
MAIL
- Mail address cell type attribute.
-
MULTIPLE_SELECTION
- Enable multiple selection flag.
-
NEVER
- ScrollBar display policy to never display the scrollBar.
-
NO_SELECTION
- Disable selections flag.
-
RESIZE_COL_HEADERS
- Enable resize column headers flag.
-
RESIZE_COLUMNS
- Enable resize columns flag.
-
RESIZE_MULTIPLE
- Resize multiple rows or columns if selected.
-
RESIZE_ROW_HEADERS
- Enable resize row headers flag.
-
RESIZE_ROWS
- Enable resize rows flag.
-
ROW_LINES
- Display row lines flag.
-
ROW_NUMBERS
- Display row numbers in the row headers.
-
ROW_SELECTION
- Enable row selection flag.
-
SORT_ASCENDING
- Sort the column data in ascending order.
-
SORT_ATTRIBUTES
- Move row attributes and size around while sorting.
-
SORT_DESCENDING
- Sort the column data in descending order.
-
SORT_ROW_HEADERS
- Move row header data with row data while sorting.
-
TEXT
- Read-only text cell type attribute.
-
THREED_BORDER
- Draw a one pixel 3D rectangle around the grid.
-
TRUNC_STRING
- Truncate string (with ellipsis) text attribute.
-
URL
- HTTP URL cell type attribute.
-
V_SCROLL
- Create vertical scrollbar (if needed) flag.
-
WORD_WRAP
- Word wrapping text attribute.
-
GridPanel()
- Constructs and creates a new GridPanel Object.
-
GridPanel(int)
- Constructs and creates a new GridPanel Object.
-
GridPanel(int, int)
- Constructs and creates a new GridPanel Object.
-
GridPanel(int, int, int)
- Constructs and creates a new GridPanel Object.
-
GridPanel(int, int, int, int, int, int[], GridAttributes, GridAttributes, Color, int)
- Constructs and creates a new GridPanel Object using the passed in parameters.
-
addNotify()
- Notifies the Component of it's being added to a panel.
-
autoResizeRow(int, boolean)
- Resize this row to display entire text in cells with WORD_WRAP enabled.
-
autoResizeRows(boolean)
- Resize all the rows to display entire text in cells with WORD_WRAP enabled.
-
cellToRect(Point)
- Returns the rectangle for the specified cell.
-
colHeaderToRect(int)
- Returns the rectangle for the specified column's header.
-
colToRect(int)
- Returns the rectangle for the specified column.
-
createEditor(int, int)
- Returns an editor component for the cell being edited.
-
createGridData()
- Allocates a new GridData object to store the data for the grid.
-
deleteCol(int)
- Delete the specified column.
-
deleteCols(int, int)
- Deletes a specified number of columns, starting from a given column.
-
deleteRow(int)
- Delete the specified row.
-
deleteRows(int, int)
- Deletes a specified number of rows, starting from a given row.
-
deselectAll(boolean)
- Deselect all the cells in the grid.
-
deselectCell(int, int, boolean)
- Deselect the specified cell in the grid.
-
deselectCol(int, boolean)
- Deselect the all the cells in a column in the grid.
-
deselectRow(int, boolean)
- Deselect the all the cells in a row in the grid.
-
disposeGridData()
- Deallocates the GridData object that stores the data for the grid.
-
doKeySelect(Event)
- Selects a cell, row or column based on the arrows keys and the selection mode.
-
drawCell(Graphics, Point, Rectangle, boolean)
- Draw a cell in the GridPanel.
-
drawCellImage(Graphics, Image, Point, Rectangle)
- Draw an image in the specified cell.
-
drawHeaderCol(Graphics, int, Rectangle)
- Draw the header for a column.
-
drawHeaderRow(Graphics, int, Rectangle)
- Draw the header for a row.
-
drawIntersection(Graphics, Rectangle)
- Draw the area in the intersection between the row and column headers.
-
drawJustString(Graphics, String, Rectangle, int, FontMetrics, int)
- Draw the string using the specified justification style.
-
drawString(Graphics, String, Rectangle, int, FontMetrics)
- Draw a String in the specified rectangle.
-
drawText(Graphics, String, Rectangle, int, FontMetrics)
- Draw the string using the specified justification style, with word wrapping.
-
drawTruncString(Graphics, String, Rectangle, int, FontMetrics, int)
- Draw the string using the specified justification style, truncating the string if necessary.
-
endEdit(boolean)
- Deactivates editing, and updates the cell's text by calling the setCellText() method if needed.
-
getApplet()
- Return the applet that this component is contained in.
-
getCellAttributes(int, int)
- Return the drawing attributes for a cell.
-
getCellData(int, int)
- Return the data Object for a cell.
-
getCellInset()
- Return the cell inset.
-
getCellText(int, int)
- Return the text for a cell.
-
getColHeaderAttributes(int)
- Returns the drawing attributes for the column headers.
-
getColHeaderHeight()
- Returns the height for the column headers.
-
getColHeaderRect()
- Return the area taken up by the column headers.
-
getColHeaderText(int)
- Returns the text for the column header for a specified column.
-
getColWidth(int)
- Returns the width for the specified column.
-
getColWidths(int, int)
- Returns the total width for a range of columns.
-
getEditCell()
- Return the cell being edited.
-
getEditor()
- Return the editor component for the cell being edited.
-
getEditTextField()
- Deprecated.
Note: getEditTextField() is deprecated.
As of version 1.2.2, use getEditor().
-
getFirstSelectedCell()
- Returns the first selected cell in the grid.
-
getFirstSelectedCol()
- Returns the first selected column in the grid.
-
getFirstSelectedRow()
- Returns the first selected row in the grid.
-
getFirstVisibleCell()
- Returns the cell at the top-left corner of the grid.
-
getFlags()
- Returns the Grid's current feature flags
-
getGridAttributes()
- Returns the drawing attributes for the entire grid.
-
getGridData()
- Returns the GridData object for this grid.
-
getHeaderAttributes()
- Returns the drawing attributes for the row and column headers.
-
getHighlightColor()
- Return the highlight color.
-
getHighlightTextColor()
- Return the highlight text color.
-
getHScrollAmount()
- Returns the number of pixels the grid is scrolled horizontally each time
the scrollbar arrows are clicked.
-
getLastSelectedCell()
- Returns the last selected cell in the grid.
-
getLastSelectedCol()
- Returns the last selected column in the grid.
-
getLastSelectedRow()
- Returns the last selected row in the grid.
-
getLastVisibleCell()
- Returns the cell at the bottom-right corner of the grid.
-
getNumCols()
- Returns the number of columns in the grid.
-
getNumRows()
- Returns the number of rows in the grid.
-
getRowHeaderAttributes(int)
- Returns the drawing attributes for the row headers.
-
getRowHeaderRect()
- Return the area taken up by the row headers.
-
getRowHeaderText(int)
- Returns the text for the row header for a specified column.
-
getRowHeaderWidth()
- Returns the width for the row headers.
-
getRowHeight(int)
- Returns the height for the specified row.
-
getRowHeights(int, int)
- Returns the total height for a range of rows.
-
getRowTag(int)
- Return the tag object for the row.
-
getScrollOffset()
- Returns vertical and horizontal pixel offset that the Grid is currently scrolled by.
-
getSelBounds()
- Returns the boundary of the current selection.
-
getSelectedCells()
- Returns a list of the currently selected cells.
-
getSelectedCols()
- Returns a list of the currently selected columns.
-
getSelectedRows()
- Returns a list of the currently selected rows.
-
getSortColumn()
- Return the current sort column.
-
getSortColumnColor()
- Return the background color for cells in the column that the grid data is sorted on.
-
getSortEnable(int)
- Check if sorting is enabled for this column.
-
getVersionString()
- Return the current version of the component.
-
getVScrollAmount()
- Returns the number of pixels the grid is scrolled vertically each time
the scrollbar arrows are clicked.
-
goToURL(String)
- Called by the handleURLClick() method in response to the user clicking in a cell
containing a URL.
-
handleCellClick(Event, int, int)
- Called if the user clicks in the grid area.
-
handleDoubleClick(Event, int, int)
- Called if the user double clicks in the grid area.
-
handleEditClick(Event, int, int)
- Activates editing in a cell.
-
handleEvent(Event)
- Handles the event.
-
handleMailClick(Event, int, int)
- Called if the user clicks in a URL cell.
-
handleMouseDown(Event, int, int)
- Called if the user clicks in the grid area.
-
handleScrollEvent(Event)
- Handles all scrollbar events for the GridPanel.
-
handleURLClick(Event, int, int)
- Called if the user clicks in a URL cell.
-
headerColToRect(int)
- Returns the rectangle for the column header.
-
highlightCell(Graphics, Point, Rectangle, boolean)
- Highlight a cell in the GridPanel.
-
insertCol(int)
- Insert a new column at the specified location.
-
insertCols(int, int)
- Insert a number of columns at the specified location.
-
insertRow(int)
- Insert a new row at the specified location.
-
insertRows(int, int)
- Insert a number of rows at the specified location.
-
isCellSelected(int, int)
- Check if the specified cell is selected.
-
isColSelected(int)
- Check if the all the cells in the specified column are selected.
-
isInited()
- Checks if this GridPanel has been successfully initialized.
-
isRowSelected(int)
- Check if the all the cells in the specified row are selected.
-
keyDown(Event, int)
- Called if a character is pressed.
-
minimumSize()
- Returns the preferred size of this component.
-
mouseDown(Event, int, int)
- Called if the mouse is down.
-
mouseExit(Event, int, int)
- Called when the mouse exits the GridPanel.
-
paint(Graphics)
- Paints the GridPanel.
-
preferredSize()
- Returns the preferred size of this component.
-
recalcColumnWidths()
- Recalculate the column widths and size them proportionally so that they all
fit in the GridPanel's displayarea without requiring a horizontal scrollbar.
-
refresh()
- Causes the offscreen image to be purged if double-buffering is enabled.
-
repaint(long, int, int, int, int)
- Repaints part of the component.
-
repaintCell(Point)
- Repaint the specified cell.
-
repaintCol(int)
- Repaint the specified column.
-
repaintColHeader(int)
- Repaint the header for the specified column.
-
repaintRow(int)
- Repaint the specified row.
-
repaintRowHeader(int)
- Repaint the header for the specified row.
-
reshape(int, int, int, int)
- Reshapes the GridPanel to the specified bounding box.
-
resize(int, int)
- Resizes the GridPanel to the specified width and height.
-
revealCell(int, int)
- Scroll the specified cell into view.
-
revealCol(int)
- Scroll the specified column into view.
-
revealRow(int)
- Scroll the specified row into view.
-
rowHeaderToRect(int)
- Returns the rectangle for the specified row's header.
-
rowToRect(int)
- Returns the rectangle for the specified row.
-
selectAll(boolean)
- Select all the cells in the grid.
-
selectCell(int, int, boolean)
- Select the specified cell in the grid.
-
selectCol(int, boolean)
- Select all the cells in the specified column.
-
selectRange(Point, Point, boolean, boolean)
- Select a rectangular range of cells.
-
selectRow(int, boolean)
- Select all the cells in the specified row.
-
setApplet(Applet)
- Set the applet that this component is contained in.
-
setAutoResizeColumns(boolean)
- Enable or disable the feature to size columns proportionally to fit in the GridPanel.
-
setAutoResizeRows(boolean)
- Enable or disable the feature to automatically resize rows.
-
setCellAttributes(int, int, GridAttributes, boolean)
- Specify the drawing attributes for a cell.
-
setCellData(int, int, Object, boolean)
- Set the cell's data object.
-
setCellInset(Point)
- Set the cell inset.
-
setCellSelection(boolean)
- Enable or disable cell selection.
-
setCellText(int, int, String, boolean)
- Set the cell's text.
-
setColAttributes(int, GridAttributes, boolean)
- Specify the drawing attributes for all the cells in a column.
-
setColHeaderAttributes(GridAttributes, boolean)
- Set the drawing attributes for column headers.
-
setColHeaderAttributes(int, GridAttributes, boolean)
- Set the drawing attributes for a specific column of the column headers.
-
setColHeaderHeight(int)
- Set the height of the column headers.
-
setColHeaderHeight(int, boolean)
- Set the column header height.
-
setColHeaderText(int, String, boolean)
- Set the column header text for the specified column.
-
setColLines(boolean)
- Enable or disable column lines.
-
setColResizeMode(int)
- Set the column resize mode.
-
setColSelection(boolean)
- Enable or disable column selection.
-
setColWidth(int, int, boolean, boolean)
- Set the column width.
-
setColWidths(int[], boolean, boolean)
- Set the column widths for all the column in the grid.
-
setColWidths(String)
- Set the column widths for all the column in the grid.
-
setColWidths(String, boolean, boolean)
- Set the column widths for all the column in the grid.
-
setDemoText(boolean)
- Enable or disable drawing demo text in empty cells.
-
setDoubleBuffering(boolean)
- Enable or disable double buffering.
-
setDragSelect(boolean)
- Enable or disable drag selection.
-
setFlags(int)
- Set the Grid's feature flags.
-
setGridAttributes(GridAttributes, boolean)
- Set the drawing attributes for the entire grid.
-
setGridBackground(Color)
- Set the grid's background color.
-
setGridData(GridData, boolean)
- Specify a preallocated instance of a GridData object to store the data for the grid.
-
setGridFont(Font)
- Set the grid's text font.
-
setGridJustification(int)
- Set the grid's justification style.
-
setGridTextColor(Color)
- Set the grid's text color.
-
setHeaderAttributes(GridAttributes, boolean)
- Set the drawing attributes for row and column headers.
-
setHeaderBackground(Color)
- Set the grid header's background color.
-
setHeaderFont(Font)
- Set the grid header's text font.
-
setHeaderJustification(int)
- Set the grid header's justification.
-
setHeaderTextColor(Color)
- Set the grid header's text color.
-
setHighlightColor(Color)
- Set the highlight color.
-
setHighlightTextColor(Color)
- Set the highlight text color.
-
setHScroll(int)
- Set the horizontal scroll bar display policy.
-
setHScrollAmount(int)
- Set the number of pixels the grid is scrolled horizontally each time
the scrollbar arrows are clicked.
-
setLineColor(Color)
- Set the row and column line colors.
-
setLineColor(Color, boolean)
- Set the line color.
-
setMultipleSelection(boolean)
- Enable or disable multiple selections.
-
setNumCols(int)
- Set the number of columns in the grid.
-
setNumCols(int, boolean)
- Set the number of columns in the grid.
-
setNumCols(int, int, boolean)
- Set the number of columns in the grid.
-
setNumCols(int, int[], boolean)
- Set the number of columns in the grid, including the column widths.
-
setNumCols(int, String, boolean)
- Set the number of columns in the grid, including the column widths.
-
setNumRows(int)
- Set the number of rows in the grid.
-
setNumRows(int, boolean)
- Set the number of rows in the grid.
-
setPreferredSize(Dimension)
- Deprecated.
Note: setPreferredSize() is deprecated.
As of version 1.2.2, use Component.resize().
-
setResizeColHeaders(boolean)
- Enable or disable column header resizing.
-
setResizeColumns(boolean)
- Enable or disable column resizing.
-
setResizeMultiple(boolean)
- Enable or disable resizing of multiple rows or columns if selected.
-
setResizeRowHeaders(boolean)
- Enable or disable row header resizing.
-
setResizeRows(boolean)
- Enable or disable row resizing.
-
setRowAttributes(int, GridAttributes, boolean)
- Specify the drawing attributes for all the cells in a row.
-
setRowHeaderAttributes(GridAttributes, boolean)
- Set the drawing attributes for row headers.
-
setRowHeaderAttributes(int, GridAttributes, boolean)
- Set the drawing attributes for a specific row of the row headers.
-
setRowHeaderText(int, String, boolean)
- Set the row header text for the specified row.
-
setRowHeaderWidth(int)
- Set the width of the row headers.
-
setRowHeaderWidth(int, boolean)
- Set the row header width.
-
setRowHeight(int)
- Set the row height for all the rows.
-
setRowHeight(int, int, boolean, boolean)
- Set the height of the specified row.
-
setRowLines(boolean)
- Enable or disable row lines.
-
setRowNumbers(boolean)
- Enable or disable drawing row numbers in the row headers.
-
setRowSelection(boolean)
- Enable or disable row selection.
-
setRowTag(int, Object)
- Set the tag object for the row.
-
setSortAttributes(boolean)
- Enable or disable moving the attributes with the rows while sorting.
-
setSortColumn(int, boolean)
- Set the sort column, and sort the data based on the contents of this column.
-
setSortColumn(int, boolean, int)
- Set the sort column, and sort the data based on the contents of this column.
-
setSortColumnColor(Color)
- Set the background color for cells in the column that the grid data is sorted on.
-
setSortEnable(boolean)
- Set the flag to enable or disable sorting for all the columns in the grid.
-
setSortEnable(int, boolean)
- Set the flag to enable or disable sorting for a column.
-
setSortRowHeaders(boolean)
- Enable or disable moving the row header data with the rows while sorting.
-
setThreeDBorder(boolean)
- Enable or disable drawing a ThreeD border around the grid.
-
setVScroll(int)
- Set the vertical scroll bar display policy.
-
setVScrollAmount(int)
- Set the number of pixels the grid is scrolled vertically each time
the scrollbar arrows are clicked.
-
sortRows(int)
- Sort the rows based on the values in the specified column.
-
sortRows(int, int)
- Sort the rows based on the values in the specified column.
-
startEdit(int, int)
- Activates editing in a cell.
-
validate(String, Point)
- Validate the text in a cell after editing.
-
xToCol(int)
- Map the x coordinate to a column in the grid.
-
xyToCell(int, int)
- Map a point to a cell in the grid.
-
yToRow(int)
- Map the y coordinate to a row in the grid.
NO_SELECTION
public static final int NO_SELECTION
- Disable selections flag.
CELL_SELECTION
public static final int CELL_SELECTION
- Enable cell selection flag. You can use this in combination with the other selection flags.
ROW_SELECTION
public static final int ROW_SELECTION
- Enable row selection flag. You can use this in combination with the other selection flags.
COL_SELECTION
public static final int COL_SELECTION
- Enable column selection flag. You can use this in combination with the other selection flags.
MULTIPLE_SELECTION
public static final int MULTIPLE_SELECTION
- Enable multiple selection flag. You can use this in combination with the other selection flags.
RESIZE_COLUMNS
public static final int RESIZE_COLUMNS
- Enable resize columns flag.
RESIZE_ROWS
public static final int RESIZE_ROWS
- Enable resize rows flag.
RESIZE_COL_HEADERS
public static final int RESIZE_COL_HEADERS
- Enable resize column headers flag.
RESIZE_ROW_HEADERS
public static final int RESIZE_ROW_HEADERS
- Enable resize row headers flag.
ROW_LINES
public static final int ROW_LINES
- Display row lines flag.
COL_LINES
public static final int COL_LINES
- Display column lines flag.
H_SCROLL
public static final int H_SCROLL
- Create horizontal scrollbar (if needed) flag. Setting this flag will display horizontal scrollbars only if needed.
V_SCROLL
public static final int V_SCROLL
- Create vertical scrollbar (if needed) flag. Setting this flag will display vertical scrollbars only if needed.
FORCE_H_SCROLL
public static final int FORCE_H_SCROLL
- Force horizontal scrollbar flag. Setting this flag will always display horizontal scrollbars.
FORCE_V_SCROLL
public static final int FORCE_V_SCROLL
- Force vertical scrollbar flag. Setting this flag will always display vertical scrollbars.
DOUBLE_BUFFERING
public static final int DOUBLE_BUFFERING
- Use double buffering while drawing flag.
DRAG_SELECT
public static final int DRAG_SELECT
- Enable drag selection flag. This will allow the user to continue selecting/deselecting cells
as long as he drags with the mouse button depressed.
THREED_BORDER
public static final int THREED_BORDER
- Draw a one pixel 3D rectangle around the grid.
SORT_ATTRIBUTES
public static final int SORT_ATTRIBUTES
- Move row attributes and size around while sorting. You this flag if you want individual rows to retain their attributes and height
when they're moved during sorting.
DEMO_TEXT
public static final int DEMO_TEXT
- Display Demo text in grid if no text available. Setting this flag displays the row and column numbers in the cells.
ROW_NUMBERS
public static final int ROW_NUMBERS
- Display row numbers in the row headers. Setting this flag causes row headers to display the row numbers.
RESIZE_MULTIPLE
public static final int RESIZE_MULTIPLE
- Resize multiple rows or columns if selected. Setting this flag resizes multiple selected rows or columns
to the same height or width simultaneously (spreadsheet like functionality).
AUTO_RESIZE_ROWS
public static final int AUTO_RESIZE_ROWS
- Automatically resize rows to display wrapped text.
AUTO_RESIZE_COLS
public static final int AUTO_RESIZE_COLS
- Automatically resize columns proportionally to fit. When the user resizes any of the columns,
the grid resizes other columns in the Grid based on the colResizeMode setting.
SORT_ROW_HEADERS
public static final int SORT_ROW_HEADERS
- Move row header data with row data while sorting. Set this flag if you want individual rows to retain their row header data
when they're moved during sorting.
JUST_DEFAULT
public static final int JUST_DEFAULT
- Default (left) justification attribute. This constant is one of the possible values for the GridAttribute's
justification field.
JUST_LEFT
public static final int JUST_LEFT
- Left justification attribute. This constant is one of the possible values for the GridAttribute's
justification field.
JUST_CENTER
public static final int JUST_CENTER
- Center justification attribute. This constant is one of the possible values for the GridAttribute's
justification field.
JUST_RIGHT
public static final int JUST_RIGHT
- Right justification attribute. This constant is one of the possible values for the GridAttribute's
justification field.
WORD_WRAP
public static final int WORD_WRAP
- Word wrapping text attribute. Setting this causes the text to be drawn over multiple lines with wrapping
between words or line endings. This constant is one of the possible values for the GridAttribute's
justification field which should be OR'd with JUST_LEFT, JUST_RIGHT or JUST_CENTER.
TRUNC_STRING
public static final int TRUNC_STRING
- Truncate string (with ellipsis) text attribute. Setting this causes the text to be drawn with "..." at
the end of the text if it doesn't fit within the cells boundaries. This constant is one of the possible values for the GridAttribute's
justification field which should be OR'd with JUST_LEFT, JUST_RIGHT or JUST_CENTER.
TEXT
public static final int TEXT
- Read-only text cell type attribute. This is the default cell type and cell is drawn with no special behaviour.
This constant is one of the possible values for the GridAttribute's cell type field.
EDIT_TEXT
public static final int EDIT_TEXT
- Editable text cell type attribute. Use this type to designate the cells as being editable. Double clicking on
any cell with this flag will activate editing in that cell. This constant is one of the possible values for the
GridAttribute's cell type field.
URL
public static final int URL
- HTTP URL cell type attribute. Use this type to designate the cells as URLs. The text is underlined, and clicking
in this cell causes the browser to display the page pointed by the URL, if supported by the browser. The text
can be either web address "www.3magic.com", a URL "http://www.3magic.com" or a description text and an address
"3magic Software Web Site". This constant is one of the possible values for the
GridAttribute's cell type field.
MAIL
public static final int MAIL
- Mail address cell type attribute. Use this type to designate the cells as mail address. The text is underlined, and clicking
in this cell causes the browser to create a blank email form with the specified address, if supported by the browser. The text
can be either web address "sales@3magic.com", a URL "mailto:sales@3magic.com" or a description text and an address
"Mail 3magic". This constant is one of the possible values for the GridAttribute's cell type field.
IMAGE
public static final int IMAGE
- Image cell type attribute. Use this type to designate the cells as an Image cell. If the cell's data is an Image, the Image
will be drawing in the cell. This constant is one of the possible values for the GridAttribute's cell type field.
NEVER
public static final int NEVER
- ScrollBar display policy to never display the scrollBar. Use this value in setHScroll() or setVScroll() to change the scrollBar
display option after the grid has been created. These values are not Grid flags but rather cause the H_SCROLL,
V_SCROLL, FORCE_H_SCROLL or FORCE_V_SCROLL flags to be set.
IF_NEEDED
public static final int IF_NEEDED
- ScrollBar display policy to display the scrollBar only if needed. Use this value in setHScroll() or setVScroll() to change the scrollBar
display option after the grid has been created. These values are not Grid flags but rather cause the H_SCROLL,
V_SCROLL, FORCE_H_SCROLL or FORCE_V_SCROLL flags to be set.
ALWAYS
public static final int ALWAYS
- ScrollBar display policy to always display the scrollBar. Use this value in setHScroll() or setVScroll() to change the scrollBar
display option after the grid has been created. These values are not Grid flags but rather cause the H_SCROLL,
V_SCROLL, FORCE_H_SCROLL or FORCE_V_SCROLL flags to be set.
SORT_ASCENDING
public static final int SORT_ASCENDING
- Sort the column data in ascending order.
SORT_DESCENDING
public static final int SORT_DESCENDING
- Sort the column data in descending order.
COL_RESIZE_NEXT
public static final int COL_RESIZE_NEXT
- Resize the column right next to the column being sized by the user automatically if automatic
column resizing is enabled.
COL_RESIZE_LAST
public static final int COL_RESIZE_LAST
- Resize last column in the Grid automatically when the user changes the size of any column in the Grid,
if automatic column resizing is enabled.
COL_RESIZE_ALL
public static final int COL_RESIZE_ALL
- Resize all other columns in the Grid proportionally when the user changes the size of any column in the Grid,
if automatic column resizing is enabled.
GridPanel
public GridPanel()
- Constructs and creates a new GridPanel Object. This creates a grid with 0 rows and columns, and other defaults like cell
selection, row and column headers, row and column lines enabled and with scrollbars. After creating a Grid,
you should first set the Grid and Header attributes, if needed, before any other operations, since these attributes
are used in most calculations.
GridPanel
public GridPanel(int flags)
- Constructs and creates a new GridPanel Object. This creates a grid with 0 rows and columns, and other defaults like cell
selection, row and column headers, row and column lines enabled and with scrollbars. After creating a Grid,
you should first set the Grid and Header attributes, if needed, before any other operations, since these attributes
are used in most calculations.
- Parameters:
- flags - flags to control the grid features
GridPanel
public GridPanel(int numRows,
int numCols)
- Constructs and creates a new GridPanel Object. This creates a grid with the specified rows and columns, and other defaults like cell
selection, row and column headers, row and column lines enabled and with scrollbars. After creating a Grid,
you should first set the Grid and Header attributes, if needed, before any other operations, since these attributes
are used in most calculations.
- Parameters:
- numRows - the number of rows
- numCols - the number of columns
GridPanel
public GridPanel(int numRows,
int numCols,
int flags)
- Constructs and creates a new GridPanel Object. This creates a grid with the specified rows and columns, and other defaults like cell
selection, row and column headers, row and column lines enabled and with scrollbars. After creating a Grid,
you should first set the Grid and Header attributes, if needed, before any other operations, since these attributes
are used in most calculations.
- Parameters:
- numRows - the number of rows
- numCols - the number of columns
- flags - flags to control the grid features
GridPanel
public GridPanel(int numRows,
int numCols,
int rowHeight,
int rowHeaderWidth,
int colHeaderHeight,
int colWidths[],
GridAttributes gridAttributes,
GridAttributes headerAttributes,
Color lineColor,
int flags)
- Constructs and creates a new GridPanel Object using the passed in parameters.
It also creates the scrollbars for the grid. The flags are used to enable
certain features. The grid and header attributes must be fully populated i.e.
all the attributes (Font, textColor, backColor and justification) must be
set. You can use a layout manager to layout the grid or use reshape() to
specify its size and location.
- Parameters:
- numRows - the number of rows
- numCols - the number of columns
- rowHeight - the height of each row, -1 to use the font height
- rowHeaderWidth - the width of the row header, 0 if no row header desired
- colHeaderHeight - the height of the column header, 0 if no column header desired or -1 to use the font height
- colWidths - an array specifying the width for each column
- gridAttributes - the attributes (Font, textColor, backgroundColor, justification) for the cells in the grid
- headerAttributes - the attributes for the cells in the grid header
- lineColor - the color for row and column lines
- flags - flags to control the grid features
- See Also:
- GridAttributes
resize
public void resize(int width,
int height)
- Resizes the GridPanel to the specified width and height. Adjust the scrollbars if present.
- Parameters:
- width - the width of the component
- height - the height of the component
- Overrides:
- resize in class Component
reshape
public void reshape(int x,
int y,
int width,
int height)
- Reshapes the GridPanel to the specified bounding box. Adjust the scrollbars if present.
- Parameters:
- x - the x coordinate
- y - the y coordinate
- width - the width of the component
- height - the height of the component
- Overrides:
- reshape in class Component
addNotify
public void addNotify()
- Notifies the Component of it's being added to a panel. This method is used internally by the GridPanel and
you don't need to call it.
- Overrides:
- addNotify in class Panel
setApplet
public void setApplet(Applet applet)
- Set the applet that this component is contained in. This method is used to get the Applet's context
which is used when the user clicks in the MAIL or URL cell types. This applet reference should be provided
if you are planning to use any URL or MAIL cell types in the grid.
- Parameters:
- applet - the Applet that this GridPanel is contained in
getApplet
public Applet getApplet()
- Return the applet that this component is contained in. This reference to the Applet is used to get the Applet's context
which is used when the user clicks in the MAIL or URL cell types. If the applet is specified (using the setApplet() method),
it's reference is returned, otherwise the parent frame for the component is returned if it's an Applet.
- Returns:
- the Applet that this GridPanel is contained in
isInited
public boolean isInited()
- Checks if this GridPanel has been successfully initialized.
minimumSize
public Dimension minimumSize()
- Returns the preferred size of this component. This method returns the size by calling the size() method.
- Overrides:
- minimumSize in class Container
preferredSize
public Dimension preferredSize()
- Returns the preferred size of this component. This method returns the size by calling the size() method.
- Overrides:
- preferredSize in class Container
setPreferredSize
public void setPreferredSize(Dimension newSize)
- Deprecated.
Note: setPreferredSize() is deprecated.
As of version 1.2.2, use Component.resize().
paint
public synchronized void paint(Graphics g)
- Paints the GridPanel.
- Parameters:
- g - the specified Graphics window
- Overrides:
- paint in class Container
handleEvent
public boolean handleEvent(Event evt)
- Handles the event. Returns true if the event is handled and
should not be passed to the parent of this component. This method
dispatches all scrollbar events to the handleScrollEvent() method.
- Parameters:
- evt - the event object
- Overrides:
- handleEvent in class Component
- See Also:
- handleScrollEvent
handleScrollEvent
public boolean handleScrollEvent(Event evt)
- Handles all scrollbar events for the GridPanel. You may override this method to provide
any additional functional, but you will need to call super.handleScrollEvent() if you do so.
- Parameters:
- evt - the event object
mouseDown
public boolean mouseDown(Event evt,
int x,
int y)
- Called if the mouse is down. This method dispatches to the handleMouseDown
and handleDoubleClick method to handle selections and double clicks in
the GridPanel.
- Parameters:
- evt - the event
- x - the x coordinate
- y - the y coordinate
- Overrides:
- mouseDown in class Component
- See Also:
- handleMouseDown, handleDoubleClick
mouseExit
public boolean mouseExit(Event evt,
int x,
int y)
- Called when the mouse exits the GridPanel. This method is used internally by the GridPanel and
you don't need to call it.
- Overrides:
- mouseExit in class Component
keyDown
public boolean keyDown(Event evt,
int key)
- Called if a character is pressed. This method checks the HOME, END, PAGE-UP,
PAGE-DOWN, UP, DOWN, LEFT and RIGHT arrow keys to handle scrolling and selection,
deactivating editing id needed. Editing is also deactivated if the or key is typed.
- Parameters:
- evt - the event
- key - the key that's pressed
- Overrides:
- keyDown in class Component
createGridData
public void createGridData()
- Allocates a new GridData object to store the data for the grid. This method is called
by the GridPanel constructor. When allocated, this object is used by the default implementations of
getCellText(), setCellText(), get/setColHeaderText(), get/setRowHeaderText() to
get/set the grid data. Once created, the GridPanel manages growing and shrinking
the GridData object by resizing it when needed.
- See Also:
- getCellText, setCellText, getColHeaderText, setColHeaderText, getRowHeaderText, setRowHeaderText
headerColToRect
public Rectangle headerColToRect(int col)
- Returns the rectangle for the column header.
- Parameters:
- col - the column
- Returns:
- the rectangle for the column header area for the specified column
cellToRect
public Rectangle cellToRect(Point cell)
- Returns the rectangle for the specified cell. The rectangle returned is in
absolute coordinates, so you may need to translate it by the scroll offset.
- Parameters:
- cell - the cell
- Returns:
- the rectangle for the specified cell
colToRect
public Rectangle colToRect(int col)
- Returns the rectangle for the specified column. The rectangle returned is in
absolute coordinates, so you may need to translate it by the scroll offset.
- Parameters:
- col - the column
- Returns:
- the rectangle for the specified column
rowToRect
public Rectangle rowToRect(int row)
- Returns the rectangle for the specified row. The rectangle returned is in
absolute coordinates, so you may need to translate it by the scroll offset.
- Parameters:
- row - the row
- Returns:
- the rectangle for the specified row
colHeaderToRect
public Rectangle colHeaderToRect(int col)
- Returns the rectangle for the specified column's header. The rectangle returned is in
absolute coordinates, so you may need to translate it by the scroll offset.
- Parameters:
- col - the column
- Returns:
- the rectangle for the specified column's header
rowHeaderToRect
public Rectangle rowHeaderToRect(int row)
- Returns the rectangle for the specified row's header. The rectangle returned is in
absolute coordinates, so you may need to translate it by the scroll offset.
- Parameters:
- row - the row
- Returns:
- the rectangle for the specified row's header
getColHeaderRect
public Rectangle getColHeaderRect()
- Return the area taken up by the column headers.
- Returns:
- the rectangle for the column headers
getRowHeaderRect
public Rectangle getRowHeaderRect()
- Return the area taken up by the row headers.
- Returns:
- the rectangle for the row headers
deselectAll
public void deselectAll(boolean repaint)
- Deselect all the cells in the grid.
- Parameters:
- repaint - redraw the grid after the operation.
revealCell
public void revealCell(int col,
int row)
- Scroll the specified cell into view.
- Parameters:
- col - the column index
- row - the row index
revealRow
public void revealRow(int row)
- Scroll the specified row into view.
- Parameters:
- row - the row
revealCol
public void revealCol(int col)
- Scroll the specified column into view.
- Parameters:
- col - the column
deselectCell
public void deselectCell(int x,
int y,
boolean repaint)
- Deselect the specified cell in the grid.
- Parameters:
- x - the horizontal coordinate for the cell
- y - the vertical coordinate for the cell
- repaint - redraw the grid after the operation.
deselectCol
public void deselectCol(int col,
boolean repaint)
- Deselect the all the cells in a column in the grid.
- Parameters:
- col - the column
- repaint - redraw the grid after the operation.
deselectRow
public void deselectRow(int row,
boolean repaint)
- Deselect the all the cells in a row in the grid.
- Parameters:
- row - the row
- repaint - redraw the grid after the operation.
disposeGridData
public void disposeGridData()
- Deallocates the GridData object that stores the data for the grid.
- See Also:
- createGridData, setGridData
doKeySelect
public final void doKeySelect(Event evt)
- Selects a cell, row or column based on the arrows keys and the selection mode.
This method will cause the grid to scroll if necessary.
drawJustString
public void drawJustString(Graphics g,
String aString,
Rectangle aRect,
int justification,
FontMetrics aFontMetrics,
int baseLine)
- Draw the string using the specified justification style. This method draws the string in the
provided Rectangle (aligned from the top) using the specified justification style. You need
to set your clipping rectangle, the Font and the Color etc. before calling this method.
- Parameters:
- g - the Graphics object
- aString - the String to be drawn
- aRect - the Rectangle in which to draw the string
- justification - the justification style (JUST_LEFT, JUST_CENTER, JUST_RIGHT)
- aFontMetrics - the FontMetrics record for the Font being used
- baseLine - the baseLine for the text
drawText
public void drawText(Graphics g,
String aString,
Rectangle aRect,
int justification,
FontMetrics aFontMetrics)
- Draw the string using the specified justification style, with word wrapping. This method draws
the string in the provided Rectangle (aligned from the top) using the specified justification
style, while breaking the lines on spaces and new lines. If there is only one word in a line
and it doesn't fit, then the word is automatically broken. You need to set your clipping
rectangle, the Font and the Color etc. before calling this method.
- Parameters:
- g - the Graphics object
- aString - the String to be drawn
- aRect - the Rectangle in which to draw the string
- justification - the justification style (JUST_LEFT, JUST_CENTER, JUST_RIGHT)
- aFontMetrics - the FontMetrics record for the Font being used
drawTruncString
public void drawTruncString(Graphics g,
String aString,
Rectangle aRect,
int justification,
FontMetrics aFontMetrics,
int baseLine)
- Draw the string using the specified justification style, truncating the string if necessary.
This rountine enures that the string fits the width of the passed in rectangle by truncating
the string. If truncation occurs, this method ends the string with ellipsis.
- Parameters:
- g - the Graphics object
- aString - the String to be drawn
- aRect - the Rectangle in which to draw the string
- justification - the justification style (JUST_LEFT, JUST_CENTER, JUST_RIGHT)
- aFontMetrics - the FontMetrics record for the Font being used
- baseLine - distance from the top of the Rect to the text baseline
drawCell
public void drawCell(Graphics g,
Point cell,
Rectangle aRect,
boolean highlight)
- Draw a cell in the GridPanel. The default implementation of this method
draws the text for the cell in the specified rectangle. It gets the text
for the cell by calling getCellText and the drawing attributes by calling
getCellAttributes. The drawing is clipped to the passed in rectangle.
If the highlight parameter is true, the cell is drawn using the highlight
color and the highlight text color. This method can be overidden to
customize drawing.
- Parameters:
- g - the specified Graphics object
- cell - the cell being drawn
- aRect - the area in which the cell is drawn
- highlight - whether or not the cell being drawn is highlighted
getVersionString
public final String getVersionString()
- Return the current version of the component.
- Returns:
- a String specifying the current version number
drawCellImage
public void drawCellImage(Graphics g,
Image im,
Point cell,
Rectangle aRect)
- Draw an image in the specified cell. The default implementation of this method
draws the specified image in the passed in rectangle. This method is called by drawCell()
if the cell type is IMAGE and the cell data is an Image object.
- Parameters:
- g - the specified Graphics object
- im - the Image to be drawn
- cell - the cell being drawn
- aRect - the Rectangle in which to draw the string
drawString
public final void drawString(Graphics g,
String aString,
Rectangle aRect,
int justification,
FontMetrics aFontMetrics)
- Draw a String in the specified rectangle. The default implementation of this method
draws the string using the justification parameter to either word wrap or truncate if needed.
- Parameters:
- g - the specified Graphics object
- aString - the String to be drawn
- aRect - the Rectangle in which to draw the string
- justification - the justification style (JUST_LEFT, JUST_CENTER, JUST_RIGHT with WORD_WRAP or TRUNC_STRING OR'd to it)
- aFontMetrics - the FontMetrics record for the Font being used
highlightCell
public void highlightCell(Graphics g,
Point cell,
Rectangle aRect,
boolean highlight)
- Highlight a cell in the GridPanel. The default implementation of this method
draws the cell in a highlighted state to signify selection by simply calling
the drawCell method with the highlight flag set. This method could
be overridden to customize cell highlighting.
- Parameters:
- g - the specified Graphics window
- cell - the cell being drawn
- aRect - the area in which the cell is drawn
- highlight - whether or not the cell being drawn is highlighted
- See Also:
- drawCell
drawHeaderCol
public void drawHeaderCol(Graphics g,
int col,
Rectangle colRect)
- Draw the header for a column. The default implementation of this method draws
the column header for the specified column. It gets the text for the column header
by calling getColHeaderText. The drawing is clipped to the passed in rectangle,
and a 3D rectangle is drawn using the attributes for the grid header. This
method can be overidden to customize drawing.
- Parameters:
- g - the specified Graphics window
- col - the column being drawn
- colRect - the area in which the column header is drawn
- See Also:
- getColHeaderText
drawIntersection
public void drawIntersection(Graphics g,
Rectangle aRect)
- Draw the area in the intersection between the row and column headers. The default
implementation of this method draws the area that falls in the intersection between
the row and column headers in the top-left corner of the GridPanel. The drawing is
clipped to the passed in rectangle, and a 3D rectangle is drawn using the attributes
for the grid header. This method can be overidden to customize drawing.
- Parameters:
- g - the specified Graphics window
- aRect - the area in which the intersection is drawn
drawHeaderRow
public void drawHeaderRow(Graphics g,
int row,
Rectangle rowRect)
- Draw the header for a row. The default implementation of this method draws
the row header for the specified row. It gets the text for the row header
by calling getRowHeaderText. The drawing is clipped to the passed in rectangle,
and a 3D rectangle is drawn using the attributes for the grid header. This
method can be overidden to customize drawing.
- Parameters:
- g - the specified Graphics window
- row - the row being drawn
- rowRect - the area in which the row header is drawn
- See Also:
- getRowHeaderText
getCellAttributes
public GridAttributes getCellAttributes(int col,
int row)
- Return the drawing attributes for a cell. The default implementation of this method checks the
grid attributes and then the column and row attributes (if non-zero) to compute the cells attributes.
This method should be overridden if you want to return any other attributes for the cell, row or column.
You can pass in 0 for the row or column to not specify either i.e. to get the column attributes, pass in 0
for the row and vice versa.
- Parameters:
- col - the column
- row - the row
- Returns:
- the drawing attributes object for the specified cell
- See Also:
- GridAttributes
getCellText
public String getCellText(int x,
int y)
- Return the text for a cell. The default implementation of this
checks for the GridData object and if it exists, it retrieves the text for the
specified cell by calling it's getCellText() method, otherwise it returns an empty string.
This method is called by the default implementation of drawCell. This method can be
overidden to get the cell text differently.
- Parameters:
- x - the horizontal coordinate
- y - the vertical coordinate
- Returns:
- the text for a cell
- See Also:
- drawCell, getCellData, getCellText
getCellData
public Object getCellData(int x,
int y)
- Return the data Object for a cell. The default implementation of this
checks for the GridData object and if it exists, it retrieves the data for the
specified cell by calling it's getCellData() method, otherwise it returns null.
This method just returns a refernce to the data object, if you wish to get the String
representation of the data you should use getCellText().
- Parameters:
- x - the horizontal coordinate
- y - the vertical coordinate
- Returns:
- the text for a cell
- See Also:
- drawCell, getCellText, getCellData
getCellInset
public Point getCellInset()
- Return the cell inset.
- Returns:
- a Point specifying the vertical and hroizontal insets for a cell.
setCellInset
public void setCellInset(Point inset)
- Set the cell inset.
- Parameters:
- inset - a Point specifying the vertical and hroizontal insets for a cell.
getEditCell
public Point getEditCell()
- Return the cell being edited.
- Returns:
- a Point specifying the cell being edited or null.
getEditor
public Component getEditor()
- Return the editor component for the cell being edited.
- Returns:
- the editor component
getEditTextField
public TextField getEditTextField()
- Deprecated.
Note: getEditTextField() is deprecated.
As of version 1.2.2, use getEditor().
getHighlightColor
public Color getHighlightColor()
- Return the highlight color. This is the background color used to draw any
selected/highlighted cells.
- Returns:
- the highlight color for the grid.
getHighlightTextColor
public Color getHighlightTextColor()
- Return the highlight text color. This is the text color used to draw any
selected/highlighted cells.
- Returns:
- the highlight text color for the grid.
getColHeaderHeight
public int getColHeaderHeight()
- Returns the height for the column headers.
- Returns:
- the column header height
getColHeaderText
public String getColHeaderText(int col)
- Returns the text for the column header for a specified column. The default implementation of this
checks for the GridData object and if it exists, it retrieves the text for the
column header by calling it's getColHeaderText() method, otherwise it returns an empty string.
This method is called by the default implementation of drawHeaderCol() and
can be overidden to return the column header text differently.
- Parameters:
- col - the column
- Returns:
- the text for a column header
- See Also:
- drawHeaderCol, getColHeaderText
getColWidth
public int getColWidth(int col)
- Returns the width for the specified column.
- Parameters:
- col - the column
- Returns:
- the column width
getColWidths
public int getColWidths(int startCol,
int numCols)
- Returns the total width for a range of columns.
- Parameters:
- startCol - the first column
- numCols - the number of columns from startCol whose accumulated width is desired
- Returns:
- the total width for a range of columns
getFirstSelectedCell
public Point getFirstSelectedCell()
- Returns the first selected cell in the grid. This method searched for the cell
by search row-wise first and then column-wise.
- Returns:
- the first selected cell in the grid
getLastSelectedCell
public Point getLastSelectedCell()
- Returns the last selected cell in the grid. This method searched for the cell
by search row-wise first and then column-wise.
- Returns:
- the last selected cell in the grid
getSelectedCells
public Vector getSelectedCells()
- Returns a list of the currently selected cells. This method iterates through the cells
and returns a list of all the selected cell indices.
- Returns:
- a Vector of Points containing the selected cells in the grid or null if no cells selected
getFirstSelectedCol
public int getFirstSelectedCol()
- Returns the first selected column in the grid. This method searches for the first column
(from the left) where the entire column is selected.
- Returns:
- the first selected column in the grid
getLastSelectedCol
public int getLastSelectedCol()
- Returns the last selected column in the grid. This method searches for the last column
(from the right) where the entire column is selected.
- Returns:
- the last selected column in the grid
getSelectedCols
public Vector getSelectedCols()
- Returns a list of the currently selected columns. This method iterates through the columns
and returns a list of all the selected column indices.
- Returns:
- a Vector of Integers containing the selected columns in the grid or null if no columns are selected
getFirstSelectedRow
public int getFirstSelectedRow()
- Returns the first selected row in the grid. This method searches for the first row
(from the top) where the entire row is selected.
- Returns:
- the first selected row in the grid
getLastSelectedRow
public int getLastSelectedRow()
- Returns the last selected row in the grid. This method searches for the last row
(from the bottom) where the entire row is selected.
- Returns:
- the last selected row in the grid
getSelectedRows
public Vector getSelectedRows()
- Returns a list of the currently selected rows. This method iterates through the rows
and returns a list of all the selected row indices.
- Returns:
- a Vector of Integers containing the selected rows in the grid or null if no rows are selected
getSelBounds
public Rectangle getSelBounds()
- Returns the boundary of the current selection. This method returns the smallest Rectangle that
encloses the currently selected cells.
- Returns:
- a Rectangle enclosing the currently selected cells
getFirstVisibleCell
public Point getFirstVisibleCell()
- Returns the cell at the top-left corner of the grid.
- Returns:
- a point specifying the top-left cell
getLastVisibleCell
public Point getLastVisibleCell()
- Returns the cell at the bottom-right corner of the grid.
- Returns:
- a point specifying the bottom-right cell
getGridAttributes
public GridAttributes getGridAttributes()
- Returns the drawing attributes for the entire grid.
- Returns:
- the grid's drawing attributes
- See Also:
- GridAttributes
getGridData
public GridData getGridData()
- Returns the GridData object for this grid.
- Returns:
- the GridData object
getFlags
public int getFlags()
- Returns the Grid's current feature flags
- Returns:
- the Grid flags
setFlags
public void setFlags(int flags)
- Set the Grid's feature flags. These are the same as the flags parameter in the GridPanel's contructors.
- Parameters:
- flags - flags to control the grid features
setRowLines
public void setRowLines(boolean state)
- Enable or disable row lines. Setting this flag is equivalent to passing in the ROW_LINES
flag in the flags parameter of the GridPanel constructor. This method repaints the grid if it's visible.
- Parameters:
- state - true to draw row lines
setColLines
public void setColLines(boolean state)
- Enable or disable column lines. Setting this flag is equivalent to passing in the COL_LINES
flag in the flags parameter of the GridPanel constructor. This method repaints the grid if it's visible.
- Parameters:
- state - true to draw column lines
setResizeColumns
public void setResizeColumns(boolean state)
- Enable or disable column resizing. Setting this flag is equivalent to passing in the RESIZE_COLUMNS
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable column resizing
setResizeRows
public void setResizeRows(boolean state)
- Enable or disable row resizing. Setting this flag is equivalent to passing in the RESIZE_ROWS
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable row resizing
setThreeDBorder
public void setThreeDBorder(boolean state)
- Enable or disable drawing a ThreeD border around the grid. Setting this flag is equivalent to passing in the THREED_BORDER
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable a ThreeD border
setSortRowHeaders
public void setSortRowHeaders(boolean state)
- Enable or disable moving the row header data with the rows while sorting. Setting this flag is equivalent
to passing in the SORT_ROW_HEADERS
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to move the row header data with rows while sorting
setSortAttributes
public void setSortAttributes(boolean state)
- Enable or disable moving the attributes with the rows while sorting. Setting this flag is equivalent to passing in the SORT_ATTRIBUTES
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true move move attributes with rows while sorting
setResizeColHeaders
public void setResizeColHeaders(boolean state)
- Enable or disable column header resizing. Setting this flag is equivalent to passing in the RESIZE_COL_HEADERS
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable column header resizing
setResizeRowHeaders
public void setResizeRowHeaders(boolean state)
- Enable or disable row header resizing. Setting this flag is equivalent to passing in the RESIZE_ROW_HEADERS
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable row header resizing
setCellSelection
public void setCellSelection(boolean state)
- Enable or disable cell selection. Setting this flag is equivalent to passing in the CELL_SELECTION
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable cell selection
setRowSelection
public void setRowSelection(boolean state)
- Enable or disable row selection. Setting this flag is equivalent to passing in the ROW_SELECTION
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable row selection
setColSelection
public void setColSelection(boolean state)
- Enable or disable column selection. Setting this flag is equivalent to passing in the COL_SELECTION
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable column selection
setMultipleSelection
public void setMultipleSelection(boolean state)
- Enable or disable multiple selections. Setting this flag is equivalent to passing in the MULTIPLE_SELECTION
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable multiple selections
setResizeMultiple
public void setResizeMultiple(boolean state)
- Enable or disable resizing of multiple rows or columns if selected. Setting this flag is equivalent to passing in the RESIZE_MULTIPLE
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable multiple resizing
setRowNumbers
public void setRowNumbers(boolean state)
- Enable or disable drawing row numbers in the row headers. This is provided as a convenience if
you just want row numbers to be drawing in the row headers. Setting this flag is equivalent to passing in the ROW_NUMBERS
flag in the flags parameter of the GridPanel constructor. This method repaints the grid if it's visible.
- Parameters:
- state - true to draw row numbers
setDemoText
public void setDemoText(boolean state)
- Enable or disable drawing demo text in empty cells. Enabling this draws the Row and Column numbers
in cells and headers in the form "Row y, Col x". Setting this flag is equivalent to passing in the DEMO_TEXT
flag in the flags parameter of the GridPanel constructor. This method repaints the grid if it's visible.
- Parameters:
- state - true to draw demo text
setDoubleBuffering
public void setDoubleBuffering(boolean state)
- Enable or disable double buffering. Setting this flag is equivalent to passing in the DOUBLE_BUFFERING
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable double buffering
setDragSelect
public void setDragSelect(boolean state)
- Enable or disable drag selection. Setting this flag is equivalent to passing in the DRAG_SELECT
flag in the flags parameter of the GridPanel constructor.
- Parameters:
- state - true to enable drag selection
setHScroll
public void setHScroll(int scrollMode)
- Set the horizontal scroll bar display policy. Calling this method sets the H_SCROLL
and FORCE_H_SCROLL flags for the GridPanel.
- Parameters:
- scrollbarMode - the scrollbar display criteria
