Class InputModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--InputModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
InputCharacterModel, InputDistanceModel

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

This class is used to defines the common methods used in the input tables.

See Also:
Serialized Form

Field Summary
protected  int count
          The number of species
protected  java.lang.String[] names
          The names of the species
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
InputModel()
           
 
Method Summary
abstract  boolean checkInput(javax.swing.JFrame frame)
          Each input table model should implements the method to define how the input data should be checked.
 int getCount()
          Gets the number of the species.
 java.lang.String[] getNames()
          Gets the names of the species.
 boolean isCellEditable(int row, int col)
          Overrides the method in the TableModel class and sets if the cell can be edited.
abstract  void saveInputToFile(java.lang.String fileName)
          Each input table model should implements the method to define how the input data can be saved.
 java.lang.String space(int n)
          Generates the specified number of spaces.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, 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
getColumnCount, getRowCount, getValueAt
 

Field Detail

count

protected int count
The number of species


names

protected java.lang.String[] names
The names of the species

Constructor Detail

InputModel

public InputModel()
Method Detail

saveInputToFile

public abstract void saveInputToFile(java.lang.String fileName)
Each input table model should implements the method to define how the input data can be saved.

Parameters:
fileName - the name of the file to save input data

checkInput

public abstract boolean checkInput(javax.swing.JFrame frame)
Each input table model should implements the method to define how the input data should be checked.

Returns:
true - if the data do not contain errors
false - if the data contain any errors

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Overrides the method in the TableModel class and sets if the cell can be edited.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - the row whose value to be queried
col - the column whose value to be queried

getNames

public java.lang.String[] getNames()
Gets the names of the species.

Returns:
the names of the species

getCount

public int getCount()
Gets the number of the species.

Returns:
the number of the species

space

public java.lang.String space(int n)
Generates the specified number of spaces.

Parameters:
n - the number of spaces
Returns:
the string with n spaces