Packageorg.aswing.table
Interfacepublic interface TableColumnModel
ImplementorsDefaultTableColumnModel, JTable, JTableHeader

Defines the requirements for a table column model object suitable for use with JTable.



Public Methods
 MethodDefined by
  
addColumn(aColumn:TableColumn):void
Appends aColumn to the end of the tableColumns array.
TableColumnModel
  
Adds a listener for table column model events.
TableColumnModel
  
getColumn(columnIndex:int):TableColumn
Returns the TableColumn object for the column at columnIndex.
TableColumnModel
  
Returns the number of columns in the model.
TableColumnModel
  
getColumnIndex(columnIdentifier:Object):int
Returns the index of the first column in the table whose identifier is equal to identifier, when compared using equals.
TableColumnModel
  
getColumnIndexAtX(xPosition:int):int
Returns the index of the column that lies on the horizontal point, xPosition; or -1 if it lies outside the any of the column's bounds.
TableColumnModel
  
Returns the width between the cells in each column.
TableColumnModel
  
getColumns():Array
Returns an Array of all the columns in the model.
TableColumnModel
  
Returns true if columns may be selected.
TableColumnModel
  
Returns the number of selected columns.
TableColumnModel
  
Returns an array of indicies of all selected columns.
TableColumnModel
  
Returns the current selection model.
TableColumnModel
  
Returns the total width of all the columns.
TableColumnModel
  
moveColumn(columnIndex:int, newIndex:int):void
Moves the column and its header at columnIndex to newIndex.
TableColumnModel
  
Deletes the TableColumn column from the tableColumns array.
TableColumnModel
  
Removes a listener for table column model events.
TableColumnModel
  
setColumnMargin(newMargin:int):void
Sets the TableColumn's column margin to newMargin.
TableColumnModel
  
setColumnSelectionAllowed(flag:Boolean):void
Sets whether the columns in this model may be selected.
TableColumnModel
  
Sets the selection model.
TableColumnModel
Method detail
addColumn()method
public function addColumn(aColumn:TableColumn):void

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

Parameters
aColumn:TableColumn — aColumn the TableColumn to be added

See also

addColumnModelListener()method 
public function addColumnModelListener(x:TableColumnModelListener):void

Adds a listener for table column model events.

Parameters
x:TableColumnModelListener — a TableColumnModelListener object
getColumn()method 
public function getColumn(columnIndex:int):TableColumn

Returns the TableColumn object for the column at columnIndex.

Parameters
columnIndex:int — columnIndex the index of the desired column

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

Returns the number of columns in the model.

Returns
int — the number of columns in the model
getColumnIndex()method 
public function getColumnIndex(columnIdentifier:Object):int

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

Parameters
columnIdentifier:Object — columnIdentifier the identifier object

Returns
int — the index of the first table column whose identifier is equal to identifier

See also

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

Returns the index of the column that lies on the horizontal point, xPosition; or -1 if it lies outside the any of the column's bounds. 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
xPosition:int

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

See also

javax.swing.JTable.columnAtPoint
getColumnMargin()method 
public function getColumnMargin():int

Returns the width between the cells in each column.

Returns
int — the margin, in pixels, between the cells
getColumns()method 
public function getColumns():Array

Returns an Array of all the columns in the model.

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

Returns true if columns may be selected.

Returns
Boolean — true if columns may be selected

See also

getSelectedColumnCount()method 
public function getSelectedColumnCount():int

Returns the number of selected columns.

Returns
int — the number of selected columns; or 0 if no columns are selected
getSelectedColumns()method 
public function getSelectedColumns():Array

Returns an array of indicies of all selected columns.

Returns
Array — an array of integers containing the indicies of all selected columns; or an empty array if nothing is selected
getSelectionModel()method 
public function getSelectionModel():ListSelectionModel

Returns the current selection model.

Returns
ListSelectionModel — a ListSelectionModel object

See also

getTotalColumnWidth()method 
public function getTotalColumnWidth():int

Returns the total width of all the columns.

Returns
int — the total computed width of all columns
moveColumn()method 
public function moveColumn(columnIndex:int, newIndex:int):void

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 posts a columnMoved event to its listeners.

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

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 posts a columnRemoved event to its listeners.

Parameters
column:TableColumn — column the TableColumn to be removed

See also

removeColumnModelListener()method 
public function removeColumnModelListener(x:TableColumnModelListener):void

Removes a listener for table column model events.

Parameters
x:TableColumnModelListener — a TableColumnModelListener object
setColumnMargin()method 
public function setColumnMargin(newMargin:int):void

Sets the TableColumn's column margin to newMargin. This method posts a columnMarginChanged event to its listeners.

Parameters
newMargin:int — newMargin the width, in pixels, of the new column margins

See also

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

Sets whether the columns in this model may be selected.

Parameters
flag:Boolean — true if columns may be selected; otherwise false

See also

setSelectionModel()method 
public function setSelectionModel(newModel:ListSelectionModel):void

Sets the selection model.

Parameters
newModel:ListSelectionModel — a ListSelectionModel object

See also