|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.kupzog.ktable.KTableDefaultModel
de.kupzog.ktable.KTableSortedModel
de.kupzog.examples.SortableModelExample
public class SortableModelExample
Shows how to create a table model that allows sorting the table! Also demonstrates: - How the sorting works when spanned table cells exist (they get "unspanned" ;-) - Shows that is it possible to fix also body cells (@see de.kupzog.ktable.KTableModel#getFixedSelectableRowCount())
Constructor Summary | |
---|---|
SortableModelExample()
Initialize the underlying model |
Method Summary | |
---|---|
org.eclipse.swt.graphics.Point |
doBelongsToCell(int col,
int row)
Implement also cell spans so that it can be demonstrated how the sorting algorithm works in this case: |
KTableCellEditor |
doGetCellEditor(int col,
int row)
Returns the celleditor for the given table cell. |
KTableCellRenderer |
doGetCellRenderer(int col,
int row)
Called to retrieve the cell renderer for a given cell. |
int |
doGetColumnCount()
This function tells the KTable how many columns have to be displayed. |
java.lang.Object |
doGetContentAt(int col,
int row)
Returns the content at the given cell. |
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. |
void |
doSetContentAt(int col,
int row,
java.lang.Object value)
Called to change the cell value in the model. |
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 |
getInitialColumnWidth(int column)
Returns the initial column width for the column index given. |
int |
getInitialFirstRowHeight()
Implement to specify the height of the first row. |
int |
getInitialRowHeight(int row)
|
int |
getRowHeightMinimum()
This function should return the minimum height of the rows. |
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. |
Methods inherited from class de.kupzog.ktable.KTableSortedModel |
---|
belongsToCell, getCellEditor, getCellRenderer, getContentAt, getSortColumn, getSortState, getTooltipAt, initialize, mapRowIndexToModel, mapRowIndexToTable, setContentAt, sort |
Methods inherited from class de.kupzog.ktable.KTableDefaultModel |
---|
getColumnCount, getColumnWidth, getFirstRowHeight, getFixedColumnCount, getFixedRowCount, getRowCount, getRowHeight, isFixedCell, isHeaderCell, setColumnWidth, setFirstRowHeight, setRowHeight |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SortableModelExample()
Method Detail |
---|
public java.lang.Object doGetContentAt(int col, int row)
KTableDefaultModel
doGetContentAt
in class KTableDefaultModel
col
- The column index.row
- The row index.
public KTableCellRenderer doGetCellRenderer(int col, int row)
KTableDefaultModel
doGetCellRenderer
in class KTableDefaultModel
col
- the column indexrow
- The row index
public KTableCellEditor doGetCellEditor(int col, int row)
KTableDefaultModel
doGetCellEditor
in class KTableDefaultModel
col
- The column index.row
- The row index.
null
if none.public void doSetContentAt(int col, int row, java.lang.Object value)
KTableDefaultModel
doSetContentAt
in class KTableDefaultModel
col
- The column indexrow
- The row indexvalue
- The new value to set in the model.public org.eclipse.swt.graphics.Point doBelongsToCell(int col, int row)
doBelongsToCell
in class KTableDefaultModel
KTableDefaultModel.doBelongsToCell(int, int)
public int getInitialColumnWidth(int column)
KTableDefaultModel
getColumnWidth()
corresponds
to the real width used when painting the table!
getInitialColumnWidth
in class KTableDefaultModel
column
- The column index
public int getInitialRowHeight(int row)
getInitialRowHeight
in class KTableDefaultModel
row
- The row index.
getRowHeight(int)
might not
always be this value!public int doGetRowCount()
KTableDefaultModel
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.
doGetRowCount
in class KTableDefaultModel
public int doGetColumnCount()
KTableDefaultModel
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()
.
doGetColumnCount
in class KTableDefaultModel
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.
public int getFixedHeaderColumnCount()
KTableModel
public int getFixedSelectableRowCount()
KTableModel
public int getFixedSelectableColumnCount()
KTableModel
public boolean isColumnResizable(int col)
KTableModel
col
- The column index
public int getInitialFirstRowHeight()
KTableDefaultModel
getInitialFirstRowHeight
in class KTableDefaultModel
KTableDefaultModel.setFirstRowHeight(int);
public boolean isRowResizable(int row)
KTableModel
public int getRowHeightMinimum()
KTableModel
public java.lang.String doGetTooltipAt(int col, int row)
KTableDefaultModel
getTooltipAt()
.
doGetTooltipAt
in class KTableDefaultModel
col
- The column index.row
- The row index.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |