com.sas.servlet.tbeans.tableview
Class DefaultTableColumnModel

com.sas.servlet.tbeans.tableview.DefaultTableColumnModel
All Implemented Interfaces:
TableColumnModel

public class DefaultTableColumnModel
implements TableColumnModel

The standard column-handler for a TableView.


Constructor Summary
DefaultTableColumnModel()
          Creates a default table column model.
 
Method Summary
 void addColumn(TableColumn column)
          Appends a column to the end of the tableColumns array.
 void addColumnModelListener(TableColumnModelListener listener)
          Adds a listener for table column model events.
 TableColumn getColumn(int columnIndex)
          Returns the TableColumn object for the column at columnIndex.
 int getColumnCount()
          Returns the number of columns in the tableColumns array.
 int getColumnIndex(java.lang.Object columnIdentifier)
          Returns the index of the first column in the tableColumns array whose identifier is equal to columnIdentifier, when compared using equals.
 java.util.Enumeration getColumns()
          Returns an Enumeration of all the columns in the tableColumns array in the order they are to be displayed.
 java.util.Locale getLocale()
          Gets the locale.
 void moveColumn(int columnIndex, int newIndex)
          Moves the column and its header at columnIndex to newIndex.
 void removeColumn(TableColumn column)
          Deletes the TableColumn column from the tableColumns array.
 void removeColumnModelListener(TableColumnModelListener listener)
          Removes a listener for table column model events.
 void setColumnOrder(int[] columnIndexes)
          Set the order to display the columns that are currently in the tableColumns array.
 void setLocale(java.util.Locale loc)
          Sets the locale.
 

Constructor Detail

DefaultTableColumnModel

public DefaultTableColumnModel()
Creates a default table column model.

Method Detail

addColumn

public void addColumn(TableColumn column)
Appends a column to the end of the tableColumns array. This method also posts the columnAdded event to its listeners.

Specified by:
addColumn in interface TableColumnModel
Parameters:
column - the TableColumn to be added
Throws:
java.lang.IllegalArgumentException - if column is null
See Also:
removeColumn(com.sas.servlet.tbeans.tableview.TableColumn)

removeColumn

public void removeColumn(TableColumn column)
Deletes the TableColumn column from the tableColumns array. This method will do nothing if column is not in the table's column list. This method also posts a columnRemoved event to its listeners.

Specified by:
removeColumn in interface TableColumnModel
Parameters:
column - the TableColumn to be removed
See Also:
addColumn(com.sas.servlet.tbeans.tableview.TableColumn)

moveColumn

public void moveColumn(int columnIndex,
                       int newIndex)
Moves the column and its header at columnIndex to newIndex. The old column at columnIndex will now be found at newIndex. The column that used to be at newIndex is shifted left or right to make room. This will not move any columns if columnIndex equals newIndex. This method also posts a columnMoved event to its listeners.

Specified by:
moveColumn in interface TableColumnModel
Parameters:
columnIndex - the index of column to be moved
newIndex - index of the column's new location
Throws:
java.lang.IllegalArgumentException - if columnIndex or newIndex are not in the valid range

getColumnCount

public int getColumnCount()
Returns the number of columns in the tableColumns array.

Specified by:
getColumnCount in interface TableColumnModel
Returns:
the number of columns in the tableColumns array

getColumns

public java.util.Enumeration getColumns()
Returns an Enumeration of all the columns in the tableColumns array in the order they are to be displayed.

Specified by:
getColumns in interface TableColumnModel
Returns:
an Enumeration of all the columns in the tableColumns array in the order they are to be displayed

getColumnIndex

public int getColumnIndex(java.lang.Object columnIdentifier)
Returns the index of the first column in the tableColumns array whose identifier is equal to columnIdentifier, when compared using equals.

Specified by:
getColumnIndex in interface TableColumnModel
Parameters:
columnIdentifier - - the identifier object
Returns:
the index of the first column in the tableColumns array whose identifier is equal to columnIdentifier
Throws:
java.lang.IllegalArgumentException - if identifier is null, or no TableColumn has this identifier

getColumn

public TableColumn getColumn(int columnIndex)
Returns the TableColumn object for the column at columnIndex.

Specified by:
getColumn in interface TableColumnModel
Parameters:
columnIndex - the index of the desired column
Returns:
the TableColumn object for the column at columnIndex
Throws:
java.lang.IllegalArgumentException - if columnIndex is not in the columns array

setColumnOrder

public void setColumnOrder(int[] columnIndexes)
Set the order to display the columns that are currently in the tableColumns array. If a column index is not included in the columnIndexes array then that column is removed from the tableColumns array.

Specified by:
setColumnOrder in interface TableColumnModel
Parameters:
columnIndexes - the indexes of the columns in the order they are to be displayed
Throws:
java.lang.IllegalArgumentException - if the columnIndexes array is larger than the tableColumns array or if an index in the columnIndexes array does not exist in the tableColumns array

addColumnModelListener

public void addColumnModelListener(TableColumnModelListener listener)
Adds a listener for table column model events.

Specified by:
addColumnModelListener in interface TableColumnModel
Parameters:
listener - a TableColumnModelListener object

removeColumnModelListener

public void removeColumnModelListener(TableColumnModelListener listener)
Removes a listener for table column model events.

Specified by:
removeColumnModelListener in interface TableColumnModel
Parameters:
listener - a TableColumnModelListener object

setLocale

public void setLocale(java.util.Locale loc)
Sets the locale.

Specified by:
setLocale in interface TableColumnModel
Parameters:
loc - an instance of java.util.Locale

getLocale

public java.util.Locale getLocale()
Gets the locale.

Specified by:
getLocale in interface TableColumnModel
Returns:
an instance of java.util.Locale



Copyright © 2009 SAS Institute Inc. All Rights Reserved.