|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel mavis.gui.MagneticComponentTableModel
public class MagneticComponentTableModel
This is basically an intermediate wrapper for the data in the actual JTable table which is found in the MagneticComponentPanel. The class mainly takes care of number format presentation, and notifies listening clients about data content changes. It will also tell the JTable to autoselect the newest table entry, if a new component was added (adding new components is done externally from this class). This class was cut-n-pasted from the original MeasurementSequenceTableModel.java
Field Summary | |
---|---|
private java.util.List<ComponentColumn> |
columns
|
private Session |
session
|
private javax.swing.JTable |
table
|
private static java.lang.String |
VISIBLE_COLUMNS_PROPERTY
|
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
MagneticComponentTableModel()
Creates a new MeasurementSequenceTableModel with no active project. |
Method Summary | |
---|---|
void |
changeNumberFormat(java.lang.String format)
Changes certain columns into the specified number format. |
java.lang.Class<?> |
getColumnClass(int columnIndex)
Returns Object.class regardless of columnIndex . |
int |
getColumnCount()
Returns the number of columns in the model. |
java.lang.String |
getColumnName(int column)
Returns a name for the column. |
java.lang.String |
getColumnToolTip(int column)
Returns the tooltip text for the specified column. |
int |
getRowCount()
Returns the number of rows in the model. |
Session |
getSession()
Get the Session object reference that this class uses. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at columnIndex and rowIndex . |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell can be edited. |
void |
projectUpdated(ProjectEvent event)
This method is automatically invoked by the Project class, when the contents of the project changes. |
void |
sessionUpdated(SessionEvent event)
This method is automatically invoked by the Session class, when the contents of the session changes. |
void |
setSession(Session sess)
Set the Session object that this class should use. |
void |
setTable(javax.swing.JTable table)
Associates a JTable with this class. |
void |
setValueAt(java.lang.Object value,
int rowIndex,
int columnIndex)
Sets the value for the cell at columnIndex and rowIndex . |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String VISIBLE_COLUMNS_PROPERTY
private javax.swing.JTable table
private Session session
private java.util.List<ComponentColumn> columns
Constructor Detail |
---|
public MagneticComponentTableModel()
Method Detail |
---|
public Session getSession()
public void setSession(Session sess)
sess
- The Session object.public void setTable(javax.swing.JTable table)
public void sessionUpdated(SessionEvent event)
sessionUpdated
in interface SessionListener
event
- SessionEvent object, contains the type of changepublic void projectUpdated(ProjectEvent event)
projectUpdated
in interface ProjectListener
event
- ProjectEvent object, contains the type of changepublic int getRowCount()
JTable
uses this method to determine how many rows it
should display. This method should be quick, as it is called frequently during rendering.
getRowCount
in interface javax.swing.table.TableModel
getColumnCount()
public int getColumnCount()
JTable
uses this method to determine how many columns
it should create and display by default.
getColumnCount
in interface javax.swing.table.TableModel
getRowCount()
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and rowIndex
.
getValueAt
in interface javax.swing.table.TableModel
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queried
public void setValueAt(java.lang.Object value, int rowIndex, int columnIndex)
columnIndex
and rowIndex
.
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
value
- the new datarowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queriedpublic java.lang.String getColumnName(int column)
column
cannot be found, returns an empty string.
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
column
- the column being queried.
public java.lang.String getColumnToolTip(int column)
public java.lang.Class<?> getColumnClass(int columnIndex)
Object.class
regardless of columnIndex
.
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
columnIndex
- the column being queried
public void changeNumberFormat(java.lang.String format)
format
- to usepublic boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
rowIndex
- the row being queriedcolumnIndex
- the column being queried
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |