Package org.opensourcephysics.controls
Class XMLTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
org.opensourcephysics.controls.XMLTableModel
- All Implemented Interfaces:
Serializable,TableModel
A table model for an XMLTable.
- Version:
- 1.0
- Author:
- Douglas Brown
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets the number of columns.getColumnName(int column) Gets the name of the specified column.intGets the number of rows.getValueAt(int row, int column) Gets the value at the given cell.booleanisCellEditable(int row, int col) Determines whether the given cell is editable.voidsetValueAt(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
-
Constructor Details
-
XMLTableModel
Constructor.- Parameters:
control- an xml control
-
-
Method Details
-
getColumnCount
public int getColumnCount()Gets the number of columns.- Returns:
- the column count
-
getColumnName
Gets the name of the specified column.- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel- Parameters:
column- the column index- Returns:
- the column name
-
getRowCount
public int getRowCount()Gets the number of rows.- Returns:
- the row count
-
getValueAt
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 indexcolumn- the column index- Returns:
- the value
-
isCellEditable
public boolean isCellEditable(int row, int col) Determines whether the given cell is editable.- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel- Parameters:
row- the row indexcol- the column index- Returns:
- true if editable
-
setValueAt
Sets the value at the given cell. This method only sets values for int, double, boolean and string types.- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel- Parameters:
value- the valuerow- the row indexcol- the column index
-