public class XYDatasetTableModel extends javax.swing.table.AbstractTableModel implements javax.swing.table.TableModel, DatasetChangeListener
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 and Description |
---|
XYDatasetTableModel()
Default constructor.
|
XYDatasetTableModel(TableXYDataset dataset)
Creates a new table model based on the specified dataset.
|
Modifier and Type | Method and Description |
---|---|
void |
datasetChanged(DatasetChangeEvent event)
Receives notification that the underlying dataset has changed.
|
int |
getColumnCount()
Gets the number of columns in the model.
|
java.lang.String |
getColumnName(int column)
Returns the column name.
|
int |
getRowCount()
Returns the number of rows.
|
java.lang.Object |
getValueAt(int row,
int column)
Returns a value of the specified cell.
|
boolean |
isCellEditable(int row,
int column)
Returns a flag indicating whether or not the specified cell is editable.
|
void |
setModel(TableXYDataset dataset)
Sets the model (dataset).
|
void |
setValueAt(java.lang.Object value,
int row,
int column)
Updates the
XYDataset if allowed. |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
public XYDatasetTableModel()
public XYDatasetTableModel(TableXYDataset dataset)
dataset
- the dataset.public void setModel(TableXYDataset dataset)
dataset
- the dataset.public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
column
- the column index.public java.lang.Object getValueAt(int row, int column)
getValueAt
in interface javax.swing.table.TableModel
row
- the row number.column
- the column number.public void datasetChanged(DatasetChangeEvent event)
datasetChanged
in interface DatasetChangeListener
event
- the eventDatasetChangeListener
public boolean isCellEditable(int row, int column)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
row
- the row number.column
- the column number.true
if the specified cell is editable.public void setValueAt(java.lang.Object value, int row, int column)
XYDataset
if allowed.setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
value
- the new value.row
- the row.column
- the column.