|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.kupzog.examples.PaletteExampleModel
public class PaletteExampleModel
Constructor Summary | |
---|---|
PaletteExampleModel()
|
Method Summary | |
---|---|
org.eclipse.swt.graphics.Point |
belongsToCell(int col,
int row)
Allows cells to merge with other cells. |
KTableCellEditor |
getCellEditor(int col,
int row)
A table cell will be "in place editable" if this method returns a valid cell editor for the given cell. |
KTableCellRenderer |
getCellRenderer(int col,
int row)
Returns the cell renderer for the given cell. |
int |
getColumnCount()
This function tells the KTable how many columns have to be displayed. |
int |
getColumnWidth(int col)
Each column can have its individual width. |
java.lang.Object |
getContentAt(int col,
int row)
This method should return the content at the given position. |
int |
getFixedHeaderColumnCount()
This function tells the KTable how many columns form the "column header". |
int |
getFixedHeaderRowCount()
This function tells the KTable how many rows form the "row header". |
int |
getFixedSelectableColumnCount()
This functon tells the KTable how many columns form a fixed region that is not scrolled. |
int |
getFixedSelectableRowCount()
This functon tells the KTable how many rows form a fixed region that is not scrolled. |
int |
getRowCount()
This function tells the KTable how many rows have to be displayed. |
int |
getRowHeight(int row)
All rows except the first row have the same height. |
int |
getRowHeightMinimum()
This function should return the minimum height of the rows. |
java.lang.String |
getTooltipAt(int col,
int row)
This method allows the model to set a tooltip for a given cell. |
boolean |
isColumnResizable(int col)
This function should return true if the user should be allowed to resize the given column. |
boolean |
isRowResizable(int row)
This function should return true if the user should be allowed to resize the rows. |
void |
setColumnWidth(int col,
int value)
Each column can have its individual width. |
void |
setContentAt(int col,
int row,
java.lang.Object value)
If getCellEditor() does return any editor instead of
null , the table will use this method to set the
changed cell values. |
void |
setFirstRowHeight(int value)
|
void |
setRowHeight(int row,
int value)
If the user resizes a row, the model has to keep track of these changes. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PaletteExampleModel()
Method Detail |
---|
public java.lang.Object getContentAt(int col, int row)
KTableModel
The returned Object is handed over to the KTableCellRenderer. You can decide which renderer is used in getCellRenderer. Usually, the renderer expects the content being of a certain type.
getContentAt
in interface KTableModel
public KTableCellEditor getCellEditor(int col, int row)
KTableModel
getCellEditor
in interface KTableModel
col
- The column indexrow
- The row index
setContentAt()
.public void setContentAt(int col, int row, java.lang.Object value)
KTableModel
getCellEditor()
does return any editor instead of
null
, the table will use this method to set the
changed cell values.
setContentAt
in interface KTableModel
col
- The column index.row
- The row index.public int getRowCount()
KTableModel
KTable counts header rows as normal rows, so the number of header rows has to be added to the number of data rows. The function must at least return the number of fixed (header + selectable) rows.
getRowCount
in interface KTableModel
public int getFixedHeaderRowCount()
KTableModel
These rows are always displayed and not scrolled. Note that the total number of fixed columns is the sum of header and selectable fixed columns.
getFixedHeaderRowCount
in interface KTableModel
public int getColumnCount()
KTableModel
It must at least return the number of fixed and fixed selectable Columns.
getColumnCount
in interface KTableModel
public int getFixedHeaderColumnCount()
KTableModel
getFixedHeaderColumnCount
in interface KTableModel
public int getColumnWidth(int col)
KTableModel
getColumnWidth
in interface KTableModel
col
- The index of the column
public boolean isColumnResizable(int col)
KTableModel
isColumnResizable
in interface KTableModel
col
- The column index
public void setColumnWidth(int col, int value)
KTableModel
setColumnWidth
in interface KTableModel
col
- the column indexvalue
- The width in pixels to set for the given column.public int getRowHeight(int row)
KTableModel
getRowHeight
in interface KTableModel
row
- The row index for the row height.
public boolean isRowResizable(int row)
KTableModel
isRowResizable
in interface KTableModel
public void setFirstRowHeight(int value)
public int getRowHeightMinimum()
KTableModel
getRowHeightMinimum
in interface KTableModel
public void setRowHeight(int row, int value)
KTableModel
setRowHeight
in interface KTableModel
row
- The row index.value
- The height of all except the first row.public KTableCellRenderer getCellRenderer(int col, int row)
KTableModel
For a first approach, KTableCellRenderer.defaultRenderer can
be returned. For some default renderer behavior, look at the
classses in the package de.kupzog.ktable.cellrenderers
.
If this does not suite your needs, you can easily
derive your own cellrenderer from KTableCellRenderer
.
If it is some general, not too specific renderer, we would be
happy to include it as a default renderer!
getCellRenderer
in interface KTableModel
col
- The column indexrow
- The row index
public org.eclipse.swt.graphics.Point belongsToCell(int col, int row)
KTableModel
Return the column and row index of the cell the given cell should be merged with. Note that cells can only merge with cells that have a row/col index smaller or equal than their own index.
The content of a spanned, large cell is determined
by the left upper cell, a 'supercell'. Such supercells as well as cells
that do not span always return their own indices. So if no cell spanning
is desired, simply return the given cell location:
return new Point(col, row);
To visualize the expected return value:
Normal table: Spanned table:
___________ ___________
|__|__|__|__| | |__|__|
|__|__|__|__| |_____|__|__|
In this case, the left upper cell (0,0) returns its own index and is
responsible for the content of the whole spanned cell. The cells (0,1),
(1,0) and (1,1) are overlapped and thus not visible. So they return
(0,0) to signal that they belong to the cell (0,0). Note that in this
case, the value of the cell (1,1) is never requested, since the large
cell must always be a rectangle. Cells like
___________
| __|__|__|
|__|__|__|__|
are not possible.
belongsToCell
in interface KTableModel
col
- the column indexrow
- the row index
public java.lang.String getTooltipAt(int col, int row)
KTableModel
Return null
or ""
if no tooltip should
be displayed.
getTooltipAt
in interface KTableModel
col
- The column indexrow
- The row index
public int getFixedSelectableRowCount()
KTableModel
getFixedSelectableRowCount
in interface KTableModel
public int getFixedSelectableColumnCount()
KTableModel
getFixedSelectableColumnCount
in interface KTableModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |