Class DeluxeTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--DeluxeTableModel

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

A base class that extends the standard AbstractTableModel and provides an additional interface for sorting the tablemodel and obtaining tooltip values for a given cell.

See Also:
Serialized Form

Inner Class Summary
static class DeluxeTableModel.SortState
          A sort state keeps the sorting order of a column
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DeluxeTableModel()
           
 
Method Summary
 java.lang.Object getMinimumWidthColumnValue(int col)
          get an object which represents the minimum width of an object value for this column.
 java.lang.String getModelAsString()
          convert the table model to a long, formatted string.
 java.lang.String getToolTipAt(int row, int col)
          override this to implement tool tips for a cell
 boolean isColumnExpandable(int col)
          can this column expand? Use this to return true for columns that should remain as small as possible.
protected  void pushSortState(int col, boolean upDown)
          should be called by the subclass implementation of sortOnColumn( int ) on each successful sort, so that sorting state may be restored when the table model data is refreshed or replaced
 void setMaxSortStates(int max)
          the tablemodel stores a number of previous sort states, so that new model data may be sorted in a similar way to the old data.
 boolean sortOnColumn(int col)
          override this to implement table model sorting
protected static int[] sortStringArray(java.lang.String[] arr, boolean upDown)
          sort a string array, returning an int array containing the new indices.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeluxeTableModel

public DeluxeTableModel()
Method Detail

setMaxSortStates

public final void setMaxSortStates(int max)
the tablemodel stores a number of previous sort states, so that new model data may be sorted in a similar way to the old data.

pushSortState

protected final void pushSortState(int col,
                                   boolean upDown)
should be called by the subclass implementation of sortOnColumn( int ) on each successful sort, so that sorting state may be restored when the table model data is refreshed or replaced
See Also:
sortOnColumn( int )

sortOnColumn

public boolean sortOnColumn(int col)
override this to implement table model sorting
Parameters:
col - the column index to sort on
Returns:
true for success, false for failure

sortStringArray

protected static final int[] sortStringArray(java.lang.String[] arr,
                                             boolean upDown)
sort a string array, returning an int array containing the new indices. utility method for use by sortOnColumn( int )
Parameters:
arr - a String[] containing the strings to be sorted, cannot be null. The array references are shuffled about, leaving the array in a new, sorted state after method completion.
upDown - a boolean indicating true to sort up, false to sort down.
Returns:
an int[] containing the new indicies, cannot be null
See Also:
sortOnColumn( int )

getToolTipAt

public java.lang.String getToolTipAt(int row,
                                     int col)
override this to implement tool tips for a cell
Parameters:
row - the row index of the cell
col - the col index of the cell
Returns:
the string for the tooltip, or null for no tooltip

getMinimumWidthColumnValue

public java.lang.Object getMinimumWidthColumnValue(int col)
get an object which represents the minimum width of an object value for this column.
Parameters:
col - the column index
Returns:
can be null

isColumnExpandable

public boolean isColumnExpandable(int col)
can this column expand? Use this to return true for columns that should remain as small as possible.

getModelAsString

public java.lang.String getModelAsString()
convert the table model to a long, formatted string. Includes table headers