public class IlpTableColumnModel extends DefaultTableColumnModel implements IlpAbstractTableColumnModel
IlpTableView.
The IlpTableColumnModel uses two submodels: one for fixed columns and one for
free columns. Each of these two models configures a JTable
inside the IlpTableView.changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth| Constructor and Description |
|---|
IlpTableColumnModel(TableColumnModel fixedColumnModel,
TableColumnModel freeColumnModel)
Creates a table column model from the column model that displays the fixed
columns and the column model that displays the free columns in an
IlpTableView. |
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(TableColumn aColumn)
Appends
aColumn to the end of the free columns. |
void |
addNewColumn(int modelIndex,
Object headerValue)
Adds a new column in the column model with the following index
and header value.
|
TableColumn |
getColumn(int columnIndex)
Returns the
TableColumn at index columnIndex. |
int |
getColumnCount()
Returns the number of
TableColumn objects in this column model. |
int |
getColumnIndex(IlpAttribute attribute)
Returns the column index of the specified attribute.
|
int |
getColumnIndex(Object columnIdentifier)
Returns the index of the first column whose identifier is equal to
identifier, when compared using equals. |
int |
getColumnIndexAtX(int xPosition)
Returns the index of the column at position
xPosition, or -1 if no column covers this point. |
int |
getColumnMargin()
Returns the margin width for
TableColumn. |
Enumeration<TableColumn> |
getColumns()
Returns an
Enumeration of all the columns in the model. |
int |
getFixedColumnCount()
Retrieves the number of fixed columns in the column model.
|
int |
getTotalColumnWidth()
Returns the total combined width of all columns.
|
boolean |
isColumnFixed(int columnIndex)
Returns whether the specified column is fixed.
|
boolean |
isColumnFixed(TableColumn aColumn)
Returns whether the specified column is fixed.
|
void |
moveColumn(int columnIndex,
int newIndex)
Moves the column and heading at
columnIndex to
newIndex. |
void |
removeAllColumns()
Removes the columns from the column model.
|
void |
removeColumn(int modelIndex)
Removes a column of index
modelIndex |
void |
removeColumn(TableColumn column)
Deletes the specified column from the
tableColumns array. |
void |
setColumnIndex(IlpAttribute attribute,
int index)
Moves the column of the specified attribute to the specified index.
|
void |
setColumnMargin(int newMargin)
Sets the column margin to
newMargin. |
void |
setColumnPreferredWidth(IlpAttribute attribute,
int columnWidth)
Sets the preferred width for the column defined by this attribute
|
void |
setFixedColumnCount(int nbColsToFix)
Sets the number of fixed columns in the model.
|
void |
setFixedColumnModel(TableColumnModel fixedColumnModel)
Sets the column model containing fixed columns.
|
void |
setFreeColumnModel(TableColumnModel freeColumnModel)
Sets the column model containing free columns.
|
addColumnModelListener, createSelectionModel, fireColumnAdded, fireColumnMarginChanged, fireColumnMoved, fireColumnRemoved, fireColumnSelectionChanged, getColumnModelListeners, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, propertyChange, recalcWidthCache, removeColumnModelListener, setColumnSelectionAllowed, setSelectionModel, valueChangedpublic IlpTableColumnModel(TableColumnModel fixedColumnModel, TableColumnModel freeColumnModel)
IlpTableView.fixedColumnModel - The column model used to display fixed columns
in an IlpTableView.freeColumnModel - The column model used to display free columns
in an IlpTableView.public void setFixedColumnModel(TableColumnModel fixedColumnModel)
fixedColumnModel - The fixed column model to use;
cannot be null.IllegalArgumentException - if the given column model is
null.public void setFreeColumnModel(TableColumnModel freeColumnModel)
freeColumnModel - The free column model to use;
cannot be null.IllegalArgumentException - if the given column model is
null.public void setColumnMargin(int newMargin)
newMargin. This method
also posts a columnMarginChanged event to its
listeners.setColumnMargin in interface TableColumnModelsetColumnMargin in class DefaultTableColumnModelnewMargin - The new margin width in pixels.getColumnMargin(),
getTotalColumnWidth()public int getColumnMargin()
TableColumn.
The default columnMargin is 1.getColumnMargin in interface TableColumnModelgetColumnMargin in class DefaultTableColumnModelTableColumn.setColumnMargin(int)public void setFixedColumnCount(int nbColsToFix)
nbColsToFix
is 0, none of the columns will be fixed. All the columns will be fixed
if nbColsToFix is greater than the number of columns.
A number of columns less than 0 has no effect.
Note: Calling this method does not fire any event with this column model as source.
nbColsToFix - The number of fixed columns in the table;
it may be 0.getFixedColumnCount()public int getFixedColumnCount()
setFixedColumnCount(int)public boolean isColumnFixed(int columnIndex)
false if the column index is out of bounds.columnIndex - The index of the column to check.true if the column specified by
columnIndex is a fixed one.public boolean isColumnFixed(TableColumn aColumn)
aColumn - The column to check.true if the column specified by
aColumn is a fixed one.public void addColumn(TableColumn aColumn)
aColumn to the end of the free columns.
This method also posts the columnAdded
event to its listeners.addColumn in interface TableColumnModeladdColumn in class DefaultTableColumnModelaColumn - The TableColumn to be added.IllegalArgumentException - if aColumn is
null.removeColumn(javax.swing.table.TableColumn)public void removeColumn(TableColumn column)
tableColumns array. This method will do nothing if
column is not in the list of the table's columns.
This method also posts a columnRemoved
event to its listeners.removeColumn in interface TableColumnModelremoveColumn in class DefaultTableColumnModelcolumn - The TableColumn to be removed.addColumn(javax.swing.table.TableColumn)public void removeColumn(int modelIndex)
IlpAbstractTableColumnModelmodelIndexremoveColumn in interface IlpAbstractTableColumnModelmodelIndex - index of the column to be removedpublic void moveColumn(int columnIndex,
int newIndex)
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.moveColumn in interface TableColumnModelmoveColumn in class DefaultTableColumnModelcolumnIndex - The index of the column to be moved.newIndex - New index to move the column to.IllegalArgumentException - if columnIndex or
newIndex is not in the valid range.public int getColumnCount()
TableColumn objects in this column model.getColumnCount in interface TableColumnModelgetColumnCount in class DefaultTableColumnModelTableColumn objects in this column model.public Enumeration<TableColumn> getColumns()
Enumeration of all the columns in the model.getColumns in interface TableColumnModelgetColumns in class DefaultTableColumnModelEnumeration of the columns in the model.public TableColumn getColumn(int columnIndex)
TableColumn at index columnIndex.getColumn in interface TableColumnModelgetColumn in class DefaultTableColumnModelTableColumn at the given index.public int getColumnIndex(Object columnIdentifier)
identifier, when compared using equals.getColumnIndex in interface TableColumnModelgetColumnIndex in class DefaultTableColumnModelcolumnIdentifier - The identifier object.columnIdentifier.IllegalArgumentException - if columnIdentifier
is null, or if no TableColumn has this
identifier.getColumn(int)public int getColumnIndexAtX(int xPosition)
xPosition, or -1 if no column covers this point.getColumnIndexAtX in interface TableColumnModelgetColumnIndexAtX in class DefaultTableColumnModelxPosition - The horizontal location of interest.public int getTotalColumnWidth()
getTotalColumnWidth in interface TableColumnModelgetTotalColumnWidth in class DefaultTableColumnModelpublic void setColumnIndex(IlpAttribute attribute, int index)
IlpAbstractTableColumnModelsetColumnIndex in interface IlpAbstractTableColumnModelattribute - The attribute corresponding to the column which has to
be moved.index - The new index for the column.public int getColumnIndex(IlpAttribute attribute)
IlpAbstractTableColumnModelgetColumnIndex in interface IlpAbstractTableColumnModelattribute - The attribute whose column index is to be returned.-1 if the given attribute does not correspond to a
visible column in the table view.public void removeAllColumns()
IlpAbstractTableColumnModelremoveAllColumns in interface IlpAbstractTableColumnModelpublic void addNewColumn(int modelIndex,
Object headerValue)
IlpAbstractTableColumnModeladdNewColumn in interface IlpAbstractTableColumnModelpublic void setColumnPreferredWidth(IlpAttribute attribute, int columnWidth)
IlpAbstractTableColumnModelsetColumnPreferredWidth in interface IlpAbstractTableColumnModel© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.