Package com.illumon.iris.gui.table
Class HiddenColumnModel
java.lang.Object
javax.swing.table.DefaultTableColumnModel
com.illumon.iris.gui.table.HiddenColumnModel
- All Implemented Interfaces:
PropertyChangeListener,Serializable,EventListener,ListSelectionListener,TableColumnModel
A
TableColumnModel which allows columns to be hidden and unhidden.- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.DefaultTableColumnModel
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(@NotNull TableColumn column) Add the specified column to the table.voidaddColumn(@NotNull TableColumn column, int index) Add the specified column to the table at the specified index.@Nullable TableColumnGet the specified column by name.Object[][]Get an array of column data in the format: name, abbreviation@NotNull List<TableColumn>Get a list of the hidden columns.static @Nullable StringgetName(@NotNull TableColumn column) Get the name of the specified TableColumn, or null if it couldn't be determined.voidHide all of the columns.voidhideColumn(int index) Hide the column at the specified index.voidhideColumn(@NotNull TableColumn column) Hide the specified column.booleanCheck if users are allowed to set column abbreviationsbooleanisHiddenColumn(@NotNull String columnName) Check if the specified column is hidden.booleanisHiddenColumn(@NotNull TableColumn tableColumn) Check if the specified column is hidden.booleanisLocked(@NotNull TableColumn column) Check if the specified column is 'locked'voidlockColumn(@NotNull String column) Mark the specified column as 'locked'.voidmoveColumn(int columnIndex, int newIndex) voidsetColumnRename(@NotNull String columnName, @Nullable String rename) Set the column header name.voidsetIsEditable(boolean isEditable) Set if users are allowed to set column abbreviations.voidshowColumn(@NotNull String name) Show the specified column.voidshowColumn(@NotNull TableColumn column) Show the specified column.voidUnlock all locked columns.voidunlockColumn(@NotNull String column) Unlock the specified column.Methods inherited from class javax.swing.table.DefaultTableColumnModel
addColumnModelListener, createSelectionModel, fireColumnAdded, fireColumnMarginChanged, fireColumnMoved, fireColumnRemoved, fireColumnSelectionChanged, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnModelListeners, getColumns, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, propertyChange, recalcWidthCache, removeColumn, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel, valueChanged
-
Constructor Details
-
HiddenColumnModel
public HiddenColumnModel() -
HiddenColumnModel
public HiddenColumnModel(boolean isEditable)
-
-
Method Details
-
isEditable
public boolean isEditable()Check if users are allowed to set column abbreviations- Returns:
- true if users are allowed ot set column abbreviations
-
setIsEditable
public void setIsEditable(boolean isEditable) Set if users are allowed to set column abbreviations.- Parameters:
isEditable- if users are allowed to set column abbreviations
-
hideColumn
public void hideColumn(int index) Hide the column at the specified index.- Parameters:
index- the column to hide
-
hideColumn
Hide the specified column.- Parameters:
column- the column to hide.
-
isHiddenColumn
Check if the specified column is hidden.- Parameters:
tableColumn- the column- Returns:
- true if the column was hidden
-
isHiddenColumn
Check if the specified column is hidden.- Parameters:
columnName- the column- Returns:
- true if the column was hidden
-
showColumn
Show the specified column.- Parameters:
column- the column to show
-
showColumn
Show the specified column.- Parameters:
name- the column name to show
-
hideAllColumns
public void hideAllColumns()Hide all of the columns. -
getHiddenColumns
Get a list of the hidden columns.- Returns:
- a list of hidden columns
- ImplNote:
- Users must not modify the returned value.
-
getColumn
Get the specified column by name.- Parameters:
name- the column name- Returns:
- the column or null if not found.
-
addColumn
Add the specified column to the table. The identifier must be an instance of aWColumn- Specified by:
addColumnin interfaceTableColumnModel- Overrides:
addColumnin classDefaultTableColumnModel- Parameters:
column- the column to add- ImplNote:
- This will not add columns with a
hidden attribute
-
addColumn
Add the specified column to the table at the specified index.- Parameters:
column- the column to insertindex- the index to insert at- ImplNote:
- This will not add columns with a
hidden attribute
-
setColumnRename
Set the column header name. A rename value of 'null' will reset to it's original value.- Parameters:
columnName- the column to set the header namerename- the header name to set.
-
getColumnNameData
Get an array of column data in the format: name, abbreviation -
lockColumn
Mark the specified column as 'locked'. a 'locked' column will not be moved upon amoveColumn(int, int).- Parameters:
column- the column to lock
-
unlockColumn
Unlock the specified column.- Parameters:
column- the coluimn to unlock.
-
isLocked
Check if the specified column is 'locked'- Parameters:
column- the column- Returns:
- true if the column was locked.
-
moveColumn
public void moveColumn(int columnIndex, int newIndex) - Specified by:
moveColumnin interfaceTableColumnModel- Overrides:
moveColumnin classDefaultTableColumnModel
-
unlockAllColumns
public void unlockAllColumns()Unlock all locked columns. -
getName
Get the name of the specified TableColumn, or null if it couldn't be determined.- Parameters:
column- The column- Returns:
- the name, or null.
-