|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.kupzog.ktable.KTableDefaultModel
public abstract class KTableDefaultModel
Default implementation that handles column widths and row height.
Provides a wrapper framework that allows subclasses to transparently change the location of cells in the displayed table, e.g. for sorting.
Constructor Summary | |
---|---|
KTableDefaultModel()
|
Method Summary | |
---|---|
org.eclipse.swt.graphics.Point |
belongsToCell(int col,
int row)
Calls doBelongsToCell to get the cell span. |
org.eclipse.swt.graphics.Point |
doBelongsToCell(int col,
int row)
Return (0,0) if cell should stay in its own area, or return the cell that should overlap this cell. |
abstract KTableCellEditor |
doGetCellEditor(int col,
int row)
Returns the celleditor for the given table cell. |
abstract KTableCellRenderer |
doGetCellRenderer(int col,
int row)
Called to retrieve the cell renderer for a given cell. |
abstract int |
doGetColumnCount()
This function tells the KTable how many columns have to be displayed. |
abstract java.lang.Object |
doGetContentAt(int col,
int row)
Returns the content at the given cell. |
abstract int |
doGetRowCount()
This function tells the KTable how many rows have to be displayed. |
java.lang.String |
doGetTooltipAt(int col,
int row)
Returns the tooltip text for the given cell. |
abstract void |
doSetContentAt(int col,
int row,
java.lang.Object value)
Called to change the cell value in the model. |
KTableCellEditor |
getCellEditor(int col,
int row)
Delegates the real editor retrieval to the method doGetCellEditor(int, int) . |
KTableCellRenderer |
getCellRenderer(int col,
int row)
Calls the method doGetCellRenderer(int, int)
to retrieve the cell renderer for a 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)
Delegates the real content retrieval to the method doGetContentAt(int, int) . |
int |
getFirstRowHeight()
Deprecated. Use getRowHeight(0) instead. |
int |
getFixedColumnCount()
|
int |
getFixedRowCount()
|
abstract int |
getInitialColumnWidth(int column)
Returns the initial column width for the column index given. |
int |
getInitialFirstRowHeight()
Deprecated. Implement getInitialRowHeight(0) instead! |
abstract int |
getInitialRowHeight(int row)
|
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. |
java.lang.String |
getTooltipAt(int col,
int row)
Returns the tooltip for the given cell. |
void |
initialize()
This method initializes the provided baseimplementation of the model properly. |
boolean |
isFixedCell(int col,
int row)
Returns wether a given cell is fixed. |
boolean |
isHeaderCell(int col,
int row)
Returns wether a given cell is a header cell (in the range of fixedHeader) |
int |
mapRowIndexToModel(int shownRow)
Maps the given row index that references a visible row, to one that is internally used in the tablemodel. |
int |
mapRowIndexToTable(int modelRow)
Maps the given row index from a model-internal to one that references visualized table rows. |
void |
setColumnWidth(int col,
int value)
Each column can have its individual width. |
void |
setContentAt(int col,
int row,
java.lang.Object value)
Calls the method doSetContentAt(int, int, Object)
to actually set the content of a table cell to the model. |
void |
setFirstRowHeight(int value)
Deprecated. Use setRowHeight(0, value) instead. |
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 |
Methods inherited from interface de.kupzog.ktable.KTableModel |
---|
getFixedHeaderColumnCount, getFixedHeaderRowCount, getFixedSelectableColumnCount, getFixedSelectableRowCount, getRowHeightMinimum, isColumnResizable, isRowResizable |
Constructor Detail |
---|
public KTableDefaultModel()
Method Detail |
---|
public void initialize()
This is not done in the constructor because there might be cases where some base data is set in the constructor and must be present for properly working model getter methods.
MUST BE CALLED BY ANY SUBCLASS!
public int getColumnWidth(int col)
KTableModel
getColumnWidth
in interface KTableModel
col
- The column index.
public abstract int getInitialColumnWidth(int column)
getColumnWidth()
corresponds
to the real width used when painting the table!
column
- The column index
public int getRowHeight(int row)
KTableModel
getRowHeight
in interface KTableModel
row
- The row index for the row height.
public abstract int getInitialRowHeight(int row)
row
- The row index.
getRowHeight(int)
might not
always be this value!public int getFirstRowHeight()
setFirstRowHeight(int)
,
getInitialFirstRowHeight()
public int getInitialFirstRowHeight()
setFirstRowHeight(int);
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 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 void setFirstRowHeight(int value)
public java.lang.Object getContentAt(int col, int row)
doGetContentAt(int, int)
.
getContentAt
in interface KTableModel
KTableModel.getContentAt(int, int)
public abstract java.lang.Object doGetContentAt(int col, int row)
col
- The column index.row
- The row index.
public java.lang.String getTooltipAt(int col, int row)
Simply calls the method doGetTooltipAt()
.
getTooltipAt
in interface KTableModel
col
- The column indexrow
- The row index
KTableModel.getTooltipAt(int, int)
public java.lang.String doGetTooltipAt(int col, int row)
getTooltipAt()
.
col
- The column index.row
- The row index.
public KTableCellEditor getCellEditor(int col, int row)
doGetCellEditor(int, int)
.
getCellEditor
in interface KTableModel
col
- The column indexrow
- The row index
setContentAt()
.KTableModel.getCellEditor(int, int)
public abstract KTableCellEditor doGetCellEditor(int col, int row)
col
- The column index.row
- The row index.
null
if none.public void setContentAt(int col, int row, java.lang.Object value)
doSetContentAt(int, int, Object)
to actually set the content of a table cell to the model.
setContentAt
in interface KTableModel
col
- The column index.row
- The row index.KTableModel.setContentAt(int, int, java.lang.Object)
public abstract void doSetContentAt(int col, int row, java.lang.Object value)
col
- The column indexrow
- The row indexvalue
- The new value to set in the model.public KTableCellRenderer getCellRenderer(int col, int row)
doGetCellRenderer(int, int)
to retrieve the cell renderer for a cell.
getCellRenderer
in interface KTableModel
col
- The column indexrow
- The row index
KTableModel.getCellRenderer(int, int)
public abstract KTableCellRenderer doGetCellRenderer(int col, int row)
col
- the column indexrow
- The row index
public boolean isFixedCell(int col, int row)
col
- The column indexrow
- the row index
public boolean isHeaderCell(int col, int row)
col
- the column indexrow
- the row index
public int getFixedRowCount()
KTableModel.getFixedHeaderRowCount()
,
KTableModel.getFixedSelectableRowCount()
public int getFixedColumnCount()
KTableModel.getFixedHeaderColumnCount()
,
KTableModel.getFixedSelectableColumnCount()
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
doGetRowCount()
public abstract int doGetRowCount()
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.
public int getColumnCount()
KTableModel
It must at least return the number of fixed and fixed selectable Columns.
getColumnCount
in interface KTableModel
doGetColumnCount()
public abstract int doGetColumnCount()
It must at least return the number of fixed and fixed selectable Columns.
So the easiest way is to return the number of normal columns and add the
value of getFixedColumnCount()
.
public org.eclipse.swt.graphics.Point belongsToCell(int col, int row)
belongsToCell
in interface KTableModel
col
- the column indexrow
- the row index
KTableModel.belongsToCell(int, int)
public org.eclipse.swt.graphics.Point doBelongsToCell(int col, int row)
Defaults to no spanning.
KTableModel.belongsToCell(int, int).
public int mapRowIndexToModel(int shownRow)
shownRow
- The row index as displayed by the KTable.
public int mapRowIndexToTable(int modelRow)
modelRow
- The row index as used in the model.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |