org.opensourcephysics.controls
Class XMLTableModel

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

public class XMLTableModel
extends javax.swing.table.AbstractTableModel

A table model for an XMLTable.

Version:
1.0
Author:
Douglas Brown
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
XMLTableModel(XMLControl control)
          Constructor.
 
Method Summary
 int getColumnCount()
          Gets the number of columns.
 java.lang.String getColumnName(int column)
          Gets the name of the specified column.
 int getRowCount()
          Gets the number of rows.
 java.lang.Object getValueAt(int row, int column)
          Gets the value at the given cell.
 boolean isCellEditable(int row, int col)
          Determines whether the given cell is editable.
 void setValueAt(java.lang.Object value, int row, int col)
          Sets the value at the given cell.
 
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
 

Constructor Detail

XMLTableModel

public XMLTableModel(XMLControl control)
Constructor.

Parameters:
control - an xml control
Method Detail

getColumnCount

public int getColumnCount()
Gets the number of columns.

Returns:
the column count

getColumnName

public java.lang.String getColumnName(int column)
Gets the name of the specified column.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.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 java.lang.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 javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - the row index
col - the column index
Returns:
true if editable

setValueAt

public void setValueAt(java.lang.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 javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
value - the value
row - the row index
col - the column index