Class VFXTableHelper.FixedTableHelper<T>

All Implemented Interfaces:
VFXContainerHelper<T, VFXTable<T>>, VFXTableHelper<T>
Enclosing interface:
VFXTableHelper<T>

public static class VFXTableHelper.FixedTableHelper<T> extends VFXTableHelper.AbstractHelper<T>
Concrete implementation of VFXTableHelper.AbstractHelper for ColumnsLayoutMode.FIXED. Here the range of rows and columns to display, as well as the viewport position, the virtual max x and y properties are defined as follows:

- the columns range is given by the firstColumn() element minus the buffer size VFXTable.columnsBufferSizeProperty(), (cannot be negative) and the sum between this start index and the total number of needed columns given by totalColumns(). It may happen that the number of indexes given by the range end - start + 1 is lesser than the total number of columns we need. In such cases, the range start is corrected to be end - needed + 1. A typical situation for this is when the table's horizontal position reaches the max scroll. If the table's width is 0 or the number of needed columns is 0, then the range will be Utils.INVALID_RANGE. The computation has the following dependencies: the columns' list, the table width, the horizontal position, the columns buffer size and the columns' size.

- the rows range is given by the VFXTableHelper.AbstractHelper.firstRow() element minus the buffer size VFXTable.rowsBufferSizeProperty(), (cannot be negative) and the sum between this start index and the total number of needed rows given by VFXTableHelper.AbstractHelper.totalRows(). It may happen that the number of indexes given by the range end - start + 1 is lesser than the number of rows we need. In such cases, the range start is corrected to be end - needed + 1. A typical situation for this is when the table's vertical position reaches the max scroll. If the viewport's height is 0 or the number of needed rows is 0, then the range will be Utils.INVALID_RANGE. The computation has the following dependencies: the table's height, the column's size (because it also specifies the header height, which influences the viewport's height), the vertical position, the rows buffer size, the rows' height and the items' list size.

- the viewport's position, a computation that is at the core of virtual scrolling. The viewport, which contains the columns and the cells (even though the table's viewport is a bit more complex), is not supposed to scroll by insane numbers of pixels both for performance reasons and because it is not necessary. For both the horizontal and vertical positions, we use the same technique, just using the appropriate values according to the axis we are working on. First we get the range of rows/columns to display, then their respective sizes (rows' height, columns' width). We compute the ranges to the first visible row/column, which are given by IntegerRange.of(range.getMin(), first()), in other words we limit the 'complete' ranges to the start buffer including the first row/column after the buffer. The number of indexes in the newfound ranges (given by IntegerRange.diff()) is multiplied by the respective sizes, this way we are finding the number of pixels to the first visible row/column, pixelsToFirst. At this point, we are missing only one last piece of information: how much of the first row/column do we actually see? We call this amount visibleAmountFirst and it's given by pos % size. Finally, the viewport's position is given by this formula -(pixelsToFirst + visibleAmountFirst) (for both hPos and vPos of course). If a range is equal to Utils.INVALID_RANGE, the respective position will be 0! While it's true that the calculations are more complex and 'needy', it's important to note that this approach allows avoiding 'hacks' to correctly lay out the cells in the viewport. No need for special offsets at the top or bottom anymore. The viewport's position computation has the following dependencies: the vertical and horizontal positions, the rows' height and the columns' size.

- the virtual max x and y properties, which give the total number of pixels on the x-axis and y-axis. Virtual means that it's not the actual size of the container, rather the size it would have if it was not virtualized. The two values are given by the number of rows/columns multiplied by the respective size (rows' height, columns' width). Notes: 1) the virtualMaxX is the maximum between the aforementioned computation and the table's width (because the last column must always take all the available space). 2) the virtualMaxY is going to be 0 if there are no columns in the table. The computations have the following dependencies: the table's width, the number of columns and items, the columns' size, the rows' height.