Package gov.nih.mipav.view
Class ViewTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
javax.swing.table.DefaultTableModel
gov.nih.mipav.view.ViewTableModel
- All Implemented Interfaces:
Serializable,TableModel
This is a simple class that creates a DefaultTableModel with uneditable cells. With the cells uneditable, the table
may react to mouse events, such as double clicking on a row.
- Version:
- 0.1 June 30, 1999
- Author:
- Neva Cherniavsky
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longUse serialVersionUID for interoperability.Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVectorFields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
ConstructorsConstructorDescriptionCalls super constructor.ViewTableModel(Object[] columnNames, int rowCount) Constructs a new table model with the given column names and row count. -
Method Summary
Modifier and TypeMethodDescriptionclone()Copies the object that extends this class.intgetColumnBaseIndex(String name) Gets the index of the given column name.getColumnClass(int col) Returns the class of the item in the column.intgetColumnIndex(String name) Gets the index of the given column name.intGets the index of a column name that starts with the given stringObject[]getRow(int row) intgetRowLength(int row) Gets the length of a row in the modelbooleanisCellEditable(int x, int y) Returns false for all cells, so none can be edited.voidsetColumnName(int col, Object newName) Sets the column name to the new name and fires the table event.voidsetValueAt(Object value, int row, int col) Sets the value at the given row and column of the table.voidupdateBulbs(int selectedRow) Updates the bulbs.Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCountMethods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
-
Constructor Details
-
ViewTableModel
public ViewTableModel()Calls super constructor. -
ViewTableModel
Constructs a new table model with the given column names and row count.- Parameters:
columnNames- Names of columns.rowCount- Number of rows.
-
-
Method Details
-
clone
Copies the object that extends this class. -
getColumnClass
Returns the class of the item in the column.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- Parameters:
col- Column index.- Returns:
- Class of column.
-
getColumnIndex
Gets the index of the given column name.- Parameters:
name- Name of column.- Returns:
- Index of column when created, or -1 if none.
-
getColumnStartsWithIndex
Gets the index of a column name that starts with the given string- Parameters:
name- String name of column- Returns:
- int Index of column, or -1 if none
-
getColumnBaseIndex
Gets the index of the given column name.- Parameters:
name- Name of column.- Returns:
- Index of column when created, or -1 if none.
-
isCellEditable
public boolean isCellEditable(int x, int y) Returns false for all cells, so none can be edited.- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classDefaultTableModel- Parameters:
x- x value of celly- y value of cell- Returns:
- false, always
-
setColumnName
Sets the column name to the new name and fires the table event. Table widths must be reset after this call.- Parameters:
col- Column to renamenewName- New name.
-
setValueAt
Sets the value at the given row and column of the table.- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classDefaultTableModel- Parameters:
value- Value to set.row- Row to set value at.col- Column to set value at.
-
updateBulbs
public void updateBulbs(int selectedRow) Updates the bulbs.- Parameters:
selectedRow- Row to update.
-
getRowLength
public int getRowLength(int row) Gets the length of a row in the model- Parameters:
row- index of row to get- Returns:
- length of vector at index row
-
getRow
-