Class XMLTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
org.opensourcephysics.controls.XMLTableModel
All Implemented Interfaces:
Serializable, TableModel

public class XMLTableModel extends AbstractTableModel
A table model for an XMLTable.
Version:
1.0
Author:
Douglas Brown
See Also:
  • Constructor Details

    • XMLTableModel

      public XMLTableModel(XMLControl control)
      Constructor.
      Parameters:
      control - an xml control
  • Method Details

    • getColumnCount

      public int getColumnCount()
      Gets the number of columns.
      Returns:
      the column count
    • getColumnName

      public String getColumnName(int column)
      Gets the name of the specified column.
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
      Parameters:
      column - the column index
      Returns:
      the column name
    • getRowCount

      public int getRowCount()
      Gets the number of rows.
      Returns:
      the row count
    • getValueAt

      public Object getValueAt(int row, int column)
      Gets the value at the given cell. Column 0 = property name Column 1 = property content (String for int, double, boolean, string types, XMLControl for object type, XMLProperty for array, collection types)
      Parameters:
      row - the row index
      column - the column index
      Returns:
      the value
    • isCellEditable

      public boolean isCellEditable(int row, int col)
      Determines whether the given cell is editable.
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class AbstractTableModel
      Parameters:
      row - the row index
      col - the column index
      Returns:
      true if editable
    • setValueAt

      public void setValueAt(Object value, int row, int col)
      Sets the value at the given cell. This method only sets values for int, double, boolean and string types.
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class AbstractTableModel
      Parameters:
      value - the value
      row - the row index
      col - the column index