Package org.jfree.data.time
Class TimeSeriesTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- org.jfree.data.time.TimeSeriesTableModel
-
- All Implemented Interfaces:
java.io.Serializable,java.util.EventListener,javax.swing.table.TableModel,SeriesChangeListener
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 aJTable.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private booleaneditableA flag that controls whether the series is editable.private RegularTimePeriodnewTimePeriodThe new time period.private java.lang.NumbernewValueThe new value.private TimeSeriesseriesThe series.
-
Constructor Summary
Constructors Constructor Description TimeSeriesTableModel()Default constructor.TimeSeriesTableModel(TimeSeries series)Constructs a table model for a time series.TimeSeriesTableModel(TimeSeries series, boolean editable)Creates a table model based on a time series.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ClassgetColumnClass(int column)Returns the column class in the table model.intgetColumnCount()Returns the number of columns in the table model.java.lang.StringgetColumnName(int column)Returns the name of a columnintgetRowCount()Returns the number of rows in the table model.java.lang.ObjectgetValueAt(int row, int column)Returns the data value for a cell in the table model.booleanisCellEditable(int row, int column)Returns a flag indicating whether or not the specified cell is editable.voidseriesChanged(SeriesChangeEvent event)Receives notification that the time series has been changed.voidsetValueAt(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
-
-
-
-
Field Detail
-
series
private TimeSeries series
The series.
-
editable
private boolean editable
A flag that controls whether the series is editable.
-
newTimePeriod
private RegularTimePeriod newTimePeriod
The new time period.
-
newValue
private java.lang.Number newValue
The new value.
-
-
Constructor Detail
-
TimeSeriesTableModel
public TimeSeriesTableModel()
Default constructor.
-
TimeSeriesTableModel
public TimeSeriesTableModel(TimeSeries series)
Constructs a table model for a time series.- Parameters:
series- the time series.
-
TimeSeriesTableModel
public TimeSeriesTableModel(TimeSeries series, boolean editable)
Creates a table model based on a time series.- Parameters:
series- the time series.editable- iftrue, the table is editable.
-
-
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:
getColumnCountin interfacejavax.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:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel- Parameters:
column- the column index.- Returns:
- The column class in the table model.
-
getColumnName
public java.lang.String getColumnName(int column)
Returns the name of a column- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classjavax.swing.table.AbstractTableModel- Parameters:
column- the column index.- Returns:
- The name of a column.
-
getRowCount
public int getRowCount()
Returns the number of rows in the table model.- Specified by:
getRowCountin interfacejavax.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:
getValueAtin interfacejavax.swing.table.TableModel- Parameters:
row- the row number.column- the column number.- Returns:
- The data value for a cell in the table model.
-
isCellEditable
public boolean isCellEditable(int row, int column)Returns a flag indicating whether or not the specified cell is editable.- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classjavax.swing.table.AbstractTableModel- Parameters:
row- the row number.column- the column number.- Returns:
trueif the specified cell is editable.
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int column)Updates the time series.- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classjavax.swing.table.AbstractTableModel- Parameters:
value- the new value.row- the row.column- the column.
-
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:
seriesChangedin interfaceSeriesChangeListener- Parameters:
event- the event.
-
-