|
||||||||||
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
public abstract class KTableSortedModel
Provides a transparently sorted tablemodel: For model calls, the row indices are mapped according to the sorting.
The approach taken here has one drawback: the KTable does not know anything about the sorting. Thus, when setting selections, listening to selections or dealing with the KTable directly, you have to manually map the row indices using mapRowIndexToTable(int).
Constructor Summary | |
---|---|
KTableSortedModel()
|
Method Summary | |
---|---|
org.eclipse.swt.graphics.Point |
belongsToCell(int col,
int row)
Sorting disables all cell spanning. |
KTableCellEditor |
getCellEditor(int col,
int row)
Maps between the KTable row index and the model row index! |
KTableCellRenderer |
getCellRenderer(int col,
int row)
Maps between the KTable row index and the model row index! |
java.lang.Object |
getContentAt(int col,
int row)
Maps between the KTable row index and the model row index! |
int |
getSortColumn()
|
int |
getSortState()
|
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. |
int |
mapRowIndexToModel(int row)
Maps the given row index as it is requested by the KTable to the real model index as it is seen from within the model. |
int |
mapRowIndexToTable(int row)
Maps the given row index as seen from a model implementor to the row index needed by the KTable. |
void |
setContentAt(int col,
int row,
java.lang.Object value)
Maps between the KTable row index and the model row index! |
void |
sort(KTableSortComparator comparator)
Sorts the model elements so that the retrieval methods by index (e.g. of type method(int col, int row) )
return the content ordered in the given direction. |
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 KTableSortedModel()
Method Detail |
---|
public void initialize()
KTableDefaultModel
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!
initialize
in class KTableDefaultModel
public final int getSortState()
public void sort(KTableSortComparator comparator)
method(int col, int row)
)
return the content ordered in the given direction.Note: To make the table reflect this sorting, it must be refreshed/redrawn!
Note: Often it is desired that there is some visual sign of how the sorting is.
comparator
- The KTableSortComparator that knows how to sort the rows!public final int getSortColumn()
public int mapRowIndexToModel(int row)
mapRowIndexToModel
in class KTableDefaultModel
row
- The row index used by the KTable.
public int mapRowIndexToTable(int row)
mapRowIndexToTable
in class KTableDefaultModel
row
- The row index as used in the model.
public java.lang.Object getContentAt(int col, int row)
Accesses the sorted model accordingly.
Delegates the real content retrieval to the method
doGetContentAt(int, int)
.
getContentAt
in interface KTableModel
getContentAt
in class KTableDefaultModel
KTableModel.getContentAt(int, int)
public java.lang.String getTooltipAt(int col, int row)
Calls the method doGetTooltipAt()
to retrieve
content.
getTooltipAt
in interface KTableModel
getTooltipAt
in class KTableDefaultModel
col
- The column indexrow
- The row index
KTableModel.getTooltipAt(int, int)
public KTableCellEditor getCellEditor(int col, int row)
Delegates the real editor retrieval to the method
doGetCellEditor(int, int)
.
getCellEditor
in interface KTableModel
getCellEditor
in class KTableDefaultModel
col
- The column indexrow
- The row index
setContentAt()
.KTableModel.getCellEditor(int, int)
public 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.
setContentAt
in interface KTableModel
setContentAt
in class KTableDefaultModel
col
- The column index.row
- The row index.KTableModel.setContentAt(int, int, java.lang.Object)
public KTableCellRenderer getCellRenderer(int col, int row)
Calls the method doGetCellRenderer(int, int)
to retrieve the cell renderer for a cell.
getCellRenderer
in interface KTableModel
getCellRenderer
in class KTableDefaultModel
col
- The column indexrow
- The row index
KTableModel.getCellRenderer(int, int)
public org.eclipse.swt.graphics.Point belongsToCell(int col, int row)
belongsToCell
in interface KTableModel
belongsToCell
in class KTableDefaultModel
col
- the column indexrow
- the row index
KTableModel.belongsToCell(int, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |