Class ViewportHelper
java.lang.Object
com.illumon.iris.console.events.viewport.ViewportHelper
A helper class for maintaining and computing viewports for a
GuiTable
.-
Constructor Summary
ConstructorsConstructorDescriptionViewportHelper
(com.fishlib.io.logger.Logger log, int maxSpan) Create a viewportHelper. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addExtraColumns
(Set<String> existing) Add any extra columns required to the existing set.boolean
areColumnsInViewport
(BitSet columns) Check if the specified columns are all in the viewport.void
computeNewViewport
(boolean force, GuiTable table, List<String> columnNames) Compute a new viewport for the specifiedGuiTable
.Get the currently active set of columns as computed bycomputeNewViewport(boolean, GuiTable, List)
.int
Get the first row included in the viewport.int
Get the last Row included in the viewport.boolean
Return true if the set of columns have changed during the last invocation ofcomputeNewViewport(boolean, GuiTable, List)
.boolean
Return true if the set of rows has changed during the last invocation ofcomputeNewViewport(boolean, GuiTable, List)
.boolean
isRowInViewport
(int row) Check if the specified row is included in the current viewport.
-
Constructor Details
-
ViewportHelper
public ViewportHelper(com.fishlib.io.logger.Logger log, int maxSpan) Create a viewportHelper.- Parameters:
log
- a loggermaxSpan
- the maximum allowable viewport width in columns.
-
-
Method Details
-
computeNewViewport
public void computeNewViewport(boolean force, @NotNull GuiTable table, @NotNull List<String> columnNames) Compute a new viewport for the specifiedGuiTable
.- Parameters:
force
- force re-computation of both row and column dimensions.table
- the GuiTablecolumnNames
- the names of the columns
-
addExtraColumns
Add any extra columns required to the existing set.- Parameters:
existing
- the existing column set- ImplNote:
- The default implementation adds nothing else.
-
haveColumnsChanged
public boolean haveColumnsChanged()Return true if the set of columns have changed during the last invocation ofcomputeNewViewport(boolean, GuiTable, List)
.- Returns:
- true if the columns changed
-
haveRowsChanged
public boolean haveRowsChanged()Return true if the set of rows has changed during the last invocation ofcomputeNewViewport(boolean, GuiTable, List)
.- Returns:
- true if the rows have changed.
-
getActiveColumnSet
Get the currently active set of columns as computed bycomputeNewViewport(boolean, GuiTable, List)
. Users must not modify the return value of this method.- Returns:
- teh set of active columns
-
getFirstRow
public int getFirstRow()Get the first row included in the viewport.- Returns:
- the first row of the viewport
-
getLastRow
public int getLastRow()Get the last Row included in the viewport.- Returns:
- the last row in the viewport
-
isRowInViewport
public boolean isRowInViewport(int row) Check if the specified row is included in the current viewport.- Parameters:
row
- the row- Returns:
- true if the row is in the current viewport
-
areColumnsInViewport
Check if the specified columns are all in the viewport.- Parameters:
columns
- the columns to check- Returns:
- true if all of the provided columns are in the viewport, false otherwise.
-