Class VFXTableHelper.AbstractHelper<T>

java.lang.Object
io.github.palexdev.virtualizedfx.table.VFXTableHelper.AbstractHelper<T>
Type Parameters:
T -
All Implemented Interfaces:
VFXTableHelper<T>
Direct Known Subclasses:
VFXTableHelper.FixedTableHelper, VFXTableHelper.VariableTableHelper
Enclosing interface:
VFXTableHelper<T>

public abstract static class VFXTableHelper.AbstractHelper<T> extends Object implements VFXTableHelper<T>
Abstract implementation of VFXTableHelper, contains common members for the two concrete implementations VFXTableHelper.FixedTableHelper and VFXTableHelper.VariableTableHelper, such as:

- the range of columns to display as a IntegerRangeProperty

- the range of rows to display as a IntegerRangeProperty

- the virtual max x as a ReadOnlyDoubleWrapper

- the virtual max y as a ReadOnlyDoubleWrapper

- the viewport's position, viewportPositionProperty() as a PositionProperty

  • Property Details

  • Field Details

    • table

      protected VFXTable<T> table
    • columnsRange

      protected final io.github.palexdev.mfxcore.base.properties.range.IntegerRangeProperty columnsRange
    • rowsRange

      protected final io.github.palexdev.mfxcore.base.properties.range.IntegerRangeProperty rowsRange
    • virtualMaxX

      protected final javafx.beans.property.ReadOnlyDoubleWrapper virtualMaxX
    • virtualMaxY

      protected final javafx.beans.property.ReadOnlyDoubleWrapper virtualMaxY
    • maxHScroll

      protected final javafx.beans.property.ReadOnlyDoubleWrapper maxHScroll
    • maxVScroll

      protected final javafx.beans.property.ReadOnlyDoubleWrapper maxVScroll
    • viewportPosition

      protected final io.github.palexdev.mfxcore.base.properties.PositionProperty viewportPosition
  • Constructor Details

    • AbstractHelper

      public AbstractHelper(VFXTable<T> table)
  • Method Details

    • initBindings

      protected void initBindings()
      Bindings and listeners should be initialized here, automatically called after the table instance is set.
    • lastColumn

      public int lastColumn()

      Given by columnsRange().getMax()
      Specified by:
      lastColumn in interface VFXTableHelper<T>
      Returns:
      the index of the last visible column
    • columnsRangeProperty

      public javafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> columnsRangeProperty()
      Description copied from interface: VFXTableHelper
      Specifies the range of columns that should be present in the viewport. This also takes into account buffer columns, see VFXTableHelper.visibleColumns() and VFXTableHelper.totalColumns().
      Specified by:
      columnsRangeProperty in interface VFXTableHelper<T>
      Returns:
      the columnsRange property
    • firstRow

      public int firstRow()

      Given by Math.floor(vPos / rowsHeight), clamped between 0 and VFXContainer.size() - 1.
      Specified by:
      firstRow in interface VFXTableHelper<T>
      Returns:
      the index of the first visible row
    • lastRow

      public int lastRow()

      Given by rowsRange().getMax()
      Specified by:
      lastRow in interface VFXTableHelper<T>
      Returns:
      the index of the last visible row
    • visibleRows

      public int visibleRows()

      Given by Math.ceil(viewportHeight / rowsHeight). 0 if the rows height is also 0.
      Specified by:
      visibleRows in interface VFXTableHelper<T>
      Returns:
      the number of rows visible in the viewport. Not necessarily the same as VFXTableHelper.totalRows()
    • totalRows

      public int totalRows()

      Given by visibleRows + rowsBuffer * 2, can't exceed VFXContainer.size() and it's 0 if the number of visible rows is also 0.
      Specified by:
      totalRows in interface VFXTableHelper<T>
      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

      public javafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> rowsRangeProperty()
      Description copied from interface: VFXTableHelper
      Specifies the range of rows that should be present in the viewport. This also takes into account buffer rows, see VFXTableHelper.visibleRows() and VFXTableHelper.totalRows().
      Specified by:
      rowsRangeProperty in interface VFXTableHelper<T>
      Returns:
      the rowsRange property
    • virtualMaxXProperty

      public javafx.beans.property.ReadOnlyDoubleProperty virtualMaxXProperty()
      Description copied from interface: VFXTableHelper
      Specifies the total number of pixels on the x-axis.
      Specified by:
      virtualMaxXProperty in interface VFXTableHelper<T>
      Returns:
      the virtualMaxX property
      See Also:
    • virtualMaxYProperty

      public javafx.beans.property.ReadOnlyDoubleProperty virtualMaxYProperty()
      Description copied from interface: VFXTableHelper
      Specifies the total number of pixels on the y-axis.
      Specified by:
      virtualMaxYProperty in interface VFXTableHelper<T>
      Returns:
      the virtualMaxY property
      See Also:
    • maxVScrollProperty

      public javafx.beans.property.ReadOnlyDoubleProperty maxVScrollProperty()
      Description copied from interface: VFXTableHelper
      Specifies the maximum possible vertical position.
      Specified by:
      maxVScrollProperty in interface VFXTableHelper<T>
      Returns:
      the maxVScroll property
      See Also:
    • maxHScrollProperty

      public javafx.beans.property.ReadOnlyDoubleProperty maxHScrollProperty()
      Description copied from interface: VFXTableHelper
      Specifies the maximum possible horizontal position.
      Specified by:
      maxHScrollProperty in interface VFXTableHelper<T>
      Returns:
      the maxHScroll property
      See Also:
    • viewportPositionProperty

      public javafx.beans.property.ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.Position> viewportPositionProperty()
      Description copied from interface: VFXTableHelper
      Cells are actually contained in a separate pane called 'viewport'. The scroll is applied on this pane.

      This property specifies the translation of the viewport, the value depends on the implementation.

      Specified by:
      viewportPositionProperty in interface VFXTableHelper<T>
      Returns:
      the viewportPosition property
      See Also:
    • getTable

      public VFXTable<T> getTable()
      Specified by:
      getTable in interface VFXTableHelper<T>
      Returns:
      the VFXTable instance the helper is related to
    • dispose

      public void dispose()
      Automatically called by VFXTable when a helper is not needed anymore (changed). If the helper uses listeners/bindings that may lead to memory leaks, this is the right place to remove them.

      Sets the table reference to null.
      Specified by:
      dispose in interface VFXTableHelper<T>