## org.jfree.data
Class XYDatasetTableModel

    java.lang.Object
      javax.swing.table.AbstractTableModel
          org.jfree.data.XYDatasetTableModel

All Implemented Interfaces:
  DatasetChangeListener, java.util.EventListener, java.io.Serializable, javax.swing.table.TableModel

public class XYDatasetTableModel
extends javax.swing.table.AbstractTableModel
implements javax.swing.table.TableModel, DatasetChangeListener

A READ-ONLY wrapper around an `XYDataset` to convert it to a table model for use in a JTable.

TO DO:

- implement proper naming for x axis (getColumnName)
- implement setValueAt to remove READ-ONLY constraint (not sure how)

Author:
  Bryan Scott
See Also:
  Serialized Form

Field Summary

Fields inherited from class javax.swing.table.AbstractTableModel
`listenerList`

Constructor Summary
`XYDatasetTableModel()` Default constructor.
`XYDatasetTableModel(XYDataset dataset)` Creates a new table model based on the specified dataset.

Method Summary
`void` `datasetChanged(DatasetChangeEvent datasetChangeEvent)` Notify listeners 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(XYDataset dataset)` Sets the model (dataset).
`void` `setValueAt(java.lang.Object value, int row, int column)` Updates the `XYDataset` if allowed.

Methods inherited from class javax.swing.table.AbstractTableModel
`addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.swing.table.TableModel
`addTableModelListener, getColumnClass, removeTableModelListener`

Constructor Detail

### XYDatasetTableModel

    public XYDatasetTableModel()

  Default constructor.

### XYDatasetTableModel

    public XYDatasetTableModel(XYDataset dataset)

  Creates a new table model based on the specified dataset.

Parameters:
  `dataset` - the dataset.

Method Detail

### setModel

    public void setModel(XYDataset dataset)

  Sets the model (dataset).

  Parameters:
    `dataset` - the dataset.

### getRowCount

    public int getRowCount()

  Returns the number of rows.

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

### getColumnCount

    public int getColumnCount()

  Gets the number of columns in the model.

  Specified by:
    `getColumnCount` in interface `javax.swing.table.TableModel`
  Returns:
    The number of columns in the model.

### getColumnName

    public java.lang.String getColumnName(int column)

  Returns the column name.

  Specified by:
    `getColumnName` in interface `javax.swing.table.TableModel`
  Parameters:
    `column` - the column index.
  Returns:
    The column name.

### getValueAt

    public java.lang.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

  Specified by:
    `getValueAt` in interface `javax.swing.table.TableModel`
  Parameters:
    `row` - the row number.
    `column` - the column number.
  Returns:
    the value of the specified cell.

### datasetChanged

    public void datasetChanged(DatasetChangeEvent datasetChangeEvent)

  Notify listeners that the underlying dataset has changed.

  Specified by:
    `datasetChanged` in interface `DatasetChangeListener`
  Parameters:
    `datasetChangeEvent` - the event
  See Also:
    `DatasetChangeListener`

### 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`
  Parameters:
    `row` - the row number.
    `column` - the column number.
  Returns:
    `true` if the specified cell is editable.

### setValueAt

    public void setValueAt(java.lang.Object value,
                           int row,
                           int column)

  Updates the `XYDataset` if allowed.

  Specified by:
    `setValueAt` in interface `javax.swing.table.TableModel`
  Parameters:
    `value` - the new value.
    `row` - the row.
    `column` - the column.