Class PhaseTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by PhaseTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class PhaseTableModel
extends javax.swing.table.AbstractTableModel

Creates a table container to hold properties of phases present in the equilibrium assemblage. This table is displayed in the main window of the GUI.

Version:
1.0 (August 2007)
Author:
Mark S. Ghiorso, OFM-Research Inc.
See Also:
Serialized Form

Field Summary
static int UNIT_GRAMS
          Quantity of each phase is displayed in grams.
static int UNIT_VOLUME_PERCENT
          Quantity of each phase is displayed in volume %.
static int UNIT_WEIGHT_PERCENT
          Quantity of each phase is displayed in wt %.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Method Summary
 java.lang.Class getColumnClass(int c)
          Get class of objects stored in a table column.
 int getColumnCount()
          Get number of columns in the table.
 java.lang.String getColumnName(int col)
          Get column header label.
 int getRowCount()
          Get number of rows in the table.
 java.lang.Object getValueAt(int row, int col)
          Get value stored in a table cell.
 boolean isCellEditable(int row, int col)
          Determine if a particular table cell may be edited by the user on the GUI.
 void setDisplayUnit(int units)
          Sets display of the quantity property for all phases in the table.
 void setValueAt(java.lang.Object value, int row, int col)
          Set the value of a cell in the table.
 
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

UNIT_GRAMS

public static int UNIT_GRAMS
Quantity of each phase is displayed in grams.


UNIT_WEIGHT_PERCENT

public static int UNIT_WEIGHT_PERCENT
Quantity of each phase is displayed in wt %.


UNIT_VOLUME_PERCENT

public static int UNIT_VOLUME_PERCENT
Quantity of each phase is displayed in volume %.

Method Detail

setDisplayUnit

public void setDisplayUnit(int units)
Sets display of the quantity property for all phases in the table.

Parameters:
units - Permissible values are UNIT_GRAMS, UNIT_WEIGHT_PERCENT, and UNIT_VOLUME_PERCENT.

getColumnCount

public int getColumnCount()
Get number of columns in the table.

Returns:
Number of columns in table.

getRowCount

public int getRowCount()
Get number of rows in the table.

Returns:
Number of rows in table.

getColumnName

public java.lang.String getColumnName(int col)
Get column header label.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col - Index number of table column.
Returns:
Header label for column.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Get value stored in a table cell.

Parameters:
row - Index number of table row.
col - Index number of table column.
Returns:
Value stored in specified cell. Retrieved as an object that must be caste to a java type for display.

getColumnClass

public java.lang.Class getColumnClass(int c)
Get class of objects stored in a table column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
c - Index number of table column.
Returns:
Specific class of objects stored in this table column.

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Determine if a particular table cell may be edited by the user on the GUI.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - Index number of table row.
col - Index number of table column.
Returns:
True if editable; false otherwise. Always returns false.

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int col)
Set the value of a cell in the table.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
value - Java object.
row - Index number of table row.
col - Index number of table column.