edu.umd.cfar.lamp.viper.gui.table
Class ViperTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byedu.umd.cfar.lamp.viper.gui.table.ViperTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
ContentTable.ContentDataModel, FileTable.FileDataModel, ObjectTable.ObjectDataModel

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

Viper table model presents a view for a table of all instances of a given descriptor config. It offers a few additional features, like the ability to hide columns (the attributes, the desc id, and the p/v box columns) and sort by columns. The attributes require an entry in the ViperSorters lookup table to be sortable. The canonical columns are BY_PROPAGATING, BY_VALID, and BY_ID, which are constants, and the attributes themselves, which align with the getChild(int) methods of the descriptor. These numbers are used for the 'display' methods, but all other methods use the 'real' model column numbering (note that even this isn't the highest level; there is still the columnmodel to worry about, which allows the user to reorder the columns).

See Also:
Serialized Form

Field Summary
static int BY_ID
           
static int BY_PROPAGATING
           
static int BY_VALID
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ViperTableModel(Config cfg)
           
 
Method Summary
 AttrConfig getAttributeForColumn(int col)
           
 java.lang.Class getColumnClass(int idx)
           
 int getColumnCount()
           
 int getColumnForAttribute(Attribute a)
           
 java.lang.String getColumnName(int idx)
           
 Config getConfig()
           
 Sourcefile getCurrFile()
           
 Descriptor getDescriptorAtRow(int row)
           
 boolean getDisplayOfColumn(int col)
           
abstract  ViperViewMediator getMediator()
           
 int getRowCount()
           
 int getRowForDescriptor(Descriptor d)
           
 java.lang.Object getValueAt(int row, int col)
           
 boolean isCellEditable(int row, int col)
           
 void removeSortBy(int col)
           
 boolean resetDescs()
          Makes sure that the currently displayed list of descriptors is in sync with the background.
 void resortDescs()
           
protected  void setConfig(Config cfg)
           
 void setDisplayOfColumn(int col, boolean b)
           
 void setValueAt(java.lang.Object val, int row, int col)
           
 void sortBy(int col)
           
 
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

BY_ID

public static final int BY_ID
See Also:
Constant Field Values

BY_VALID

public static final int BY_VALID
See Also:
Constant Field Values

BY_PROPAGATING

public static final int BY_PROPAGATING
See Also:
Constant Field Values
Constructor Detail

ViperTableModel

public ViperTableModel(Config cfg)
Parameters:
cfg -
Method Detail

resortDescs

public void resortDescs()

resetDescs

public boolean resetDescs()
Makes sure that the currently displayed list of descriptors is in sync with the background. This is like telling Windows Explorer to 'Refresh' (F5). Right now, this must be called manually, for all changes to what should be displayed.

Returns:
true if the table should reset its column widths

getMediator

public abstract ViperViewMediator getMediator()

getConfig

public Config getConfig()

setConfig

protected void setConfig(Config cfg)

getColumnForAttribute

public int getColumnForAttribute(Attribute a)

getColumnClass

public java.lang.Class getColumnClass(int idx)

getColumnName

public java.lang.String getColumnName(int idx)

sortBy

public void sortBy(int col)

getColumnCount

public int getColumnCount()

getRowCount

public int getRowCount()

getValueAt

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

getCurrFile

public Sourcefile getCurrFile()

getDescriptorAtRow

public Descriptor getDescriptorAtRow(int row)

getAttributeForColumn

public AttrConfig getAttributeForColumn(int col)

getRowForDescriptor

public int getRowForDescriptor(Descriptor d)

isCellEditable

public boolean isCellEditable(int row,
                              int col)

setValueAt

public void setValueAt(java.lang.Object val,
                       int row,
                       int col)

removeSortBy

public void removeSortBy(int col)

setDisplayOfColumn

public void setDisplayOfColumn(int col,
                               boolean b)

getDisplayOfColumn

public boolean getDisplayOfColumn(int col)