infovis.panel
Class DetailTable

java.lang.Object
  extended by infovis.panel.DetailTable
All Implemented Interfaces:
EventListener, ChangeListener, TableModelListener, TableModel

public class DetailTable
extends Object
implements TableModel, TableModelListener, ChangeListener

Table Model for displaying the details of the selected rows of a visualization.

Version:
$Revision: 1.13 $
Author:
Jean-Daniel Fekete

Constructor Summary
DetailTable(Table table, BooleanColumn selection)
          Constructor for DetailTable.
 
Method Summary
 void addTableModelListener(TableModelListener l)
           
static JScrollPane createDetailJTable(Table table, BooleanColumn selection)
          Creates a scrollable JTable with convenient default setting for showing the selected items of a specified InfoVis Table.
 void fireTableChanged(TableModelEvent e)
          Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table sizeModel.
 void fireTableDataChanged()
          Notifies all listeners that all cell values in the table's rows may have changed.
 void fireTableStructureChanged()
          Notifies all listeners that the table's structure has changed.
 Column getColumnAt(int index)
           
 Class getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int columnIndex)
           
 int getRowAt(int columnIndex)
          Returns the row of the InfoVis column corresponding to the specified column index for the JTable
 int getRowCount()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void removeTableModelListener(TableModelListener l)
           
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
           
static void sizeColumn(JTable table, int i)
          Resize a specified JTable column to fit its natural size.
 void stateChanged(ChangeEvent e)
           
 void tableChanged(TableModelEvent e)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DetailTable

public DetailTable(Table table,
                   BooleanColumn selection)
Constructor for DetailTable. Build a table showing all the attributes of selected rows.

Parameters:
table - the specified Table to manage
selection - the column containing the selected items to manage in the table
Method Detail

sizeColumn

public static void sizeColumn(JTable table,
                              int i)
Resize a specified JTable column to fit its natural size. Asserts that the table only contains strings.

Parameters:
table - the JTable
i - the column

createDetailJTable

public static JScrollPane createDetailJTable(Table table,
                                             BooleanColumn selection)
Creates a scrollable JTable with convenient default setting for showing the selected items of a specified InfoVis Table.

Gets updated when the selection changes.

Parameters:
table - the specified Table
selection - the selection column
Returns:
A JScrollPane containing a JTable showing the details of the items selected in the table.

addTableModelListener

public void addTableModelListener(TableModelListener l)
Specified by:
addTableModelListener in interface TableModel
See Also:
TableModel.addTableModelListener(TableModelListener)

removeTableModelListener

public void removeTableModelListener(TableModelListener l)
Specified by:
removeTableModelListener in interface TableModel
See Also:
TableModel.removeTableModelListener(TableModelListener)

getColumnClass

public Class getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel
See Also:
TableModel.getColumnClass(int)

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel
See Also:
TableModel.getColumnCount()

getRowAt

public int getRowAt(int columnIndex)
Returns the row of the InfoVis column corresponding to the specified column index for the JTable

Parameters:
columnIndex - the column index in the JTable
Returns:
the row of the InfoVis column

getColumnName

public String getColumnName(int columnIndex)
Specified by:
getColumnName in interface TableModel
See Also:
TableModel.getColumnName(int)

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel
See Also:
TableModel.getRowCount()

getColumnAt

public Column getColumnAt(int index)

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel
See Also:
TableModel.getValueAt(int, int)

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel
See Also:
TableModel.isCellEditable(int, int)

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
See Also:
TableModel.setValueAt(Object, int, int)

stateChanged

public void stateChanged(ChangeEvent e)
Specified by:
stateChanged in interface ChangeListener
See Also:
ChangeListener.stateChanged(ChangeEvent)

tableChanged

public void tableChanged(TableModelEvent e)
Specified by:
tableChanged in interface TableModelListener
See Also:
TableModelListener.tableChanged(TableModelEvent)

fireTableDataChanged

public void fireTableDataChanged()
Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.

See Also:
TableModelEvent, EventListenerList, JTable.tableChanged(TableModelEvent)

fireTableStructureChanged

public void fireTableStructureChanged()
Notifies all listeners that the table's structure has changed. The number of columns in the table, and the names and types of the new columns may be different from the previous state. If the JTable receives this event and its autoCreateColumnsFromModel flag is set it discards any table columns that it had and reallocates default columns in the order they appear in the sizeModel. This is the same as calling setModel(TableModel) on the JTable.

See Also:
TableModelEvent, EventListenerList

fireTableChanged

public void fireTableChanged(TableModelEvent e)
Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table sizeModel.

Parameters:
e - the event to be forwarded
See Also:
addTableModelListener(javax.swing.event.TableModelListener), TableModelEvent, EventListenerList


Copyright 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.