org.jfree.data.xy

Class XYDatasetTableModel

public class XYDatasetTableModel extends AbstractTableModel implements TableModel, DatasetChangeListener

A READ-ONLY wrapper around a TableXYDataset to convert it to a table model for use in a JTable. The first column of the table shows the x-values, the remaining columns show the y-values for each series (series 0 appears in column 1, series 1 appears in column 2, etc).

TO DO:

Constructor Summary
XYDatasetTableModel()
Default constructor.
XYDatasetTableModel(TableXYDataset dataset)
Creates a new table model based on the specified dataset.
Method Summary
voiddatasetChanged(DatasetChangeEvent event)
Receives notification that the underlying dataset has changed.
intgetColumnCount()
Gets the number of columns in the model.
StringgetColumnName(int column)
Returns the column name.
intgetRowCount()
Returns the number of rows.
ObjectgetValueAt(int row, int column)
Returns a value of the specified cell.
booleanisCellEditable(int row, int column)
Returns a flag indicating whether or not the specified cell is editable.
voidsetModel(TableXYDataset dataset)
Sets the model (dataset).
voidsetValueAt(Object value, int row, int column)
Updates the XYDataset if allowed.

Constructor Detail

XYDatasetTableModel

public XYDatasetTableModel()
Default constructor.

XYDatasetTableModel

public XYDatasetTableModel(TableXYDataset dataset)
Creates a new table model based on the specified dataset.

Parameters: dataset the dataset.

Method Detail

datasetChanged

public void datasetChanged(DatasetChangeEvent event)
Receives notification that the underlying dataset has changed.

Parameters: event the event

See Also: DatasetChangeListener

getColumnCount

public int getColumnCount()
Gets the number of columns in the model.

Returns: The number of columns in the model.

getColumnName

public String getColumnName(int column)
Returns the column name.

Parameters: column the column index.

Returns: The column name.

getRowCount

public int getRowCount()
Returns the number of rows.

Returns: The row count.

getValueAt

public Object getValueAt(int row, int column)
Returns a value of the specified cell. Column 0 is the X axis, Columns 1 and over are the Y axis

Parameters: row the row number. column the column number.

Returns: The value of the specified cell.

isCellEditable

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

Parameters: row the row number. column the column number.

Returns: true if the specified cell is editable.

setModel

public void setModel(TableXYDataset dataset)
Sets the model (dataset).

Parameters: dataset the dataset.

setValueAt

public void setValueAt(Object value, int row, int column)
Updates the XYDataset if allowed.

Parameters: value the new value. row the row. column the column.

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.