Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.swing.data
Class HashtableTableModel  view HashtableTableModel download HashtableTableModel.java

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bycom.eireneh.swing.data.HashtableTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class HashtableTableModel
extends javax.swing.table.AbstractTableModel

TableModel using a Hashtable internally. Note that an AbstractTableModel (this is-a AbstractTableModel) reports changes to the data to the table itself. However since a Hashtable does not have a addChangeListener interface we can't do the same - SO if you change the Hashtable whilst we are displaying it then don't expect the changes to be automatically reflected in the JTable.
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.

Version:
D8.I5.T0

Field Summary
private  java.lang.String[] col_names
          The default column names
private  java.util.Hashtable hash
          The Hashtable that we are providing an interface to
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
HashtableTableModel(java.util.Hashtable hash)
          Create an internal store from a 2D array
 
Method Summary
 java.lang.Class getColumnClass(int col)
          Get the default class
 int getColumnCount()
          How many Cols are there in this store
 java.lang.String getColumnName(int col)
          The name of the of the colth column
 java.util.Hashtable getHashtable()
          Accessor for our source data
 int getRowCount()
          How many Rows are there in this store
 java.lang.Object getValueAt(int row, int col)
          Return the Object at row, col
 boolean isCellEditable(int row, int col)
          Can the specified cell be changed?
 void put(java.lang.Object key, java.lang.Object value)
          An easy way to add stuff to the table
 void remove(java.lang.Object key)
          An easy way to add stuff to the table
 void setColumnName(int col, java.lang.String name)
          The name of the of the colth column
 void setHashtable(java.util.Hashtable hash)
          Change the hashtable that we report on
 void setValueAt(java.lang.Object obj, int row, int col)
          Set the Object at row, coll
 
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

hash

private java.util.Hashtable hash
The Hashtable that we are providing an interface to


col_names

private java.lang.String[] col_names
The default column names

Constructor Detail

HashtableTableModel

public HashtableTableModel(java.util.Hashtable hash)
Create an internal store from a 2D array

Method Detail

getHashtable

public java.util.Hashtable getHashtable()
Accessor for our source data


setHashtable

public void setHashtable(java.util.Hashtable hash)
Change the hashtable that we report on


getColumnCount

public int getColumnCount()
How many Cols are there in this store


getRowCount

public int getRowCount()
How many Rows are there in this store


getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Return the Object at row, col


put

public void put(java.lang.Object key,
                java.lang.Object value)
An easy way to add stuff to the table


remove

public void remove(java.lang.Object key)
An easy way to add stuff to the table


setValueAt

public void setValueAt(java.lang.Object obj,
                       int row,
                       int col)
Set the Object at row, coll


isCellEditable

public boolean isCellEditable(int row,
                              int col)
Can the specified cell be changed?


getColumnClass

public java.lang.Class getColumnClass(int col)
Get the default class


getColumnName

public java.lang.String getColumnName(int col)
The name of the of the colth column


setColumnName

public void setColumnName(int col,
                          java.lang.String name)
The name of the of the colth column