com.jrefinery.data
Class TimeSeriesTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.jrefinery.data.TimeSeriesTableModel
All Implemented Interfaces:
SeriesChangeListener, java.io.Serializable, javax.swing.table.TableModel

public class TimeSeriesTableModel
extends javax.swing.table.AbstractTableModel
implements SeriesChangeListener

Wrapper around a time series to convert it to a table model for use in a JTable.

See Also:
Serialized Form

Field Summary
protected  boolean editable
           
protected  BasicTimeSeries edits
           
protected  TimePeriod newTimePeriod
           
protected  java.lang.Number newValue
           
protected  BasicTimeSeries series
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TimeSeriesTableModel()
          Default constructor.
TimeSeriesTableModel(BasicTimeSeries series)
          Constructs a table model for a time series.
TimeSeriesTableModel(BasicTimeSeries series, boolean editable)
          Creates a table model based on a time series.
 
Method Summary
 java.lang.Class getColumnClass(int column)
          Returns the column class in the table model.
 int getColumnCount()
          Returns the number of columns in the table model.
 java.lang.String getColumnName(int column)
          Returns the name of a column
 int getRowCount()
          Returns the number of rows in the table model.
 java.lang.Object getValueAt(int row, int column)
          Returns the data value for a cell in the table model.
 boolean isCellEditable(int row, int column)
          Returns a flag indicating whether or not the specified cell is editable.
 void seriesChanged(SeriesChangeEvent event)
          Receives notification that the time series has been changed.
 void setValueAt(java.lang.Object value, int row, int column)
          Updates the time series.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

series

protected BasicTimeSeries series

editable

protected boolean editable

edits

protected BasicTimeSeries edits

newTimePeriod

protected TimePeriod newTimePeriod

newValue

protected java.lang.Number newValue
Constructor Detail

TimeSeriesTableModel

public TimeSeriesTableModel()
Default constructor.


TimeSeriesTableModel

public TimeSeriesTableModel(BasicTimeSeries series)
Constructs a table model for a time series.

Parameters:
series - The time series.

TimeSeriesTableModel

public TimeSeriesTableModel(BasicTimeSeries series,
                            boolean editable)
Creates a table model based on a time series.

Method Detail

getColumnCount

public int getColumnCount()
Returns the number of columns in the table model. For this particular model, the column count is fixed at 2.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
The column count.

getColumnClass

public java.lang.Class getColumnClass(int column)
Returns the column class in the table model.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
column - The column index.

getColumnName

public java.lang.String getColumnName(int column)
Returns the name of a column

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
column - The column index.

getRowCount

public int getRowCount()
Returns the number of rows in the table model.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
The row count.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns the data value for a cell in the table model.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
row - The row number.
column - The column number.

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns a flag indicating whether or not the specified cell is editable.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - The row number.
column - The column number.

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int column)
Updates the time series.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

seriesChanged

public void seriesChanged(SeriesChangeEvent event)
Receives notification that the time series has been changed. Responds by firing a table data change event.

Specified by:
seriesChanged in interface SeriesChangeListener
Parameters:
event - Information about the change.


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.