Interface VFXGridHelper<T,C extends VFXCell<T>>
- All Superinterfaces:
VFXContainerHelper<T,VFXGrid<T, C>>
- All Known Implementing Classes:
VFXGridHelper.DefaultHelper
This interface is a utility API for
VFXGrid, despite computations not depending on other properties
(some VFXList values depend on the orientation, for example),
it's still a nice way to adhere to the encapsulation and separation of concerns principles.
Has one concrete implementation: VFXGridHelper.DefaultHelper.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classVFXGridHelper.DefaultHelper<T,C extends VFXCell<T>> Concrete implementation ofVFXGridHelper, 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:Nested classes/interfaces inherited from interface io.github.palexdev.virtualizedfx.base.VFXContainerHelper
VFXContainerHelper.VFXContainerHelperBase<T,C extends javafx.scene.layout.Region & VFXContainer<T>> -
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> Specifies the range of columns that should be present in the viewport.javafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> Specifies the range of rows that should be present in the viewport.Properties inherited from interface io.github.palexdev.virtualizedfx.base.VFXContainerHelper
maxHScroll, maxVScroll, viewportPosition, virtualMaxX, virtualMaxY -
Method Summary
Modifier and TypeMethodDescriptiondefault io.github.palexdev.mfxcore.base.beans.range.IntegerRangejavafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> Specifies the range of columns that should be present in the viewport.intintfirstRow()io.github.palexdev.mfxcore.base.beans.Sizedefault CindexToCell(int index) Converts the given index to a cell.default CitemToCell(T item) Converts the given item to a cell.intintlastRow()voidLays out the given cell.intintmaxRows()default io.github.palexdev.mfxcore.base.beans.range.IntegerRangejavafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> Specifies the range of rows that should be present in the viewport.default voidscrollToColumn(int column) Scrolls to the given column index by setting theVFXGrid.hPosProperty()tocolumnIndex * totalCellWidth.default voidscrollToRow(int row) Scrolls to the given row index by setting theVFXGrid.vPosProperty()torowIndex * totalCellHeight.default intintintdefault intintintMethods inherited from interface io.github.palexdev.virtualizedfx.base.VFXContainerHelper
dispose, getContainer, getMaxHScroll, getMaxVScroll, getViewportPosition, getVirtualMaxX, getVirtualMaxY, indexToItem, invalidatePos, invalidateVirtualSizes, maxHScrollProperty, maxVScrollProperty, viewportPositionProperty, virtualMaxXProperty, virtualMaxYProperty
-
Property Details
-
columnsRange
javafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> columnsRangePropertySpecifies the range of columns that should be present in the viewport. This also takes into account buffer columns, seevisibleColumns()andtotalColumns().- See Also:
-
rowsRange
javafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> rowsRangePropertySpecifies the range of rows that should be present in the viewport. This also takes into account buffer rows, seevisibleRows()andtotalRows().- See Also:
-
-
Method Details
-
maxColumns
int maxColumns()- Returns:
- the maximum number of columns the grid can have. This value is essentially the same as
VFXGrid.columnsNumProperty()but it's also taken into account the number of items (you can't have more columns than the number of items)
-
firstColumn
int firstColumn()- Returns:
- the index of the first visible column
-
lastColumn
int lastColumn()- Returns:
- the index of the last visible column
-
visibleColumns
int visibleColumns()- Returns:
- the number of columns visible in the viewport. Not necessarily the same as
totalColumns()
-
totalColumns
int totalColumns()- Returns:
- the total number of columns in the viewport which doesn't include only the number of visible columns but also the number of buffer columns
-
columnsRangeProperty
javafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> columnsRangeProperty()Specifies the range of columns that should be present in the viewport. This also takes into account buffer columns, seevisibleColumns()andtotalColumns().- Returns:
- the
columnsRangeproperty
-
columnsRange
default io.github.palexdev.mfxcore.base.beans.range.IntegerRange columnsRange()- Returns:
- the range of columns that should be present in the viewport. This also takes into account buffer columns,
see
visibleColumns()andtotalColumns()
-
maxRows
int maxRows()- Returns:
- the maximum number of rows the grid can have. This value depends on the number of items and the number of columns
-
firstRow
int firstRow()- Returns:
- the index of the first visible row
-
lastRow
int lastRow()- Returns:
- the index of the last visible row
-
visibleRows
int visibleRows()- Returns:
- the number of rows visible in the viewport. Not necessarily the same as
totalRows()
-
totalRows
int totalRows()- Returns:
- the total number of rows in the viewport which doesn't include only the number of visible rows but also the number of buffer rows
-
rowsRangeProperty
javafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> rowsRangeProperty()Specifies the range of rows that should be present in the viewport. This also takes into account buffer rows, seevisibleRows()andtotalRows().- Returns:
- the
rowsRangeproperty
-
rowsRange
default io.github.palexdev.mfxcore.base.beans.range.IntegerRange rowsRange()- Returns:
- the range of rows that should be present in the viewport. This also takes into account buffer rows,
see
visibleRows()andtotalRows().
-
layout
-
getTotalCellSize
io.github.palexdev.mfxcore.base.beans.Size getTotalCellSize()- Returns:
- the total size of each cell, given by the
VFXGrid.cellSizeProperty()summed to the horizontal and vertical spacing values
-
visibleCells
default int visibleCells()- Returns:
- the theoretical number of cells in the viewport. The value depends on the number of visible columns and rows,
however, doesn't take into account the possibility of incomplete columns/rows. For a precise value,
use
totalCells()instead
-
totalCells
default int totalCells()- Returns:
- the precise number of cells present in the viewport at a given time. The value depends on the current range of rows and columns. Unfortunately, it's not very efficient as the count is computed by iterating over each row and column, but it's the only stable way I found to have a correct value.
-
scrollToRow
default void scrollToRow(int row) Scrolls to the given row index by setting theVFXGrid.vPosProperty()torowIndex * totalCellHeight. -
scrollToColumn
default void scrollToColumn(int column) Scrolls to the given column index by setting theVFXGrid.hPosProperty()tocolumnIndex * totalCellWidth. -
indexToCell
Converts the given index to a cell. UsesitemToCell(Object). -
itemToCell
Converts the given item to a cell. The result is either on of the cells cached inVFXCellsCachethat is updated with the given item, or a totally new one created by theVFXGrid.getCellFactory().
-