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, valueChanged
public 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 TableColumnModel
setColumnMargin
in class DefaultTableColumnModel
newMargin
- The new margin width in pixels.getColumnMargin()
,
getTotalColumnWidth()
public int getColumnMargin()
TableColumn
.
The default columnMargin
is 1.getColumnMargin
in interface TableColumnModel
getColumnMargin
in class DefaultTableColumnModel
TableColumn
.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 TableColumnModel
addColumn
in class DefaultTableColumnModel
aColumn
- 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 TableColumnModel
removeColumn
in class DefaultTableColumnModel
column
- The TableColumn
to be removed.addColumn(javax.swing.table.TableColumn)
public void removeColumn(int modelIndex)
IlpAbstractTableColumnModel
modelIndex
removeColumn
in interface IlpAbstractTableColumnModel
modelIndex
- 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 TableColumnModel
moveColumn
in class DefaultTableColumnModel
columnIndex
- 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 TableColumnModel
getColumnCount
in class DefaultTableColumnModel
TableColumn
objects in this column model.public Enumeration<TableColumn> getColumns()
Enumeration
of all the columns in the model.getColumns
in interface TableColumnModel
getColumns
in class DefaultTableColumnModel
Enumeration
of the columns in the model.public TableColumn getColumn(int columnIndex)
TableColumn
at index columnIndex
.getColumn
in interface TableColumnModel
getColumn
in class DefaultTableColumnModel
TableColumn
at the given index.public int getColumnIndex(Object columnIdentifier)
identifier
, when compared using equals
.getColumnIndex
in interface TableColumnModel
getColumnIndex
in class DefaultTableColumnModel
columnIdentifier
- 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 TableColumnModel
getColumnIndexAtX
in class DefaultTableColumnModel
xPosition
- The horizontal location of interest.public int getTotalColumnWidth()
getTotalColumnWidth
in interface TableColumnModel
getTotalColumnWidth
in class DefaultTableColumnModel
public void setColumnIndex(IlpAttribute attribute, int index)
IlpAbstractTableColumnModel
setColumnIndex
in interface IlpAbstractTableColumnModel
attribute
- The attribute corresponding to the column which has to
be moved.index
- The new index for the column.public int getColumnIndex(IlpAttribute attribute)
IlpAbstractTableColumnModel
getColumnIndex
in interface IlpAbstractTableColumnModel
attribute
- 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()
IlpAbstractTableColumnModel
removeAllColumns
in interface IlpAbstractTableColumnModel
public void addNewColumn(int modelIndex, Object headerValue)
IlpAbstractTableColumnModel
addNewColumn
in interface IlpAbstractTableColumnModel
public void setColumnPreferredWidth(IlpAttribute attribute, int columnWidth)
IlpAbstractTableColumnModel
setColumnPreferredWidth
in interface IlpAbstractTableColumnModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.