Home » openjdk-7 » net.sourceforge » jbird » [javadoc | source]
net.sourceforge.jbird
public class: SpeciesTableModel [javadoc | source]
java.lang.Object
   javax.swing.table.AbstractTableModel
      net.sourceforge.jbird.SpeciesTableModel

All Implemented Interfaces:
    TableModel, Serializable

Direct Known Subclasses:
    SpeciesDataTableModel

A table model for species lists that supports collapsable families. Species within families can be hidden or shown.

This table model is suitable for presenting a simple list of species.

Field Summary
public static final  int NO_BOLD    getValueAt returns family names unadorned. 
public static final  int BOLD_EXPORT    getValueAt returns <B>family names</B< for use in an html document. 
public static final  int BOLD_TABLE    getValueAt returns family names as a bold html document for use in JTables. 
protected  boolean collapsable    Flag indicating whether families can be collapsed. 
protected  boolean show_families    Flag indicating whether families should be shown in the table. 
protected  int bold_families    Flat indicating whether families should be displayed in bold. 
protected  boolean show_scientific    Flag indicating whether scientific names or common names should be shown. 
protected  IndexedSpeciesList species_list    ArrayList of species that's indexed by family. 
protected  ArrayList family_index    Local copy of the ArrayList of family indices. Do I need this here? 
protected  boolean[] visible_families    Array of boolean flags, one per family that indicates whether the family should be expanded or hidden within the visisble table. 
protected  int[] exp_lengths    Array with an entry for each family that indicates how many species are in the family. 
protected  int[] first_table_idx    Array with entry for each family that indicates the row in the visibible table that is occupied by the first entry for that family (the family entry). Calculated by calculateTableOffsets. 
protected  int collapsable_length    Number of rows in visible table. Calculated by calculateTableOffsets. 
protected  String fam_title     
protected  String species_title     
Fields inherited from javax.swing.table.AbstractTableModel:
listenerList
Constructor:
 public SpeciesTableModel(SpeciesSet set) 
    Builds IndexedSpeciesSet from set and invokes that constructor.
 public SpeciesTableModel(IndexedSpeciesList list) 
Method from net.sourceforge.jbird.SpeciesTableModel Summary:
calculateTableOffsets,   extractLengths,   getBoldness,   getColFamilyIdx,   getColumnClass,   getColumnCount,   getColumnName,   getCommonName,   getFamilyIdx,   getFamilyName,   getFamilyValueAt,   getNameAt,   getRowCount,   getScientificName,   getSpeciesIdx,   getSpeciesIdx,   getSpeciesName,   getUncolFamilyIdx,   getValueAt,   getVisibleToken,   isCellEditable,   isCollapsable,   isShowFamilies,   isShowScientific,   nullify,   setAllFamiliesVisible,   setBoldness,   setCollapsable,   setFamilyIdxVisible,   setFamilyNumVisible,   setShowFamilies,   setShowScientific,   setValueAt,   toggleFamily
Methods from javax.swing.table.AbstractTableModel:
addTableModelListener,   findColumn,   fireTableCellUpdated,   fireTableChanged,   fireTableDataChanged,   fireTableRowsDeleted,   fireTableRowsInserted,   fireTableRowsUpdated,   fireTableStructureChanged,   getColumnClass,   getColumnName,   getListeners,   getTableModelListeners,   isCellEditable,   removeTableModelListener,   setValueAt
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from net.sourceforge.jbird.SpeciesTableModel Detail:
 protected final  void calculateTableOffsets() 
    Calculate the offset for the row of each family in the visible table. Also calculates length of visible table base on which families are visible.
 protected final  void extractLengths() 
    Extract the numbers of species within families from the ArrayList of families and fill exp_lengths.
 public int getBoldness() 
    Return the index indicating how getValueAt emboldens family names that it returns.
 protected final int getColFamilyIdx(int tablerow) 
    Return the index of the family in the ArrayList that is represented in the tablerow'th row of the visible table.

    Note that the row may present either the famly name or a species within the family. If tablerow is equal to the corresponding entry of first_table_idx, then the family name should be displayed. Otherwise a species name will be displayed.

 public Class getColumnClass(int colidx) 
    Overrides AbstractTableModel
 public int getColumnCount() 
    Overrides AbstractTableModel
 public String getColumnName(int colno) 
    Overrides AbstractTableModel
 public String getCommonName(int idx) 
    Return the common name of the species at the specified index within the ArrayList of species.
 protected final int getFamilyIdx(int tablerow) 
 protected final String getFamilyName(int rowidx,
    int fidx) 
    Return the name of the name of the family at offset fidx in the ArrayList of families.
 protected final String getFamilyValueAt(int rowidx,
    int colidx) 
    Return the text to be displayed in a cell when families are displayed.

    For column 0, it will return a blank for species lines, and an open or closed symbol for family lines.

    For column 1, it will return either the name of the species or the name of the family depending on what should be represented in the row of the visible table.

 protected final String getNameAt(int rowidx,
    int fidx) 
    Return either the Family name at or the species name at a given row number in the visible table given that whatever is to be displayed is in the fidx'th family within the list of families.
 public int getRowCount() 
    Overrides AbstractTableModel
 public String getScientificName(int idx) 
    Return the scientific name of the species at the specified index within the ArrayList of species.
 protected final int getSpeciesIdx(int tablerow) 
    Return the index of the row species ArrayList that is displayed on the tablerow'th row of the visible table. Returns -1 if a family name is displayed.
 protected final int getSpeciesIdx(int rowidx,
    int fidx) 
    Return the index of a species in the ArrayList of species that should be displayed in the visible table on the rowidx'th row, given that the species is known to be in the family represented by the fidx'th family in the array of families.
 public String getSpeciesName(int idx) 
    Return the name of the species at the given row of the species ArrayList.
 protected final int getUncolFamilyIdx(int tablerow) 
    Return index of family represented by tablerow when families are visible but not collapsable.
 public Object getValueAt(int rowidx,
    int colidx) 
    Overrides AbstractTableModel
 protected final String getVisibleToken(int rowidx,
    int fidx) 
    Return a displayable token that indicates whether a family is expanded. Returns
    • " " for species
    • "V" for visible family
    • ">" for hidden family
 public boolean isCellEditable(int rowidx,
    int colidx) 
    Overrides AbstractTableModel
 public final boolean isCollapsable() 
 public final boolean isShowFamilies() 
 public final boolean isShowScientific() 
 public  void nullify() 
 public final  void setAllFamiliesVisible(boolean to) 
    Set visibility of all families in the table, and recalculate table offsets if necessary.
 public final  void setBoldness(int boldness) 
    Set the manner in which getValueAt emboldens family names.
 public final  void setCollapsable(boolean to) 
    Toggle collapsability of families.
 public final  void setFamilyIdxVisible(int famidx,
    boolean to) 
    Set visibility of species within the family (index within the array of families), and recalculate offsets in table if necessary.
 public final  void setFamilyNumVisible(int famno,
    boolean to) 
    Set visibility of a family given its identifying number in the database.
 public final  void setShowFamilies(boolean to) 
    Toggle display of family names.
 public final  void setShowScientific(boolean to) 
    Set table to show scientific names if true and to show common names if false.
 public  void setValueAt(Object newvalue,
    int rowidx,
    int colidx) 
    Overrides AbstractTableModel
 public final  void toggleFamily(int rowidx) 
    Toggle visibility of family at row rowidx in the visisble table.