Class CurveDataModel

All Implemented Interfaces:
Serializable, TableModel

public class CurveDataModel extends DefaultTableModel
Table model used by the curve editor to expose curve visibility and names. The model owns its row list but edits the referenced curves directly.
See Also:
  • Field Details

    • VIS_COLUMN

      public static final int VIS_COLUMN
      Constant used to designate display column;
      See Also:
    • NAME_COLUMN

      public static final int NAME_COLUMN
      Constant used to designate name column;
      See Also:
    • colNames

      protected static final String[] colNames
    • columnWidths

      protected static final int[] columnWidths
    • _data

      protected List<ACurve> _data
  • Constructor Details

    • CurveDataModel

      public CurveDataModel()
      Constructor
    • CurveDataModel

      public CurveDataModel(List<ACurve> curves)
      Constructor
      Parameters:
      curves - the initial data to populate the model with.
  • Method Details

    • getColumnCount

      public int getColumnCount()
      Get the number of columns
      Specified by:
      getColumnCount in interface TableModel
      Overrides:
      getColumnCount in class DefaultTableModel
      Returns:
      the number of columns
    • getRowCount

      public int getRowCount()
      Get the number of rows
      Specified by:
      getRowCount in interface TableModel
      Overrides:
      getRowCount in class DefaultTableModel
      Returns:
      the number of rows
    • setValueAt

      public void setValueAt(Object value, int row, int col)
      Set the value at a given row and column.
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class DefaultTableModel
      Parameters:
      value - The string to set.
      row - The zero based row.
      col - The zero based column.
    • getValueAt

      public Object getValueAt(int row, int col)
      Get the value at a given row and column
      Specified by:
      getValueAt in interface TableModel
      Overrides:
      getValueAt in class DefaultTableModel
      Returns:
      the value at a given row and column
    • add

      public void add(ACurve curve)
      Add a new curve into the table.
      Parameters:
      curve - the new object to add to the model.
    • isCellEditable

      public boolean isCellEditable(int rowIndex, int columnIndex)
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class DefaultTableModel
    • remove

      public void remove(ACurve curve)
      remove an curve from the table.
      Parameters:
      curve - the curveto remove.
    • clear

      public void clear()
      Clear all the data
    • setData

      public void setData(List<ACurve> data)
      Parameters:
      data - the data to set
    • getCurveAtRow

      public ACurve getCurveAtRow(int row)
      Get the curve (ACurve) in the model at the given row.
      Parameters:
      row - the zero based row
      Returns:
      the curve corresponding to the row, or null if row is out of range