Package com.illumon.iris.gui.widget
Class FreezeColumnsManagerImpl
java.lang.Object
com.illumon.iris.gui.widget.FreezeColumnsManagerImpl
- All Implemented Interfaces:
FreezeColumnsManager
Allows the user to "Freeze Columns". This takes a normal column and moves it to the left side of the table so that it
is always visible. This effect is done by maintaining two Tables with the same Table Model and moving columns between
them.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFreezeColumnsManagerImpl(com.fishlib.io.logger.Logger log, GuiTable mainTable, JScrollPane scrollPane, Function<IrisTableModel, GuiTable> createTableFunction) Creates a new FreezeColumnsManager.FreezeColumnsManagerImpl(com.fishlib.io.logger.Logger log, GuiTable mainTable, JScrollPane scrollPane, Function<IrisTableModel, GuiTable> createTableFunction, Runnable refresh) Creates a new FreezeColumnsManager. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidClears any current freeze columns that are not locked.voidclose()Close our changeListener(s)intconvertColumnIndexToModel(int viewColumnIndex) Converts a view column index to a model column index taking into account both the freeze table and main table.voidfreezeColumn(String columnName) Freezes a column.voidfreezeColumn(TableColumn column) Freezes a column.booleanIndicates if freeze columns are supported.getColumnName(int column) Gets the column name at view column position taking into account both the freeze table and the main table.Gets a list of the columns that are frozen.Gets the freeze table.Gets the freeze columns as a set.Gets all the hidden columns taking into account both the freeze table and the main table.Gets the main table.Gets the normal (unfrozen) columns as a set.int[]Gets the selected columns taking into account both the freeze table and the main table.intGets the total column count for both the freeze table and the main table.Gets all the visible columns taking into account both the freeze table and the main table.voidHides all columns in both the freeze table and main table.voidHides the freeze table.booleanisFreezeTable(GuiTable table) Indicates if a table is the freeze table.booleanIndicates if the freeze columns have been altered since the table was first created (e.g.booleanmayHideOrFreezeColumn(TableColumn tableColumn) Identifies if a specific column is eligible for hiding/freezing.protected voidHandles when the model of the main table changes.voidrepaint()Requests the freeze table to repaint.voidsetFreezeColumns(Collection<String> columns) Clears any previous freeze columns and sets them to the columns in a list.voidsetModified(boolean modified) Marks if the freeze columns have been modified.voidshowColumn(TableColumn tableColumn) Shows a column in the correct table (freeze table or main table)voidShows the freeze table.voidunfreezeColumn(String columnName) Unfreezes a column.voidunfreezeColumn(TableColumn column) Unfreezes a column.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.gui.widget.FreezeColumnsManager
getOtherColumnSet
-
Field Details
-
mainTable
-
freezeTable
-
-
Constructor Details
-
FreezeColumnsManagerImpl
public FreezeColumnsManagerImpl(com.fishlib.io.logger.Logger log, GuiTable mainTable, JScrollPane scrollPane, Function<IrisTableModel, GuiTable> createTableFunction, Runnable refresh) Creates a new FreezeColumnsManager.- Parameters:
log- the loggermainTable- the main table that displays normal columnsscrollPane- the scroll pane containing the main tablecreateTableFunction- a callback to create a second GuiTable backed the model of the firstrefresh- a callback to run any special code required to refresh the freeze table
-
FreezeColumnsManagerImpl
public FreezeColumnsManagerImpl(com.fishlib.io.logger.Logger log, GuiTable mainTable, JScrollPane scrollPane, Function<IrisTableModel, GuiTable> createTableFunction) Creates a new FreezeColumnsManager.- Parameters:
log- the loggermainTable- the main table that displays normal columnsscrollPane- the scroll pane containing the main tablecreateTableFunction- a callback to create a second GuiTable backed the model of the first
-
-
Method Details
-
freezeColumnsSupported
public boolean freezeColumnsSupported()Description copied from interface:FreezeColumnsManagerIndicates if freeze columns are supported.- Specified by:
freezeColumnsSupportedin interfaceFreezeColumnsManager- Returns:
- true if freeze columns are supported, false otherwise
-
getFreezeColumns
Description copied from interface:FreezeColumnsManagerGets a list of the columns that are frozen.- Specified by:
getFreezeColumnsin interfaceFreezeColumnsManager- Returns:
- a list of freeze columns
-
getFrozenColumnSet
Description copied from interface:FreezeColumnsManagerGets the freeze columns as a set.- Specified by:
getFrozenColumnSetin interfaceFreezeColumnsManager- Returns:
- the freeze columns
-
getNormalColumnSet
Description copied from interface:FreezeColumnsManagerGets the normal (unfrozen) columns as a set.- Specified by:
getNormalColumnSetin interfaceFreezeColumnsManager- Returns:
- the normal columns
-
setFreezeColumns
Description copied from interface:FreezeColumnsManagerClears any previous freeze columns and sets them to the columns in a list.- Specified by:
setFreezeColumnsin interfaceFreezeColumnsManager- Parameters:
columns- the list of columns to freeze
-
clearFreezeColumns
protected void clearFreezeColumns()Clears any current freeze columns that are not locked. -
getMainTable
Description copied from interface:FreezeColumnsManagerGets the main table. This is useful for when we should operate on the main table, but the user clicks on the freeze table.- Specified by:
getMainTablein interfaceFreezeColumnsManager- Returns:
- the main table
-
getFreezeTable
Description copied from interface:FreezeColumnsManagerGets the freeze table.- Specified by:
getFreezeTablein interfaceFreezeColumnsManager- Returns:
- the freeze table, null if freezing is not supported or no columns have been frozen
-
hideFreezeTable
public void hideFreezeTable()Description copied from interface:FreezeColumnsManagerHides the freeze table.- Specified by:
hideFreezeTablein interfaceFreezeColumnsManager
-
showFreezeTable
public void showFreezeTable()Description copied from interface:FreezeColumnsManagerShows the freeze table.- Specified by:
showFreezeTablein interfaceFreezeColumnsManager
-
isFreezeTable
Description copied from interface:FreezeColumnsManagerIndicates if a table is the freeze table.- Specified by:
isFreezeTablein interfaceFreezeColumnsManager- Parameters:
table- the table to check- Returns:
- true if it is the freeze table, false otherwise
-
freezeColumn
Description copied from interface:FreezeColumnsManagerFreezes a column.- Specified by:
freezeColumnin interfaceFreezeColumnsManager- Parameters:
columnName- the column to freeze
-
unfreezeColumn
Description copied from interface:FreezeColumnsManagerUnfreezes a column.- Specified by:
unfreezeColumnin interfaceFreezeColumnsManager- Parameters:
columnName- the column to unfreeze
-
freezeColumn
Description copied from interface:FreezeColumnsManagerFreezes a column.- Specified by:
freezeColumnin interfaceFreezeColumnsManager- Parameters:
column- the column to freeze
-
unfreezeColumn
Description copied from interface:FreezeColumnsManagerUnfreezes a column.- Specified by:
unfreezeColumnin interfaceFreezeColumnsManager- Parameters:
column- the column to unfreeze
-
repaint
public void repaint()Description copied from interface:FreezeColumnsManagerRequests the freeze table to repaint.- Specified by:
repaintin interfaceFreezeColumnsManager
-
isModified
public boolean isModified()Description copied from interface:FreezeColumnsManagerIndicates if the freeze columns have been altered since the table was first created (e.g. the freeze columns are different than what was specified in the layout hints)- Specified by:
isModifiedin interfaceFreezeColumnsManager- Returns:
- true if the columns have been modified, false otherwise
-
setModified
public void setModified(boolean modified) Description copied from interface:FreezeColumnsManagerMarks if the freeze columns have been modified.- Specified by:
setModifiedin interfaceFreezeColumnsManager- Parameters:
modified- true if they have been modified, false otherwise
-
getTotalColumnCount
public int getTotalColumnCount()Description copied from interface:FreezeColumnsManagerGets the total column count for both the freeze table and the main table.- Specified by:
getTotalColumnCountin interfaceFreezeColumnsManager- Returns:
- the total column count
-
getSelectedColumns
public int[] getSelectedColumns()Description copied from interface:FreezeColumnsManagerGets the selected columns taking into account both the freeze table and the main table.- Specified by:
getSelectedColumnsin interfaceFreezeColumnsManager- Returns:
- the selected columns
-
convertColumnIndexToModel
public int convertColumnIndexToModel(int viewColumnIndex) Description copied from interface:FreezeColumnsManagerConverts a view column index to a model column index taking into account both the freeze table and main table. Specifically, the input index for this method is one that is treating the two tables as one big table.- Specified by:
convertColumnIndexToModelin interfaceFreezeColumnsManager- Parameters:
viewColumnIndex- the view column index- Returns:
- the model column index
-
getColumnName
Description copied from interface:FreezeColumnsManagerGets the column name at view column position taking into account both the freeze table and the main table.- Specified by:
getColumnNamein interfaceFreezeColumnsManager- Parameters:
column- the view column index- Returns:
- the column name
-
getHiddenColumns
Description copied from interface:FreezeColumnsManagerGets all the hidden columns taking into account both the freeze table and the main table.- Specified by:
getHiddenColumnsin interfaceFreezeColumnsManager- Returns:
- a collection of hidden columns
-
getVisibleColumns
Description copied from interface:FreezeColumnsManagerGets all the visible columns taking into account both the freeze table and the main table.- Specified by:
getVisibleColumnsin interfaceFreezeColumnsManager- Returns:
- a collection of visible columns
-
hideAllColumns
public void hideAllColumns()Description copied from interface:FreezeColumnsManagerHides all columns in both the freeze table and main table.- Specified by:
hideAllColumnsin interfaceFreezeColumnsManager
-
showColumn
Description copied from interface:FreezeColumnsManagerShows a column in the correct table (freeze table or main table)- Specified by:
showColumnin interfaceFreezeColumnsManager- Parameters:
tableColumn- the column to show
-
mayHideOrFreezeColumn
Description copied from interface:FreezeColumnsManagerIdentifies if a specific column is eligible for hiding/freezing. We must not hide/freeze the final column in our mainTable, or we will have scrolling and viewport issues- Specified by:
mayHideOrFreezeColumnin interfaceFreezeColumnsManager- Parameters:
tableColumn- a column within our table- Returns:
- true if the column may be hidden or frozen, else false
-
close
public void close()Close our changeListener(s)- Specified by:
closein interfaceFreezeColumnsManager
-
onModelChanged
protected void onModelChanged()Handles when the model of the main table changes.
-