Module MaterialFX

Class MFXTableRow<T>

All Implemented Interfaces:
io.github.palexdev.virtualizedfx.cell.Cell<T>, Styleable, EventTarget

public class MFXTableRow<T> extends HBox implements io.github.palexdev.virtualizedfx.cell.Cell<T>
This is the HBox that contains the table row cells built by each column.

The new implementation of the table view makes use of SimpleVirtualFlow to contain the rows, this makes the table view super efficient, that's also why the new MFXTableRow implements Cell.

MFXTableRowCell though, are not reusable Cells. So, to keep things efficient table rows now build the cells only once (or when needed by the table view) and simply updates them when the dataProperty() changes, by using updateCells(Object). This mechanism should also simplify working with non JavaFX models (which do not use observables).
  • Property Details

  • Field Details

  • Constructor Details

    • MFXTableRow

      public MFXTableRow(MFXTableView<T> tableView, T data)
  • Method Details

    • setupRippleGenerator

      protected void setupRippleGenerator()
      Initializes the ripple generator.
    • updateRow

      public void updateRow()
      Public API to update the row's cells.

      Simply calls updateRow(Object) given that the current dataProperty() is not null.

    • updateRow

      protected void updateRow(T data)
      Called by the updateItem(Object) method. Responsible for updating the cells, updateCells(Object), or building them if not yet done, buildCells().
    • updateCells

      protected void updateCells(T data)
      Responsible for updating the row cells by calling MFXTableRowCell.update(Object).
    • buildCells

      public void buildCells()
      Responsible for building the row's cells when needed.

      For each column specified by the table view, MFXTableView.getTableColumns(), retrieves the MFXTableColumn.rowCellFactoryProperty(), build the cell with the row's data, dataProperty(), updates the cell, MFXTableRowCell.update(Object), then adds to the list. At the end calls updateChildren(List) with the built cells list.

      If the row's data is null, exits immediately.
    • getNode

      public Node getNode()
      Specified by:
      getNode in interface io.github.palexdev.virtualizedfx.cell.Cell<T>
    • updateItem

      public void updateItem(T data)
      Specified by:
      updateItem in interface io.github.palexdev.virtualizedfx.cell.Cell<T>
    • updateIndex

      public void updateIndex(int index)
      Specified by:
      updateIndex in interface io.github.palexdev.virtualizedfx.cell.Cell<T>
    • getCells

      public ObservableList<MFXTableRowCell<T,?>> getCells()
      Returns:
      the row's cells as an unmodifiable observable list
    • getIndex

      public int getIndex()
      Gets the value of the index property.
      Property description:
      Specifies the row's index.
      Returns:
      the value of the index property
      See Also:
    • indexProperty

      public ReadOnlyIntegerProperty indexProperty()
      Specifies the row's index.
      Returns:
      the index property
      See Also:
    • setIndex

      protected void setIndex(int index)
      Sets the value of the index property.
      Property description:
      Specifies the row's index.
      Parameters:
      index - the value for the index property
      See Also:
    • getData

      public T getData()
      Gets the value of the data property.
      Property description:
      Specifies the item represented by the row.
      Returns:
      the value of the data property
      See Also:
    • dataProperty

      public ReadOnlyObjectProperty<T> dataProperty()
      Specifies the item represented by the row.
      Returns:
      the data property
      See Also:
    • setData

      protected void setData(T data)
      Sets the value of the data property.
      Property description:
      Specifies the item represented by the row.
      Parameters:
      data - the value for the data property
      See Also:
    • isSelected

      public boolean isSelected()
      Gets the value of the selected property.
      Property description:
      Specifies the selection state of the row.
      Returns:
      the value of the selected property
      See Also:
    • selectedProperty

      public ReadOnlyBooleanProperty selectedProperty()
      Specifies the selection state of the row.
      Returns:
      the selected property
      See Also:
    • setSelected

      protected void setSelected(boolean selected)
      Sets the value of the selected property.
      Property description:
      Specifies the selection state of the row.
      Parameters:
      selected - the value for the selected property
      See Also: