Module MaterialFX

Class MFXListCell<T>

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

public class MFXListCell<T> extends AbstractMFXListCell<T>
Simple implementation of AbstractMFXListCell, includes a ripple generator for ripple effects on mouse pressed.

The label used to display the data is built in the constructor only if the given T data is not a Node, otherwise it's null.

The label's text is bound to the data property and converted to a String using ObjectExpression.asString().
  • Field Details

  • Constructor Details

    • MFXListCell

      public MFXListCell(MFXListView<T> listView, T data)
  • Method Details

    • initialize

      protected void initialize()
      Overridden to add the style class, setup the ripple generator and call render(Object) for the first time.
      Overrides:
      initialize in class AbstractMFXListCell<T>
    • setupRippleGenerator

      protected void setupRippleGenerator()
      Sets up the properties of the ripple generator and adds the mouse pressed filter.
    • render

      protected void render(T data)
      Responsible for rendering the cell's content.

      If the given data type is a Node, it is added to the children list, otherwise a label is used to display the data.

      At the end adds a ripple generator at index 0.

      Specified by:
      render in class AbstractMFXListCell<T>
    • updateItem

      public void updateItem(T item)
      Updates the data property of the cell. If the data is a Node render(Object) is called.

      This is called after AbstractMFXListCell.updateIndex(int).

      Specified by:
      updateItem in interface io.github.palexdev.virtualizedfx.cell.Cell<T>
      Overrides:
      updateItem in class AbstractMFXListCell<T>
    • toParent

      public Parent toParent()
      Description copied from interface: Themable
      Implementations should return the Parent node onto which themes and stylesheets will be applied. Most of the case its themselves.
      Specified by:
      toParent in interface Themable
      Overrides:
      toParent in class AbstractMFXListCell<T>
    • getTheme

      public Theme getTheme()
      Description copied from interface: Themable
      Implementations of this should return the Theme responsible for styling themselves, most MaterialFX controls return one of the constants offered by Stylesheets.
    • toString

      public String toString()
      Overrides:
      toString in class Node