com.sas.swing.models
Class SortableTableModelAdapter

com.sas.swing.models.SortableTableModelAdapter
All Implemented Interfaces:
ViewDefaultModel, AccurateRowCountInterface, DeleteRowInterface, InsertRowInterface, com.sas.table.SortableInterface, com.sas.table.StaticRowLabelInterface, TrueRowCountCalculatedInterface, UpdateRowInterface, com.sas.util.SortDirectionInterface, java.io.Serializable, java.util.EventListener, javax.swing.event.TableModelListener, javax.swing.table.TableModel

public class SortableTableModelAdapter
implements com.sas.table.SortableInterface, ViewDefaultModel, TrueRowCountCalculatedInterface, javax.swing.event.TableModelListener, DeleteRowInterface, InsertRowInterface, UpdateRowInterface, com.sas.util.SortDirectionInterface, com.sas.table.StaticRowLabelInterface

A sorter for javax.swing.TableModels. The sorter has a model and itself implements TableModel. SortableTableModelAdapter does not store or copy the data in the TableModel, instead it maintains an array of integers which it keeps the same size as the number of rows in its model. When the model changes it notifies the sorter that something has changed eg. "rowsAdded" so that its internal array of integers can be reallocated. As requests are made of the sorter (like getValueAt(row, col) it redirects them to its model via the mapping array. That way the SortableTableModelAdapter appears to hold another copy of the table with the rows in a different order. The sorting algorthm used is stable which means that it does not move around rows when its comparison function returns 0 to denote that they are equivalent.

See Also:
Serialized Form

Field Summary
protected  boolean autoResort
           
protected  boolean caseSensitive
           
protected  java.util.Map columnComparators
           
protected  java.util.Comparator defaultComparator
           
protected  boolean defaultModelAttached
           
protected  int[] indexes
           
protected  javax.swing.table.TableModel model
           
protected  javax.swing.event.SwingPropertyChangeSupport propertyChangeSupport
           
protected  boolean sortAllowed
           
protected  java.lang.String[] sortedColumns
           
protected  int[] sortedDirections
           
protected  java.lang.String[] sortingColumns
           
protected  int[] sortingDirections
           
protected  boolean staticRowLabelOrder
           
 
Fields inherited from interface com.sas.util.SortDirectionInterface
ASCENDING, DESCENDING, NOT_SORTED
 
Fields inherited from interface com.sas.table.InsertRowInterface
DEFAULT_INDEX
 
Constructor Summary
SortableTableModelAdapter()
          Default Constructor, calls this(null).
SortableTableModelAdapter(javax.swing.table.TableModel model)
          Constructs a SortableTableModelAdapter with the given model as the model to sort.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener to the adapter.
 void cancelUncommittedRow()
          If an uncommited row is present, this will cancel the row insertion and remove the uncommitted row from the model.
 void commitUncommittedRow()
          If an uncommitted row is present, this will commit the row into the model.
 int convertRowIndexToModel(int viewIndex)
          Returns the true model index for a given viewer row index.
 int convertRowIndexToView(int modelIndex)
          Returns the true 0 based viewer index for a given model row index.
 void deleteRow(int rowIndex)
          Deletes the given row from the model.
protected  void firePropertyChange(java.beans.PropertyChangeEvent evt)
          Send a PropertyChangeEvent to any listeners added to the adapter.
protected  void firePropertyChange(java.lang.String propName, java.lang.Object oldValue, java.lang.Object newValue)
          Send a PropertyChangeEvent to any listeners added to the adapter.
 java.lang.Class getColumnClass(int columnIndex)
          Returns the column class for the given column index.
 java.util.Comparator getColumnComparator(java.lang.String column)
          Return the current comparator on the given column, which can be null and is null by default.
 int getColumnCount()
          Returns the column count of the model.
 java.lang.String getColumnName(int columnIndex)
          Returns the column name for the given column index.
 java.util.Comparator getDefaultComparator()
          Returns the comparator that is used by default when sorting on a column occurs.
 javax.swing.table.TableModel getModel()
          Returns the model that is being sorted, this method will never return null.
 int getRowCount()
          Returns the row count of the model.
 java.lang.Object getRowLabel(int row)
          Returns a row label for the given index.
 java.lang.Object[] getRowLabels(int startIndex, int count)
          Returns an array of row labels for the given index and count.
 java.lang.String[] getSortedColumns()
          Returns an array of strings that are the column names that have been sorted.
 int[] getSortedDirections()
          Returns an array of ints that indicate which direction each column in the sortedColumns array has been sorted.
 int getUncommittedRowNumber()
          Returns the uncommitted row number if one is present.
 java.lang.Object getValueAt(int aRow, int aColumn)
          Returns the value a the given row and column index.
 void insertUncommittedRow(int rowIndex)
          Inserts an uncommitted row into the model, the actual model does not receive notice that a row has been inserted.
 boolean isAccurateRowCountAvailable()
          Indicates whether an accurate row count is available.
 boolean isAutoResortEnabled()
          Returns true if the adapter will call a resort when it receives a TableModelEvent of any kind.
 boolean isCaseSensitive()
          Indicate if the comparison is case sensitive or not if the values being compared are both Strings.
 boolean isCellEditable(int row, int column)
          Returns whether the model set on this adapter has an editable cell at the given indices.
 boolean isColumnSortable(java.lang.String columnName)
          Returns a boolean indicating whether the columnName is allowed to be sorted.
 boolean isDefaultModelAttached()
          Returns whether the default model is attached, which in this case is a DefaultTableModel with no rows or columns.
 boolean isRowDeletionAllowed()
          Returns whether the model set on the adapter supports row deletion or not.
 boolean isRowInsertionAllowed()
          Returns whether rows are allowed to be inserted into the model or not.
 boolean isRowLabelsSupported()
          Returns true, row labels are supported.
 boolean isRowsLabelSupported()
          Returns true, row labels are supported.
 boolean isRowUpdateAllowed()
          Returns whether rows in the model set on this adapter are allowed to be updated or not.
 boolean isSortAllowed()
          Returns a boolean indicating whether sorting is allowed.
 boolean isStaticRowLabelOrder()
          Returns whether calls to getRowLabel or getRowLabels with return labels that reflect the sort order or whether they return labels that are in the default order.
 boolean isTableExtendOnly()
          Returns whether rows are only allowed to be appended to the model or not.
 boolean isTrueRowCountCalculated()
          Indicates whether the actual row count should be calculated.
 boolean isUncommittedRowPresent()
          Returns true if the adapter has an uncommitted row present, false otherwise.
protected  javax.swing.table.TableModel newDefaultModel()
          Create a new default model, which by default is a with no rows or columns.
 void reallocateIndexes()
          Refreshes the sorted indices back to their original order, this method gets called whenever the underlying model fires a TableModelEvent with the HEADER_ROW as the first row.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener from the adapter.
 void resort()
          Resorts the table using the last sorted columns and directions.
 void setAutoResortEnabled(boolean useAutoResort)
          Sets whether the table will automatically call a resort whenever this adapter receives any TableModelEvent.
 void setCaseSensitive(boolean caseSensitive)
          Set the case sensitivity of the comparisons made.
 void setColumnComparator(java.lang.String column, java.util.Comparator comparator)
          Sets the comparator on the given column.
 void setDefaultComparator(java.util.Comparator comparator)
          Sets the comparator that is used by default when sorting on a column occurs.
protected  void setDefaultModelAttached(boolean defaultModelUsed)
          Sets whether the default model is attached or not.
 void setModel(javax.swing.table.TableModel newModel)
          Sets the model on the adapter, if null, a DefaultTableModel will be used.
 void setSortAllowed(boolean allowSorting)
          Sets whether sorting is enabled or not, by default it is.
 void setStaticRowLabelOrder(boolean useStaticRowLabelOrder)
          Sets whether the row labels returned from calls to getRowLabel or getRowLabels will always return the same row index for a given row or whether the row index will reflect the new row position due to a sort.
 void setTrueRowCountCalculated(boolean trueRowCountCalculated)
          Sets whether the actual row count should be calculated.
 void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
          Sets the value for the given row and column on the model set on this adapter.
 void sort(java.lang.String[] columnNames, int[] direction)
          Each columnName must have a matching direction.
 void sortColumn(java.lang.String column)
          Sorts the given column ascending
 void sortColumn(java.lang.String column, int direction)
          Sorts the given column in the given direction.
 void sortColumns(java.lang.String[] columns, int[] directions)
          Sorts the columns in the the directions specified.
 void tableChanged(javax.swing.event.TableModelEvent e)
          Signals the adapter that the underlying TableModel has changed and that the adapter may need to update or refesh.
 

Field Detail

defaultModelAttached

protected boolean defaultModelAttached

indexes

protected int[] indexes

sortingColumns

protected java.lang.String[] sortingColumns

sortedColumns

protected java.lang.String[] sortedColumns

sortingDirections

protected int[] sortingDirections

sortedDirections

protected int[] sortedDirections

model

protected javax.swing.table.TableModel model

defaultComparator

protected java.util.Comparator defaultComparator

columnComparators

protected java.util.Map columnComparators

propertyChangeSupport

protected javax.swing.event.SwingPropertyChangeSupport propertyChangeSupport

sortAllowed

protected boolean sortAllowed

staticRowLabelOrder

protected boolean staticRowLabelOrder

autoResort

protected boolean autoResort

caseSensitive

protected boolean caseSensitive
Constructor Detail

SortableTableModelAdapter

public SortableTableModelAdapter()
Default Constructor, calls this(null).

See Also:
SortableTableModelAdapter(TableModel)

SortableTableModelAdapter

public SortableTableModelAdapter(javax.swing.table.TableModel model)
Constructs a SortableTableModelAdapter with the given model as the model to sort. If the model is null, a DefaultTableModel will be used as the model. The com.sas.util.GenericComparator.defaultInstance will be used as the default comparator for sorting the data.

Parameters:
model - the model whose data will be sorted. If the model is null, a DefaultTableModel will be used as the model.
See Also:
GenericComparator, DefaultTableModel
Method Detail

getModel

public javax.swing.table.TableModel getModel()
Returns the model that is being sorted, this method will never return null.

Returns:
the model being sorted
See Also:
setModel(TableModel)

setModel

public void setModel(javax.swing.table.TableModel newModel)
Sets the model on the adapter, if null, a DefaultTableModel will be used.

Parameters:
newModel - the new model for the adapter to sort
See Also:
getModel()

newDefaultModel

protected javax.swing.table.TableModel newDefaultModel()
Create a new default model, which by default is a with no rows or columns.

Returns:
a default model to use for the adapter if null is set as the model

isDefaultModelAttached

public boolean isDefaultModelAttached()
Returns whether the default model is attached, which in this case is a DefaultTableModel with no rows or columns.

Specified by:
isDefaultModelAttached in interface ViewDefaultModel
Returns:
true if a default model is being used, false otherwise
See Also:
setDefaultModelAttached(boolean)

setDefaultModelAttached

protected void setDefaultModelAttached(boolean defaultModelUsed)
Sets whether the default model is attached or not.

Parameters:
defaultModelUsed - true if a default model is attached, false otherwise
See Also:
isDefaultModelAttached()

getValueAt

public java.lang.Object getValueAt(int aRow,
                                   int aColumn)
Returns the value a the given row and column index. The model with use a row mapping to the correct value after a sort has been executed.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
aRow - the row index of the value to retrieve
aColumn - the column index of the value to retrieve
Returns:
the value for the given cell

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int aRow,
                       int aColumn)
Sets the value for the given row and column on the model set on this adapter. The model set on this adapter needs to support editing for this method to work.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
aValue - the value to set
aRow - the row index the value will get set on
aColumn - the column index the value will get set on

convertRowIndexToModel

public int convertRowIndexToModel(int viewIndex)
Returns the true model index for a given viewer row index. This method is a convience method for determing where a row was before any sorting took place. If the index is invalid, -1 will be returned.

Parameters:
viewIndex - the 0 based viewer index of the row

convertRowIndexToView

public int convertRowIndexToView(int modelIndex)
Returns the true 0 based viewer index for a given model row index. This method is a convience method for determing where a row is after being sorting. If the index is invalid, -1 will be returned.

Parameters:
modelIndex - the 0 based model index of the row
Returns:
the 0 based viewer index of where the row was sorted too

getRowCount

public int getRowCount()
Returns the row count of the model.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
the row count of the model set on the adapter

getColumnCount

public int getColumnCount()
Returns the column count of the model.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
the column count of the model set on the adapter

getColumnName

public java.lang.String getColumnName(int columnIndex)
Returns the column name for the given column index.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - a zero based column index
Returns:
the name of the given column, delegates to the model set on the adapter

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Returns the column class for the given column index.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - a zero based column index
Returns:
the class of the given column, delegates to the model set on the adapter

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns whether the model set on this adapter has an editable cell at the given indices.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - the zero based row index
column - the zero based column index
Returns:
whether the cell is editable or not

setDefaultComparator

public void setDefaultComparator(java.util.Comparator comparator)
Sets the comparator that is used by default when sorting on a column occurs. This comparator is used for any column that does not have a specific comparator set on it. By default, the comparator is an com.sas.util.GenericComparator.

Parameters:
comparator - the comparator to use for all columns on the model for which a specific comparator is not set on a column, the comparator is used for sorting
See Also:
getDefaultComparator()

getDefaultComparator

public java.util.Comparator getDefaultComparator()
Returns the comparator that is used by default when sorting on a column occurs. This comparator is used for any column that does not have a specific comparator set on it. By default, the comparator is an com.sas.util.GenericComparator.

Returns:
the default comparator for the adapter to use for sorting
See Also:
setDefaultComparator(Comparator)

getColumnComparator

public java.util.Comparator getColumnComparator(java.lang.String column)
Return the current comparator on the given column, which can be null and is null by default.

Parameters:
column - the name of the column whose comparator is to be returned
Returns:
the current comparator on the column

setColumnComparator

public void setColumnComparator(java.lang.String column,
                                java.util.Comparator comparator)
Sets the comparator on the given column. If the comparator is null, it removes the comparator for the column and teh default comparator will be used instead.

Parameters:
column - the name of the column to set the comparator on
comparator - comparator to be set on the column, null to remove the comparator

reallocateIndexes

public void reallocateIndexes()
Refreshes the sorted indices back to their original order, this method gets called whenever the underlying model fires a TableModelEvent with the HEADER_ROW as the first row.


tableChanged

public void tableChanged(javax.swing.event.TableModelEvent e)
Signals the adapter that the underlying TableModel has changed and that the adapter may need to update or refesh. Calls reallocateIndexes() if the TableModelEvent has a first row param of HEADER_ROW.

Specified by:
tableChanged in interface javax.swing.event.TableModelListener
Parameters:
e - the table model event

sortColumn

public void sortColumn(java.lang.String column)
Sorts the given column ascending

Parameters:
column - the name of the column to sort, will be sorted ascending

sortColumn

public void sortColumn(java.lang.String column,
                       int direction)
Sorts the given column in the given direction. The valid directions are ASCENDING, DESCENDING, or NONE.

Parameters:
column - the name of the column to sort
direction - the integer value that represents the direction the column will be sorted

sortColumns

public void sortColumns(java.lang.String[] columns,
                        int[] directions)
Sorts the columns in the the directions specified. The columns array must be the same length as teh directions array. The valid directions are ASCENDING, DESCENDING, or NONE.

Parameters:
columns - an array of strings that match up to column names in the model
directions - an array of ints that signal which direction to sort the corresponding column

sort

public void sort(java.lang.String[] columnNames,
                 int[] direction)
          throws com.sas.table.SortException
Each columnName must have a matching direction. If not, then an IllegalArgumentException will be thrown.

Specified by:
sort in interface com.sas.table.SortableInterface
Parameters:
columnNames - The names of the columns in the order that the columns will be sorted.
direction - The direction in which to sort the columns. Valid values are SortDirectionInterface.ASCENDING and SortDirectionInterface.DESCENDING.
Throws:
com.sas.table.SortException

getSortedColumns

public java.lang.String[] getSortedColumns()
Returns an array of strings that are the column names that have been sorted. The sortedColumns array is updated after each call to the sort method. The length of the array can be from 0 to the number of available columns. An array of length 0 means that no columns are currently sorted.

Specified by:
getSortedColumns in interface com.sas.table.SortableInterface
Returns:
An array of strings that are the column names on which the data is sorted.

getSortedDirections

public int[] getSortedDirections()
Returns an array of ints that indicate which direction each column in the sortedColumns array has been sorted. The array will be the same size of the sortedColumns array. The sortedDirections array is update after each call to the sort method.

Specified by:
getSortedDirections in interface com.sas.table.SortableInterface
Returns:
An array of ints that indicate which direction the sorted columns have been sorted. Valid values are ASCENDING or DESCENDING.

isColumnSortable

public boolean isColumnSortable(java.lang.String columnName)
Returns a boolean indicating whether the columnName is allowed to be sorted. The default is that all columns are allowed to be sorted.

Specified by:
isColumnSortable in interface com.sas.table.SortableInterface
Parameters:
columnName - The name of the column to query about whether it is allowed to be sorted.
Returns:
A boolean indicating whether the column is allowed to be sorted.

isSortAllowed

public boolean isSortAllowed()
Returns a boolean indicating whether sorting is allowed. Sorting is allowed by default.

Specified by:
isSortAllowed in interface com.sas.table.SortableInterface
Returns:
A boolean indicating whether sorting is allowed.
See Also:
setSortAllowed(boolean)

setSortAllowed

public void setSortAllowed(boolean allowSorting)
Sets whether sorting is enabled or not, by default it is.

Specified by:
setSortAllowed in interface com.sas.table.SortableInterface
Parameters:
allowSorting - true to enable sorting, false otherwise.
See Also:
isSortAllowed()

isCaseSensitive

public boolean isCaseSensitive()
Indicate if the comparison is case sensitive or not if the values being compared are both Strings. By default, this value is false.

Returns:
false if the comparison ignores case by comparing only the String.toLowerCase() version of strings.

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Set the case sensitivity of the comparisons made.

Parameters:
caseSensitive - if true, the comparator will honor the case of the strings; if false, comparisons are done on the toLowerCase() results.

insertUncommittedRow

public void insertUncommittedRow(int rowIndex)
                          throws com.sas.util.UncheckedException
Inserts an uncommitted row into the model, the actual model does not receive notice that a row has been inserted. The adapter keeps track of this row as it is not in the model. This row can then be committed or a the row insertion can be cancelled.

Specified by:
insertUncommittedRow in interface InsertRowInterface
Parameters:
rowIndex - the index to insert the uncommitted row at
Throws:
com.sas.util.UncheckedException

commitUncommittedRow

public void commitUncommittedRow()
                          throws com.sas.util.UncheckedException
If an uncommitted row is present, this will commit the row into the model. The model set on this adapter must implement the InsertRowInterface or be an instance of a javax.swing.DefaultTableModel.

Specified by:
commitUncommittedRow in interface InsertRowInterface
Throws:
com.sas.util.UncheckedException

cancelUncommittedRow

public void cancelUncommittedRow()
                          throws com.sas.util.UncheckedException
If an uncommited row is present, this will cancel the row insertion and remove the uncommitted row from the model.

Specified by:
cancelUncommittedRow in interface InsertRowInterface
Throws:
com.sas.util.UncheckedException

isUncommittedRowPresent

public boolean isUncommittedRowPresent()
Returns true if the adapter has an uncommitted row present, false otherwise. If there is an uncommitted row, it will need to be either committed or a call to cancelUncommittedRow will need to be made.

Specified by:
isUncommittedRowPresent in interface InsertRowInterface
Returns:
true is an uncommitted row is present in the adapter, false otherwise

getUncommittedRowNumber

public int getUncommittedRowNumber()
Returns the uncommitted row number if one is present.

Specified by:
getUncommittedRowNumber in interface InsertRowInterface
Returns:
the uncommitted row number if one is present

isRowInsertionAllowed

public boolean isRowInsertionAllowed()
Returns whether rows are allowed to be inserted into the model or not. The model set on this adapter must implement the InsertRowInterface or be an instance of a javax.swing.DefaultTableModel.

Specified by:
isRowInsertionAllowed in interface InsertRowInterface
Returns:
true if row insertion is allowed, false otherwise

isTableExtendOnly

public boolean isTableExtendOnly()
Returns whether rows are only allowed to be appended to the model or not. The model set on this adapter must implement the InsertRowInterface as all other model types will return false.

Specified by:
isTableExtendOnly in interface InsertRowInterface
Returns:
true if rows are only allowed to be appended, false otherwise

isRowUpdateAllowed

public boolean isRowUpdateAllowed()
Returns whether rows in the model set on this adapter are allowed to be updated or not.

Specified by:
isRowUpdateAllowed in interface UpdateRowInterface
Returns:
true if rows can be updated, false otherwise

deleteRow

public void deleteRow(int rowIndex)
Deletes the given row from the model. The model must implement the DeleteRowInterface and allow row deletion or be an instance of a .

Specified by:
deleteRow in interface DeleteRowInterface
Parameters:
rowIndex - the index of the row to delete from the model if deletion is supported

isRowDeletionAllowed

public boolean isRowDeletionAllowed()
Returns whether the model set on the adapter supports row deletion or not. The model must implement the DeleteRowInterface or be an instance of a to allow row deletion.

Specified by:
isRowDeletionAllowed in interface DeleteRowInterface
Returns:
true if row deletion is supported, false otherwise

isAccurateRowCountAvailable

public boolean isAccurateRowCountAvailable()
Description copied from interface: AccurateRowCountInterface
Indicates whether an accurate row count is available.

Specified by:
isAccurateRowCountAvailable in interface AccurateRowCountInterface
Returns:
true if an accurate row count is available, false otherwise.

isTrueRowCountCalculated

public boolean isTrueRowCountCalculated()
Description copied from interface: TrueRowCountCalculatedInterface
Indicates whether the actual row count should be calculated.

Specified by:
isTrueRowCountCalculated in interface TrueRowCountCalculatedInterface
Returns:
true if the actual row count should be calculated

setTrueRowCountCalculated

public void setTrueRowCountCalculated(boolean trueRowCountCalculated)
Description copied from interface: TrueRowCountCalculatedInterface
Sets whether the actual row count should be calculated.

Specified by:
setTrueRowCountCalculated in interface TrueRowCountCalculatedInterface
Parameters:
trueRowCountCalculated - true if the actual row count should be calculated

setStaticRowLabelOrder

public void setStaticRowLabelOrder(boolean useStaticRowLabelOrder)
Sets whether the row labels returned from calls to getRowLabel or getRowLabels will always return the same row index for a given row or whether the row index will reflect the new row position due to a sort. The default value is to return a row label that reflects the sort, so the value is false by defalt.

Parameters:
useStaticRowLabelOrder - true if the row labels will be constants, false if the row labels reflect the sort order
See Also:
isStaticRowLabelOrder()

isStaticRowLabelOrder

public boolean isStaticRowLabelOrder()
Returns whether calls to getRowLabel or getRowLabels with return labels that reflect the sort order or whether they return labels that are in the default order.

Returns:
true if the row labels will be constants, false if the row labels reflect the sort order
See Also:
setStaticRowLabelOrder(boolean)

setAutoResortEnabled

public void setAutoResortEnabled(boolean useAutoResort)
Sets whether the table will automatically call a resort whenever this adapter receives any TableModelEvent. By default, this alue is set to false.

Parameters:
useAutoResort - true if the adapter should resort its data whenever it receive a TableModelEvent, false otherwise
See Also:
isAutoResortEnabled()

isAutoResortEnabled

public boolean isAutoResortEnabled()
Returns true if the adapter will call a resort when it receives a TableModelEvent of any kind. By default, this will return false.

Returns:
true if a resort should occur whenever a TableModelEvent is received, false otherwise
See Also:
setAutoResortEnabled(boolean)

resort

public void resort()
Resorts the table using the last sorted columns and directions. The data may have changed that may be requrign this resort. Convienence method for the user to call to resort.


getRowLabel

public java.lang.Object getRowLabel(int row)
Returns a row label for the given index. The row label will reflect the sort order if the isStaticRowLabelOrder method returns false, otherwise it will return a row label that is in incremental order.

Specified by:
getRowLabel in interface com.sas.table.StaticRowLabelInterface
Parameters:
row - the index of th row label to return
Returns:
a row label for teh given row index

getRowLabels

public java.lang.Object[] getRowLabels(int startIndex,
                                       int count)
Returns an array of row labels for the given index and count. The row labels will reflect the sort order if the isStaticRowLabelOrder method returns false, otherwise it will return row labels that are in incremental order.

Specified by:
getRowLabels in interface com.sas.table.StaticRowLabelInterface
Parameters:
startIndex - the first row label to return in the array
count - the number of row labels to return
Returns:
an array of labels with a length of count

isRowLabelsSupported

public boolean isRowLabelsSupported()
Returns true, row labels are supported.

Specified by:
isRowLabelsSupported in interface com.sas.table.StaticRowLabelInterface
Returns:
always returns true

isRowsLabelSupported

public boolean isRowsLabelSupported()
Returns true, row labels are supported.

Specified by:
isRowsLabelSupported in interface com.sas.table.StaticRowLabelInterface
Returns:
always returns true

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the adapter.

Parameters:
listener - the PropertyChangeListener to be notified when a PropertyChangeEvent occurs

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the adapter.

Parameters:
listener - the PropertyChangeListener to stop being notified when a PropertyChangeEvent occurs

firePropertyChange

protected void firePropertyChange(java.beans.PropertyChangeEvent evt)
Send a PropertyChangeEvent to any listeners added to the adapter.


firePropertyChange

protected void firePropertyChange(java.lang.String propName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Send a PropertyChangeEvent to any listeners added to the adapter.




Copyright © 2009 SAS Institute Inc. All Rights Reserved.