de.kupzog.examples
Class BooleanModelExample

java.lang.Object
  extended by de.kupzog.ktable.KTableDefaultModel
      extended by de.kupzog.examples.BooleanModelExample
All Implemented Interfaces:
KTableModel

public class BooleanModelExample
extends KTableDefaultModel

Author:
Friederich Kupzog

Constructor Summary
BooleanModelExample()
          Initialize the underlying model
 
Method Summary
 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.KTableDefaultModel
belongsToCell, doBelongsToCell, getCellEditor, getCellRenderer, getColumnCount, getColumnWidth, getContentAt, getFirstRowHeight, getFixedColumnCount, getFixedRowCount, getRowCount, getRowHeight, getTooltipAt, initialize, isFixedCell, isHeaderCell, mapRowIndexToModel, mapRowIndexToTable, setColumnWidth, setContentAt, setFirstRowHeight, setRowHeight
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanModelExample

public BooleanModelExample()
Initialize the underlying model

Method Detail

doGetContentAt

public java.lang.Object doGetContentAt(int col,
                                       int row)
Description copied from class: KTableDefaultModel
Returns the content at the given cell.

Specified by:
doGetContentAt in class KTableDefaultModel
Parameters:
col - The column index.
row - The row index.
Returns:
Returns the content of the cell thats string form is shown in the table cell.

doGetCellEditor

public KTableCellEditor doGetCellEditor(int col,
                                        int row)
Description copied from class: KTableDefaultModel
Returns the celleditor for the given table cell.

Specified by:
doGetCellEditor in class KTableDefaultModel
Parameters:
col - The column index.
row - The row index.
Returns:
Returns the cell editor to use, or null if none.

doGetCellRenderer

public KTableCellRenderer doGetCellRenderer(int col,
                                            int row)
Description copied from class: KTableDefaultModel
Called to retrieve the cell renderer for a given cell.

Specified by:
doGetCellRenderer in class KTableDefaultModel
Parameters:
col - the column index
row - The row index
Returns:
Returns a cellrenderer that renders the cell in the KTable.

doSetContentAt

public void doSetContentAt(int col,
                           int row,
                           java.lang.Object value)
Description copied from class: KTableDefaultModel
Called to change the cell value in the model.

Specified by:
doSetContentAt in class KTableDefaultModel
Parameters:
col - The column index
row - The row index
value - The new value to set in the model.

doGetRowCount

public int doGetRowCount()
Description copied from class: KTableDefaultModel
This function tells the KTable how many rows have to be displayed.

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.

Specified by:
doGetRowCount in class KTableDefaultModel
Returns:
The number of rows in the table, including the fixed rows.

doGetColumnCount

public int doGetColumnCount()
Description copied from class: KTableDefaultModel
This function tells the KTable how many columns have to be displayed.

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().

Specified by:
doGetColumnCount in class KTableDefaultModel
Returns:
Returns the number of columns in the table, including all fixed columns.

getFixedHeaderRowCount

public int getFixedHeaderRowCount()
Description copied from interface: KTableModel
This function tells the KTable how many rows form the "row header".

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.

Returns:
int The number of fixed rows.

getFixedHeaderColumnCount

public int getFixedHeaderColumnCount()
Description copied from interface: KTableModel
This function tells the KTable how many columns form the "column header". These columns are always displayed and not scrolled - that means they are fixed. Note that cells in that region cannot be selected! The total of all fixed cells is formed by selectable and header cells.

Returns:
The number of fixed columns in the table (must be smaller or equal to the total number of columns in the table.

getFixedSelectableRowCount

public int getFixedSelectableRowCount()
Description copied from interface: KTableModel
This functon tells the KTable how many rows form a fixed region that is not scrolled. The clickable or selectable fixed columns start after getFixedRowCount() rows. Note that the number of fixed and fixed selectable rows must be smaller or equal to getRowCount().

Returns:
Returns the number of fixed, selectable rows.

getFixedSelectableColumnCount

public int getFixedSelectableColumnCount()
Description copied from interface: KTableModel
This functon tells the KTable how many columns form a fixed region that is not scrolled. The clickable fixed columns start after getFixedColumnCount() columns. Note that the number of fixed and fixed clickable columns must be smaller or equal to getColumnCount().

Returns:
Returns the number of fixed, selectable columns.

isColumnResizable

public boolean isColumnResizable(int col)
Description copied from interface: KTableModel
This function should return true if the user should be allowed to resize the given column. (all rows have the same height except the first)

Parameters:
col - The column index
Returns:
Returns true if the column is resizable.

getInitialFirstRowHeight

public int getInitialFirstRowHeight()
Description copied from class: KTableDefaultModel
Implement to specify the height of the first row. This value might be overwritten when setFirstRowHeight() is called.

Overrides:
getInitialFirstRowHeight in class KTableDefaultModel
Returns:
Should return the height of the first row in the table.
See Also:
KTableDefaultModel.setFirstRowHeight(int);

isRowResizable

public boolean isRowResizable(int row)
Description copied from interface: KTableModel
This function should return true if the user should be allowed to resize the rows.


getRowHeightMinimum

public int getRowHeightMinimum()
Description copied from interface: KTableModel
This function should return the minimum height of the rows. It is only needed if the rows are resizable.

Returns:
Returns the minimum height for the rows.

getInitialColumnWidth

public int getInitialColumnWidth(int column)
Description copied from class: KTableDefaultModel
Returns the initial column width for the column index given. Note that if resize is enabled, this value might not be the real width of a column. The value returned by getColumnWidth() corresponds to the real width used when painting the table!

Specified by:
getInitialColumnWidth in class KTableDefaultModel
Parameters:
column - The column index
Returns:
returns the initial width of the column.

getInitialRowHeight

public int getInitialRowHeight(int row)
Specified by:
getInitialRowHeight in class KTableDefaultModel
Parameters:
row - The row index.
Returns:
Returns the initial row height that should be used on normal cells. If resize is enabled, the value returned by getRowHeight(int) might not always be this value!

doGetTooltipAt

public java.lang.String doGetTooltipAt(int col,
                                       int row)
Description copied from class: KTableDefaultModel
Returns the tooltip text for the given cell. Implement this method rather than getTooltipAt().

Overrides:
doGetTooltipAt in class KTableDefaultModel
Parameters:
col - The column index.
row - The row index.
Returns:
Returns the tooltip text for the cell. Default: None.