Class TableHelper.AbstractHelper

java.lang.Object
io.github.palexdev.virtualizedfx.table.TableHelper.AbstractHelper
All Implemented Interfaces:
TableHelper
Direct Known Subclasses:
TableHelper.FixedTableHelper
Enclosing interface:
TableHelper

public abstract static class TableHelper.AbstractHelper extends Object implements TableHelper
Abstract implementation of TableHelper, and base class for TableHelper.FixedTableHelper.
  • Property Details

  • Field Details

    • table

      protected final VirtualTable<?> table
    • manager

      protected final TableManager<?> manager
    • widthListener

      protected ChangeListener<? super Number> widthListener
    • heightListener

      protected ChangeListener<? super Number> heightListener
    • positionListener

      protected ChangeListener<? super io.github.palexdev.mfxcore.base.beans.Position> positionListener
    • estimatedSize

      protected final io.github.palexdev.mfxcore.base.properties.SizeProperty estimatedSize
    • layoutInitialized

      protected final ReadOnlyBooleanWrapper layoutInitialized
    • xPosBinding

      protected DoubleBinding xPosBinding
    • yPosBinding

      protected DoubleBinding yPosBinding
  • Constructor Details

    • AbstractHelper

      public AbstractHelper(VirtualTable<?> table)
  • Method Details

    • onWidthChanged

      protected void onWidthChanged(Number ov, Number nv)
      Executed when the table's width changes. Re-initializes the viewport with TableManager.init()
    • onHeightChanged

      protected void onHeightChanged(Number ov, Number nv)
      Executed when the table's height changes. Re-initializes the viewport with TableManager.init().
    • onPositionChanged

      protected void onPositionChanged(io.github.palexdev.mfxcore.base.beans.Position ov, io.github.palexdev.mfxcore.base.beans.Position nv)
      Executed when the VirtualTable.positionProperty() changes, responsible for invoking TableManager.onHScroll() (if x pos changed( and TableManager.onVScroll() (if y pos changed)
    • getViewportHeight

      public double getViewportHeight()
      Description copied from interface: TableHelper
      The table is a particular virtualized control because the actual viewport height is not the entire height of the table. The container for the columns is technically not part of the viewport, so it must be subtracted.
      Specified by:
      getViewportHeight in interface TableHelper
    • horizontalOffset

      public double horizontalOffset()
      Specifies a certain amount by which shift the horizontal position of columns and rows. Behavior may differ between implementations and depends also on TableHelper.layout()

      The VirtualTable always renders one extra column as overscan/buffer. This approach has a little issue for how scrolling works. When the end of the viewport is reached (horizontally) the extra column ends up overflowing the table, it's positioned outside of it.

      To make the layout work correctly this method returns an offset of -table.getColumnSize().getWidth() to ensure all columns are correctly visualized. Returns 0 if the extra offset is not needed.

      Specified by:
      horizontalOffset in interface TableHelper
    • verticalOffset

      public double verticalOffset()
      Specifies a certain amount by which shift the vertical position of rows. Behavior may differ between implementations and depends also on TableHelper.layout()

      The VirtualTable always renders one extra row as overscan/buffer. This approach has a little issue for how scrolling works. When the end of the viewport is reached (vertically) the extra row ends up overflowing the table, it's positioned outside of it.

      To make the layout work correctly this method returns an offset of -table.getCellHeight() to ensure all rows are correctly visualized. Returns 0 if the extra offset is not needed.

      Specified by:
      verticalOffset in interface TableHelper
    • invalidatedPos

      public boolean invalidatedPos()
      Description copied from interface: TableHelper
      Invalidates VirtualTable.positionProperty() in case changes occur in the viewport and the current position is no longer valid.
      Specified by:
      invalidatedPos in interface TableHelper
      Returns:
      true or false if the old position was invalid or not
    • estimatedSizeProperty

      public ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.Size> estimatedSizeProperty()
      Description copied from interface: TableHelper
      Specified by:
      estimatedSizeProperty in interface TableHelper
      Returns:
      the estimatedSize property
    • isLayoutInitialized

      public boolean isLayoutInitialized()
      Gets the value of the layoutInitialized property.
      Specified by:
      isLayoutInitialized in interface TableHelper
      Property description:
      Returns:
      the value of the layoutInitialized property
      See Also:
    • layoutInitializedProperty

      public ReadOnlyBooleanProperty layoutInitializedProperty()
      Description copied from interface: TableHelper
      A hook for late layout initialization. When this property changes it is guaranteed that the first full layout pass has been performed.
      Specified by:
      layoutInitializedProperty in interface TableHelper
      Returns:
      the layoutInitialized property
      See Also:
    • dispose

      public void dispose()
      Description copied from interface: TableHelper
      Disposes bindings/listeners that are not required anymore.
      Specified by:
      dispose in interface TableHelper