jskat.gui.main
Class ScoreTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jskat.gui.main.ScoreTableModel
All Implemented Interfaces:
java.io.Serializable, java.util.Observer, javax.swing.table.TableModel

public class ScoreTableModel
extends javax.swing.table.AbstractTableModel
implements java.util.Observer

The table model for the score table

Author:
Jan Schäfer
See Also:
Serialized Form

Field Summary
(package private) static org.apache.log4j.Logger log
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ScoreTableModel(JSkatDataModel dataModel)
          Creates a new ScoreTableDataModel
 
Method Summary
 java.lang.Class getColumnClass(int c)
          Gets the class of a column
 int getColumnCount()
          Gets the column count
 java.lang.String getColumnName(int col)
          Gets the name of a column
 int getRowCount()
          Gets the row count
 java.lang.Object getValueAt(int row, int col)
          Get the value of one table cell
 boolean isCellEditable(int row, int col)
          Returns whether a cell is editable or not
 void setValueAt(java.lang.Object value, int row, int col)
          Sets a value for a table cell
 void update(java.util.Observable observ, java.lang.Object obj)
          Implementation of the Observer pattern
 
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

log

static org.apache.log4j.Logger log
Constructor Detail

ScoreTableModel

public ScoreTableModel(JSkatDataModel dataModel)
Creates a new ScoreTableDataModel

Parameters:
dataModel - The JSkatDataModel that holds all data
Method Detail

getColumnCount

public int getColumnCount()
Gets the column count

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
column count

getRowCount

public int getRowCount()
Gets the row count

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
row count

getColumnName

public java.lang.String getColumnName(int col)
Gets the name of a column

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col - ID of the column
Returns:
name of the column

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Get the value of one table cell

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
row - row of table cell
col - column of table cell
Returns:
the value of the table cell

getColumnClass

public java.lang.Class getColumnClass(int c)
Gets the class of a column

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
c - the ID of the column
Returns:
the class of the column

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Returns whether a cell is editable or not

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - row of the table cell
col - column of the table cell
Returns:
TRUE if the cell is editable

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int col)
Sets a value for a table cell

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
value - the value to be set
row - the row of the table cell
col - the column of the table cell

update

public void update(java.util.Observable observ,
                   java.lang.Object obj)
Implementation of the Observer pattern

Specified by:
update in interface java.util.Observer
Parameters:
observ - The Observable that is observed
obj - The Object that has changed in the Observable