JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.table.data
Class JCTableModelDataSource

java.lang.Object
  |
  +--com.klg.jclass.table.data.AbstractDataSource
        |
        +--com.klg.jclass.table.data.JCTableModelDataSource
All Implemented Interfaces:
EditableTableDataModel, EventListener, JCTableDataModel, Serializable, TableDataModel, TableModelListener

public class JCTableModelDataSource
extends AbstractDataSource
implements EditableTableDataModel, TableModelListener

The JCTableModelDataSource class defines a wrapper for JTable TableModel objects.

See Also:
Serialized Form

Field Summary
protected  TableModel model
           
 
Fields inherited from class com.klg.jclass.table.data.AbstractDataSource
listeners
 
Constructor Summary
JCTableModelDataSource(TableModel model)
          Creates a new JCTableModelDataSource object containing a Swing TableModel object.
 
Method Summary
 int getNumColumns()
          Returns the number of columns of data that the data source contains.
 int getNumRows()
          Returns the number of rows of data that the data source contains.
 Object getTableColumnLabel(int column)
          Returns the value for the column label at the specified column.
 Object getTableDataItem(int row, int column)
          Returns the value for the cell at the specified location.
 TableModel getTableModel()
          Returns the current TableModel instance assiciated with the class.
 Object getTableRowLabel(int row)
          Returns the value for the row label at the specified row.
 boolean isCellEditable(int row, int column)
          Determines whether the cell can be edited.
 boolean isEnabled()
          Determines whether the cell can be edited.
 boolean setTableDataItem(Object o, int row, int column)
          Sets a value in the data source.
 void tableChanged(TableModelEvent e)
          Maps TableModelEvents to TableDataEvents based on the information about the exact range of cells, rows, or columns that changed.
 
Methods inherited from class com.klg.jclass.table.data.AbstractDataSource
addTableDataListener, dispose, fireColumnChanged, fireColumnLabelChanged, fireColumnsAdded, fireColumnsDeleted, fireColumnsMoved, fireDataReset, fireNumColumnsChanged, fireNumRowsChanged, fireRowChanged, fireRowDeleted, fireRowLabelChanged, fireRowsAdded, fireRowsMoved, fireTableDataEvent, fireValueChanged, hasListeners, removeTableDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.klg.jclass.table.TableDataModel
addTableDataListener, removeTableDataListener
 

Field Detail

model

protected TableModel model
Constructor Detail

JCTableModelDataSource

public JCTableModelDataSource(TableModel model)
Creates a new JCTableModelDataSource object containing a Swing TableModel object.

Parameters:
model -
Method Detail

getTableModel

public TableModel getTableModel()
Returns the current TableModel instance assiciated with the class.

Returns:
the TableModel instance if it is available; null otherwise

getNumRows

public int getNumRows()
Returns the number of rows of data that the data source contains.

Specified by:
getNumRows in interface JCTableDataModel
Returns:
the number of rows in the data model if it is available; 0 otherwise

getNumColumns

public int getNumColumns()
Returns the number of columns of data that the data source contains.

Specified by:
getNumColumns in interface JCTableDataModel
Returns:
the number of columns in the data model, if it is available; 0 otherwise

getTableRowLabel

public Object getTableRowLabel(int row)
Returns the value for the row label at the specified row. Because TableModel does not support row labels, return value is always an empty String.

Specified by:
getTableRowLabel in interface JCTableDataModel
Parameters:
row - the row number
Returns:
an empty String

getTableColumnLabel

public Object getTableColumnLabel(int column)
Returns the value for the column label at the specified column.

Specified by:
getTableColumnLabel in interface JCTableDataModel
Parameters:
column - the column number
Returns:
the columns label in the data model, if it is available; an empty String otherwise

getTableDataItem

public Object getTableDataItem(int row,
                               int column)
Returns the value for the cell at the specified location. Must not be called if the data source is not enabled.

Specified by:
getTableDataItem in interface JCTableDataModel
Parameters:
row - the row number
column - the column number
Returns:
the cell value in the data model;

setTableDataItem

public boolean setTableDataItem(Object o,
                                int row,
                                int column)
Sets a value in the data source. Must not be called if the data source is not enabled.

Specified by:
setTableDataItem in interface EditableTableDataModel
Parameters:
o - the cell value in the data model
row - the row number
column - the column number
Returns:
boolean true

isEnabled

public boolean isEnabled()
Determines whether the cell can be edited.

Returns:
true if the data model is available; false otherwise

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Determines whether the cell can be edited. Must not be called if the data source is not enabled.

Parameters:
row - the row number
column - the column number
Returns:
true if the cell can be edited; false otherwise

tableChanged

public void tableChanged(TableModelEvent e)
Maps TableModelEvents to TableDataEvents based on the information about the exact range of cells, rows, or columns that changed.

Specified by:
tableChanged in interface TableModelListener
Parameters:
e - the TableModelEvent instance

Copyright © 2004 Quest Software Inc..
All rights reserved.