com.zwares.base.gui.panels
Class ETableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--com.zwares.base.gui.panels.ETableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public abstract class ETableModel
extends javax.swing.table.AbstractTableModel

One can extend this abstract class to implement the table model. Must be only used when using ETablePabel.

See Also:
Serialized Form

Field Summary
protected  java.lang.String[] columns
           
protected  java.lang.Object[] data
           
protected  javax.swing.JTable table
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ETableModel()
          Creates a new ETableModel.
ETableModel(java.lang.String[] c)
          Creates a new ETableModel.
 
Method Summary
 void addRow(int index, java.lang.Object row)
          Adds a row to the table at the given index.
 void clearAll()
          Removes all the rows.
 int getColumnCount()
          Return the number of columns in this table.
 java.lang.String getColumnName(int col)
          Returns the column name given the index.
 java.lang.Object getRow(int index)
          Retruns the row at the given index.
 int getRowCount()
          Returns the number of rows in this table.
 javax.swing.JTable getTable()
          Returns the table that is using this model.
 java.lang.Object[] getTableData()
          Retunrs the table data for the table.
abstract  java.lang.Object getValueAt(int row, int col)
          Abstract method to get value at a cell.
 void removeRow(int index)
          Removes the row at given index.
 void setRowColor(int row, java.awt.Color color)
          Set the foreground color of the given row.
 void setTable(javax.swing.JTable t)
          Sets the table that is using this model.
 void setTableData(java.lang.Object[] d)
          Sets the table data for the table.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected javax.swing.JTable table

columns

protected java.lang.String[] columns

data

protected java.lang.Object[] data
Constructor Detail

ETableModel

public ETableModel()
Creates a new ETableModel.


ETableModel

public ETableModel(java.lang.String[] c)
Creates a new ETableModel. It accepts table and column names c[]

Method Detail

setTable

public void setTable(javax.swing.JTable t)
Sets the table that is using this model.


getTable

public javax.swing.JTable getTable()
Returns the table that is using this model.


setTableData

public void setTableData(java.lang.Object[] d)
Sets the table data for the table.


getTableData

public java.lang.Object[] getTableData()
Retunrs the table data for the table.


getValueAt

public abstract java.lang.Object getValueAt(int row,
                                            int col)
Abstract method to get value at a cell. This method must be implemented by all the sub classes.


getColumnCount

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


getColumnName

public java.lang.String getColumnName(int col)
Returns the column name given the index.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getRowCount

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


getRow

public java.lang.Object getRow(int index)
Retruns the row at the given index.


addRow

public void addRow(int index,
                   java.lang.Object row)
Adds a row to the table at the given index.


removeRow

public void removeRow(int index)
Removes the row at given index.


clearAll

public void clearAll()
Removes all the rows.


setRowColor

public void setRowColor(int row,
                        java.awt.Color color)
Set the foreground color of the given row.