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:
java.io.Serializable
,javax.swing.table.TableModel
public class ViewTableModel extends javax.swing.table.DefaultTableModel implements java.io.Serializable
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
Use serialVersionUID for interoperability.
-
Constructor Summary
Constructors Constructor Description ViewTableModel()
Calls super constructor.ViewTableModel(java.lang.Object[] columnNames, int rowCount)
Constructs a new table model with the given column names and row count.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Copies the object that extends this class.int
getColumnBaseIndex(java.lang.String name)
Gets the index of the given column name.java.lang.Class<? extends java.lang.Object>
getColumnClass(int col)
Returns the class of the item in the column.int
getColumnIndex(java.lang.String name)
Gets the index of the given column name.int
getColumnStartsWithIndex(java.lang.String name)
Gets the index of a column name that starts with the given stringjava.lang.Object[]
getRow(int row)
int
getRowLength(int row)
Gets the length of a row in the modelboolean
isCellEditable(int x, int y)
Returns false for all cells, so none can be edited.void
setColumnName(int col, java.lang.Object newName)
Sets the column name to the new name and fires the table event.void
setValueAt(java.lang.Object value, int row, int col)
Sets the value at the given row and column of the table.void
updateBulbs(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, setRowCount
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ViewTableModel
public ViewTableModel()
Calls super constructor.
-
ViewTableModel
public ViewTableModel(java.lang.Object[] columnNames, int rowCount)
Constructs a new table model with the given column names and row count.- Parameters:
columnNames
- Names of columns.rowCount
- Number of rows.
-
-
Method Detail
-
clone
public java.lang.Object clone()
Copies the object that extends this class.- Overrides:
clone
in classjava.lang.Object
- Returns:
- An exact copy of this class.
-
getColumnClass
public java.lang.Class<? extends java.lang.Object> getColumnClass(int col)
Returns the class of the item in the column.- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
- Parameters:
col
- Column index.- Returns:
- Class of column.
-
getColumnIndex
public int getColumnIndex(java.lang.String name)
Gets the index of the given column name.- Parameters:
name
- Name of column.- Returns:
- Index of column when created, or -1 if none.
-
getColumnStartsWithIndex
public int getColumnStartsWithIndex(java.lang.String name)
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
public int getColumnBaseIndex(java.lang.String name)
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:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.DefaultTableModel
- Parameters:
x
- x value of celly
- y value of cell- Returns:
- false, always
-
setColumnName
public void setColumnName(int col, java.lang.Object newName)
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
public void setValueAt(java.lang.Object value, int row, int col)
Sets the value at the given row and column of the table.- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classjavax.swing.table.DefaultTableModel
- 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
public java.lang.Object[] getRow(int row)
-
-