CoffeeTable.Grid
Interface GridPanelInterface
- All Known Implementing Classes:
- GridPanel, JGridPanel
- public interface GridPanelInterface
The GridPanelInterface class is used internally by the GridPanel.
- Version:
- 2.1.3 of October 1, 1999 Copyright © 1996-1999 3Magic
|
Field Summary |
static int |
AUTO_RESIZE_COLS
Automatically resize columns proportionally to fit. |
static int |
AUTO_RESIZE_ROWS
Automatically resize rows to display wrapped text. |
static int |
CELL_SELECTION
Enable cell selection flag. |
static int |
CHOICE
Editable choice list cell type attribute. |
static int |
COL_LINES
Display column lines flag. |
static 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. |
static 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. |
static int |
COL_RESIZE_NEXT
Resize the column right next to the column being sized by the user automatically if automatic
column resizing is enabled. |
static int |
COL_SELECTION
Enable column selection flag. |
static int |
DEMO_TEXT
Display Demo text in grid if no text available. |
static int |
DRAG_SELECT
Enable drag selection. |
static int |
EDIT_TEXT
Editable text cell type attribute. |
static int |
IMAGE
Image cell type attribute. |
static int |
JUST_CENTER
Center justification attribute. |
static int |
JUST_DEFAULT
Default (left) justification attribute. |
static int |
JUST_FLAGS
|
static int |
JUST_LEFT
Left justification attribute. |
static int |
JUST_RIGHT
Right justification attribute. |
static int |
MAIL
Mail address cell type attribute. |
static int |
MULTIPLE_SELECTION
Enable multiple selection flag. |
static int |
NO_SELECTION
Disable selection flag. |
static int |
RESIZE_COL_HEADERS
Enable resize column headers flag. |
static int |
RESIZE_COLUMNS
Enable resize columns flag. |
static int |
RESIZE_MULTIPLE
Resize multiple rows or columns if selected. |
static int |
RESIZE_ROW_HEADERS
Enable resize row headers flag. |
static int |
RESIZE_ROWS
Enable resize rows flag. |
static int |
ROW_LINES
Display row lines flag. |
static int |
ROW_NUMBERS
Display row numbers in the row headers. |
static int |
ROW_SELECTION
Enable row selection flag. |
static int |
SCROLLBARS_ALWAYS
Specifies that scrollbars should always be shown regardless of the respective sizes of the
JGridPanel and the actual Grid. |
static int |
SCROLLBARS_AS_NEEDED
Specifies that scrollbar should be shown only when the size of the Grid exceeds the size of
the JGridPanel in the horizontal/vertical dimension. |
static int |
SCROLLBARS_NEVER
Specifies that scrollbars should never be shown regardless of the respective sizes of the
JGridPanel and the actual Grid. |
static int |
SINGLE_CLICK_EDITING
Start editing in a cell with a single-click instead of a double-click. |
static int |
SORT_ASCENDING
Sort the column data in ascending order. |
static int |
SORT_ATTRIBUTES
Move row attributes and size around while sorting. |
static int |
SORT_DESCENDING
Sort the column data in descending order. |
static int |
SORT_ROW_HEADERS
Move row header data with row data while sorting. |
static int |
SPAN_COLUMNS
Span text across adjacent columns. |
static int |
TEXT
Read-only text cell type attribute. |
static int |
THREED_BORDER
Draw a one pixel ThreeD border around the grid. |
static int |
TRUNC_STRING
Truncate string (with ellipsis) text attribute. |
static int |
URL
HTTP URL cell type attribute. |
static int |
WORD_WRAP
Word wrapping text attribute. |
|
Method Summary |
void |
drawCell(java.awt.Graphics g,
java.awt.Point cell,
java.awt.Rectangle aRect,
boolean highlight)
Draw a cell in the JGridPanel. |
void |
drawHeaderCol(java.awt.Graphics g,
int col,
java.awt.Rectangle colRect)
Draw the header for a column. |
void |
drawHeaderRow(java.awt.Graphics g,
int row,
java.awt.Rectangle rowRect)
Draw the header for a row. |
void |
drawIntersection(java.awt.Graphics g,
java.awt.Rectangle aRect)
Draw the area in the intersection between the row and column headers. |
GridAttributes |
getCellAttributes(int col,
int row)
Return the drawing attributes for a cell. |
java.awt.Point |
getCellInset()
Return the cell inset. |
java.lang.String |
getCellText(int x,
int y)
Return the text for a cell. |
int |
getColHeaderHeight()
Returns the height for the column headers. |
int |
getColWidth(int col)
Returns the width for the specified column. |
int |
getColWidths(int startCol,
int numCols)
Returns the total width for a range of columns. |
int |
getDefaultRowHeight()
Return the default row height for a row based on the font height |
int |
getFlags()
Returns the Grid's current feature flags |
java.awt.Color |
getLineColor()
Return the row and column line colors. |
int |
getNumCols()
Returns the number of columns in the grid. |
int |
getNumRows()
Returns the number of rows in the grid. |
int |
getRowHeaderWidth()
Returns the width for the row headers. |
int |
getRowHeight(int row)
Returns the height for the specified row. |
int |
getRowHeights(int startRow,
int numRows)
Returns the total height for a range of rows. |
boolean |
isAutoResizeRows()
Return whether the feature to automatically resize rows is enabled. |
boolean |
isColLines()
Return whether drawing column lines is enabled |
boolean |
isRowLines()
Return whether drawing row lines is enabled |
void |
setFlags(int flags,
boolean repaint)
Set the Grid's feature flags. |
void |
setInGridPrinter(boolean inGridPrinter)
|
void |
setPrintPageRect(java.awt.Rectangle printPageRect)
|
NO_SELECTION
public static final int NO_SELECTION
- Disable selection 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.
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.
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).
DRAG_SELECT
public static final int DRAG_SELECT
- Enable drag selection. This will allow the user to continue selecting/deselecting cells
as long as he drags with the mouse button depressed.
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.
AUTO_RESIZE_ROWS
public static final int AUTO_RESIZE_ROWS
- Automatically resize rows to display wrapped text.
SINGLE_CLICK_EDITING
public static final int SINGLE_CLICK_EDITING
- Start editing in a cell with a single-click instead of a double-click.
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.
THREED_BORDER
public static final int THREED_BORDER
- Draw a one pixel ThreeD border around the grid.
SORT_ATTRIBUTES
public static final int SORT_ATTRIBUTES
- Move row attributes and size around while sorting. Set this flag if you want individual rows to retain their attributes and height
when they're moved during sorting.
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.
SPAN_COLUMNS
public static final int SPAN_COLUMNS
- Span text across adjacent columns. Setting this causes the text to span over to adjacent cells if the
text doesn't fit in it's own cell and the adjacent cell is empty 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.
JUST_FLAGS
public static final int JUST_FLAGS
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 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.
CHOICE
public static final int CHOICE
- Editable choice list cell type attribute. Use this type to designate the cells as being an editable choice list.
Double clicking on any cell with this flag will activate choice list in that cell, containing the item strings specified
for that attribute. This constant is one of the possible values for the GridAttribute's cell type field.
- See Also:
GridAttributes$setItems
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.
SCROLLBARS_ALWAYS
public static final int SCROLLBARS_ALWAYS
- Specifies that scrollbars should always be shown regardless of the respective sizes of the
JGridPanel and the actual Grid. Use this value in setHScrollbarDisplayPolicy() or setVScrollbarDisplayPolicy()
to change the scrollBar display policy after the grid has been created.
SCROLLBARS_AS_NEEDED
public static final int SCROLLBARS_AS_NEEDED
- Specifies that scrollbar should be shown only when the size of the Grid exceeds the size of
the JGridPanel in the horizontal/vertical dimension. Use this value in setHScrollbarDisplayPolicy() or
setVScrollbarDisplayPolicy() to change the scrollBar display policy after the grid has been created.
SCROLLBARS_NEVER
public static final int SCROLLBARS_NEVER
- Specifies that scrollbars should never be shown regardless of the respective sizes of the
JGridPanel and the actual Grid. Use this value in setHScrollbarDisplayPolicy() or setVScrollbarDisplayPolicy()
to change the scrollBar display policy after the grid has been created.
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.
getColHeaderHeight
public int getColHeaderHeight()
- Returns the height for the column headers.
- Returns:
- the column header height
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 columnnumCols - the number of columns from startCol whose accumulated width is desired- Returns:
- the total width for a range of columns
getRowHeight
public int getRowHeight(int row)
- Returns the height for the specified row. Use 0 to obtain the default row height for the grid.
- Parameters:
row - the row- Returns:
- the row height
getRowHeights
public int getRowHeights(int startRow,
int numRows)
- Returns the total height for a range of rows.
- Parameters:
startRow - the first rownumRows - the number of rows from startRow whose accumulated height is desired- Returns:
- the total height for a range of rows
getNumCols
public int getNumCols()
- Returns the number of columns in the grid.
- Returns:
- number of columns
getNumRows
public int getNumRows()
- Returns the number of rows in the grid.
- Returns:
- number of rows
getRowHeaderWidth
public int getRowHeaderWidth()
- Returns the width for the row headers.
- Returns:
- the row header width
isAutoResizeRows
public boolean isAutoResizeRows()
- Return whether the feature to automatically resize rows is enabled.
- Returns:
- true if the feature to automatically resize rows is enabled
isColLines
public boolean isColLines()
- Return whether drawing column lines is enabled
- Returns:
- true if drawing column lines enabled
isRowLines
public boolean isRowLines()
- Return whether drawing row lines is enabled
- Returns:
- true if drawing row lines enabled
getDefaultRowHeight
public int getDefaultRowHeight()
- Return the default row height for a row based on the font height
- Returns:
- the row height
getCellText
public java.lang.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 coordinatey - the vertical coordinate- Returns:
- the text for a cell
- See Also:
GridPanel.drawCell(java.awt.Graphics, java.awt.Point, java.awt.Rectangle, boolean),
GridPanel.getCellData(int, int),
GridData.getCellText(int, int)
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 columnrow - the row- Returns:
- the drawing attributes object for the specified cell
- See Also:
GridAttributes
getCellInset
public java.awt.Point getCellInset()
- Return the cell inset.
- Returns:
- a Point specifying the vertical and hroizontal insets for a cell.
getFlags
public int getFlags()
- Returns the Grid's current feature flags
- Returns:
- the Grid flags
setFlags
public void setFlags(int flags,
boolean repaint)
- Set the Grid's feature flags. These are the same as the flags parameter in the JGridPanel's contructors.
- Parameters:
flags - flags to control the grid featuresrepaint - redraw the grid after the operation.
getLineColor
public java.awt.Color getLineColor()
- Return the row and column line colors.
- Returns:
- the row and column line colors
drawIntersection
public void drawIntersection(java.awt.Graphics g,
java.awt.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 JGridPanel. 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 windowaRect - the area in which the intersection is drawn
drawHeaderCol
public void drawHeaderCol(java.awt.Graphics g,
int col,
java.awt.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 intersection of the
passed in column rectangle and current clip. This method can be overidden to customize drawing.
- Parameters:
g - the specified Graphics windowcol - the column being drawncolRect - the area in which the column header is drawn- See Also:
GridPanel.getColHeaderText(int)
drawHeaderRow
public void drawHeaderRow(java.awt.Graphics g,
int row,
java.awt.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 windowrow - the row being drawnrowRect - the area in which the row header is drawn- See Also:
GridPanel.getRowHeaderText(int)
drawCell
public void drawCell(java.awt.Graphics g,
java.awt.Point cell,
java.awt.Rectangle aRect,
boolean highlight)
- Draw a cell in the JGridPanel. 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 objectcell - the cell being drawnaRect - the area in which the cell is drawnhighlight - whether or not the cell being drawn is highlighted
setInGridPrinter
public void setInGridPrinter(boolean inGridPrinter)
setPrintPageRect
public void setPrintPageRect(java.awt.Rectangle printPageRect)