gov.nih.nlm.mms.filters
Class PrecedenceTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bygov.nih.nlm.mms.filters.PrecedenceTableModel
All Implemented Interfaces:
CutandPasteDNDTableModel, Serializable, TableModel

public class PrecedenceTableModel
extends AbstractTableModel
implements CutandPasteDNDTableModel

Manages and initializes the data for the Precedence table

Author:
Deborah Shapiro, Brian Carlsen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
PrecedenceTableModel(ApplicationConfiguration config, PrecedenceFilter filter)
          This constructor takes the initial values for the precedence table from the default configuration file.
 
Method Summary
 void cutRow(int[] rows_to_cut)
          Removes rows in table that are cut.
 Class getColumnClass(int column_number)
          Returns the Class of the Objects in column with index column_number.
 int getColumnCount()
          Returns the number of columns in the precedence table.
 String getColumnName(int column_number)
          Returns the name of a column in the precedence table.
 int getRowCount()
          Returns the number of rows in the precedence table.
 int getRowForSourceTermType(SourceTermType tg)
          Gets row from the PrecedenceFilter's precedence array for the given SourceTermType.
 Object getValueAt(int row, int column)
          Returns the value at the cell of the precedence table.
 void moveRow(int[] drag_row_index, int drop_row_index)
          Moves rows in table from initial/drag location to final/drop location.
 void pasteRow(int paste_location)
          Pastes rows in table that were cut.
 void setData(ArrayList d)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

PrecedenceTableModel

public PrecedenceTableModel(ApplicationConfiguration config,
                            PrecedenceFilter filter)
This constructor takes the initial values for the precedence table from the default configuration file.

Parameters:
config - ApplicationConfiguration object
filter - PrecedenceFilter
Method Detail

setData

public void setData(ArrayList d)

getColumnCount

public int getColumnCount()
Returns the number of columns in the precedence table.

Specified by:
getColumnCount in interface TableModel
Returns:
the number of columns

getRowCount

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

Specified by:
getRowCount in interface TableModel
Returns:
the number of rows

getColumnName

public String getColumnName(int column_number)
Returns the name of a column in the precedence table.

Specified by:
getColumnName in interface TableModel
Parameters:
column_number - The int number of the column in question
Returns:
the String name of the column in the table in position column_number

getValueAt

public Object getValueAt(int row,
                         int column)
Returns the value at the cell of the precedence table.

Specified by:
getValueAt in interface TableModel
Parameters:
row - The int row number of the cell
column - The int column number of the cell
Returns:
the Object value at the cell at row and column

getColumnClass

public Class getColumnClass(int column_number)
Returns the Class of the Objects in column with index column_number.

Specified by:
getColumnClass in interface TableModel
Parameters:
column_number - int indicates the column in question
Returns:
the Class of the column

moveRow

public void moveRow(int[] drag_row_index,
                    int drop_row_index)
Moves rows in table from initial/drag location to final/drop location.

Specified by:
moveRow in interface CutandPasteDNDTableModel
Parameters:
drag_row_index - are the indexes of the rows that are to be dragged
drop_row_index - is the index where the dragged row is to be dropped

cutRow

public void cutRow(int[] rows_to_cut)
Removes rows in table that are cut. Saves the cut data for when the paste event occurs.

Specified by:
cutRow in interface CutandPasteDNDTableModel
Parameters:
rows_to_cut - are the indexes of the rows that are to be cut

pasteRow

public void pasteRow(int paste_location)
Pastes rows in table that were cut.

Specified by:
pasteRow in interface CutandPasteDNDTableModel
Parameters:
paste_location - is the index where the cut row will be pasted

getRowForSourceTermType

public int getRowForSourceTermType(SourceTermType tg)
Gets row from the PrecedenceFilter's precedence array for the given SourceTermType.

Parameters:
tg - SourceTermType
Returns:
int row for the given SourceTermType


Copyright ©2005