class org.aswing.table.DefaultTableColumnModel

The standard column-handler for a JTable.

Authors

  • paling

Instance Fields

function new(): Void

Creates a default table column model.

function addColumn(aColumn:TableColumn): Void

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

aColumn

the TableColumn to be added

See Also

function getColumn(columnIndex:Int): TableColumn

Returns the TableColumn object for the column at columnIndex.

columnIndex

the index of the column desired

returns

the TableColumn object for the column at columnIndex

function getColumnCount(): Int

Returns the number of columns in the tableColumns array.

returns

the number of columns in the tableColumns array

See Also

function getColumnIndex(identifier:Dynamic): Int

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

identifier

the identifier object

returns

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

See Also

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.

x

the horizontal location of interest

returns

the index of the column or -1 if no column is found

See Also

function getColumnMargin(): Int

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

returns

the maximum width for the TableColumn

See Also

function getColumnSelectionAllowed(): Bool

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

returns

the columnSelectionAllowed property

function getColumns(): Array<Dynamic>

Returns an Array of all the columns in the model.

returns

an Array of the columns in the model

function getSelectedColumnCount(): Int

Returns the number of columns selected.

returns

the number of columns selected

function getSelectedColumns(): Array<Dynamic>

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

returns

an array of selected columns or an empty array if nothing is selected or the selectionModel is null

function getSelectionModel(): ListSelectionModel

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

returns

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

See Also

function getTotalColumnWidth(): Int

Returns the total combined width of all columns.

returns

the totalColumnWidth property

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.

columnIndex

the index of column to be moved

newIndex

new index to move the column

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.

column

the TableColumn to be removed

See Also

function setColumnMargin(newMargin:Int): Void

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

newMargin

the new margin width, in pixels

See Also

function setColumnSelectionAllowed(flag:Bool): Void

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

flag

true if column selection will be allowed, false otherwise

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.

newModel

the new selection model

See Also

function toString(): String