Packageorg.aswing.table
Classpublic class DefaultTableColumnModel
ImplementsTableColumnModel

The standard column-handler for a JTable.



Public Methods
 MethodDefined by
  
Creates a default table column model.
DefaultTableColumnModel
  
addColumn(aColumn:TableColumn):void
Appends aColumn to the end of the tableColumns array.
DefaultTableColumnModel
  
DefaultTableColumnModel
  
getColumn(columnIndex:int):TableColumn
Returns the TableColumn object for the column at columnIndex.
DefaultTableColumnModel
  
Returns the number of columns in the tableColumns array.
DefaultTableColumnModel
  
getColumnIndex(identifier:Object):int
Returns the index of the first column in the tableColumns array whose identifier is equal to identifier, when compared using equals.
DefaultTableColumnModel
  
getColumnIndexAtX(x:int):int
Returns the index of the column that lies at position x, or -1 if no column covers this point.
DefaultTableColumnModel
  
Returns the width margin for TableColumn.
DefaultTableColumnModel
  
DefaultTableColumnModel
  
getColumns():Array
Returns an Array of all the columns in the model.
DefaultTableColumnModel
  
Returns true if column selection is allowed, otherwise false.
DefaultTableColumnModel
  
getListeners():Array
DefaultTableColumnModel
  
Returns the number of columns selected.
DefaultTableColumnModel
  
Returns an array of selected columns.
DefaultTableColumnModel
  
Returns the ListSelectionModel that is used to maintain column selection state.
DefaultTableColumnModel
  
Returns the total combined width of all columns.
DefaultTableColumnModel
  
moveColumn(columnIndex:int, newIndex:int):void
Moves the column and heading at columnIndex to newIndex.
DefaultTableColumnModel
  
Deletes the column from the tableColumns array.
DefaultTableColumnModel
  
DefaultTableColumnModel
  
setColumnMargin(newMargin:int):void
Sets the column margin to newMargin.
DefaultTableColumnModel
  
setColumnSelectionAllowed(flag:Boolean):void
Sets whether column selection is allowed.
DefaultTableColumnModel
  
Sets the selection model for this TableColumnModel to newModel and registers for listener notifications from the new selection model.
DefaultTableColumnModel
  
toString():String
DefaultTableColumnModel
Constructor detail
DefaultTableColumnModel()constructor
public function DefaultTableColumnModel()

Creates a default table column model.

Method detail
addColumn()method
public function addColumn(aColumn:TableColumn):void

Appends aColumn to the end of the tableColumns array. This method also posts the columnAdded event to its listeners.

Parameters
aColumn:TableColumn — the TableColumn to be added

See also

addColumnModelListener()method 
public function addColumnModelListener(x:TableColumnModelListener):voidParameters
x:TableColumnModelListener
getColumn()method 
public function getColumn(columnIndex:int):TableColumn

Returns the TableColumn object for the column at columnIndex.

Parameters
columnIndex:int — the index of the column desired

Returns
TableColumn — the TableColumn object for the column at columnIndex
getColumnCount()method 
public function getColumnCount():int

Returns the number of columns in the tableColumns array.

Returns
int — the number of columns in the tableColumns array

See also

getColumnIndex()method 
public function getColumnIndex(identifier:Object):int

Returns the index of the first column in the tableColumns array whose identifier is equal to identifier, when compared using equals.

Parameters
identifier:Object — the identifier object

Returns
int — the index of the first column in the tableColumns array whose identifier is equal to identifier

See also

getColumnIndexAtX()method 
public function getColumnIndexAtX(x:int):int

Returns the index of the column that lies at position x, or -1 if no column covers this point.

In keeping with Swing's separable model architecture, a TableColumnModel does not know how the table columns actually appear on screen. The visual presentation of the columns is the responsibility of the view/controller object using this model (typically JTable). The view/controller need not display the columns sequentially from left to right. For example, columns could be displayed from right to left to accomodate a locale preference or some columns might be hidden at the request of the user. Because the model does not know how the columns are laid out on screen, the given xPosition should not be considered to be a coordinate in 2D graphics space. Instead, it should be considered to be a width from the start of the first column in the model. If the column index for a given X coordinate in 2D space is required, JTable.columnAtPoint can be used instead. Parameters

x:int — the horizontal location of interest

Returns
int — the index of the column or -1 if no column is found

See also

getColumnMargin()method 
public function getColumnMargin():int

Returns the width margin for TableColumn. The default columnMargin is 1.

Returns
int — the maximum width for the TableColumn

See also

getColumnModelListeners()method 
public function getColumnModelListeners():Array

Returns
Array
getColumns()method 
public function getColumns():Array

Returns an Array of all the columns in the model.

Returns
Array — an Array of the columns in the model
getColumnSelectionAllowed()method 
public function getColumnSelectionAllowed():Boolean

Returns true if column selection is allowed, otherwise false. The default is false.

Returns
Boolean — the columnSelectionAllowed property
getListeners()method 
public function getListeners():Array

Returns
Array
getSelectedColumnCount()method 
public function getSelectedColumnCount():int

Returns the number of columns selected.

Returns
int — the number of columns selected
getSelectedColumns()method 
public function getSelectedColumns():Array

Returns an array of selected columns. If selectionModel is null, returns an empty array.

Returns
Array — an array of selected columns or an empty array if nothing is selected or the selectionModel is null
getSelectionModel()method 
public function getSelectionModel():ListSelectionModel

Returns the ListSelectionModel that is used to maintain column selection state.

Returns
ListSelectionModel — the object that provides column selection state. Or null if row selection is not allowed.

See also

getTotalColumnWidth()method 
public function getTotalColumnWidth():int

Returns the total combined width of all columns.

Returns
int — the totalColumnWidth property
moveColumn()method 
public function moveColumn(columnIndex:int, newIndex:int):void

Moves the column and heading 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.

Parameters
columnIndex:int — the index of column to be moved
 
newIndex:int — new index to move the column
removeColumn()method 
public function removeColumn(column:TableColumn):void

Deletes the column from the tableColumns array. This method will do nothing if column is not in the table's columns list. tile is called to resize both the header and table views. This method also posts a columnRemoved event to its listeners.

Parameters
column:TableColumn — the TableColumn to be removed

See also

removeColumnModelListener()method 
public function removeColumnModelListener(x:TableColumnModelListener):voidParameters
x:TableColumnModelListener
setColumnMargin()method 
public function setColumnMargin(newMargin:int):void

Sets the column margin to newMargin. This method also posts a columnMarginChanged event to its listeners.

Parameters
newMargin:int — the new margin width, in pixels

See also

setColumnSelectionAllowed()method 
public function setColumnSelectionAllowed(flag:Boolean):void

Sets whether column selection is allowed. The default is false.

Parameters
flag:Boolean — flag true if column selection will be allowed, false otherwise
setSelectionModel()method 
public function setSelectionModel(newModel:ListSelectionModel):void

Sets the selection model for this TableColumnModel to newModel and registers for listener notifications from the new selection model. If newModel is null, nothing will be changed.

Parameters
newModel:ListSelectionModel — the new selection model

See also

toString()method 
public function toString():String

Returns
String