Module MaterialFX

Class MFXComboBoxCell<T>

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

public class MFXComboBoxCell<T> extends HBox implements io.github.palexdev.virtualizedfx.cell.Cell<T>
Cells used by default by MFXComboBox

The cell's structure is pretty similar to the MFXListCell one, but doesn't include a ripple generator as it is not necessary (the popup is closed on selection, the ripple effect is barely noticeable).

The label used to display the data (in case it's not a Node), uses the combo box's StringConverter to convert the data to a String. In case it's null, toString() is called on the data.
  • Property Details

  • Field Details

  • Constructor Details

    • MFXComboBoxCell

      public MFXComboBoxCell(MFXCombo<T> combo, T data)
  • Method Details

    • initialize

      protected void initialize()
    • setBehavior

      protected void setBehavior()
      Sets the following behaviors:

      - Binds the selected property to the combo' selection model (checks for index).

      - Updates the selected PseudoClass state when selected property changes.

      - Adds and handler for MOUSE_PRESSED events to call updateSelection(MouseEvent).

    • 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.

    • updateSelection

      protected void updateSelection(MouseEvent event)
      If the pressed mouse button is not the primary, exits immediately.

      Orders the combo's selection model to select the index of this cell.

    • getNode

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

      public void updateIndex(int index)
      Updates the index property of the cell.

      This is called before updateItem(Object).

      Specified by:
      updateIndex in interface io.github.palexdev.virtualizedfx.cell.Cell<T>
    • updateItem

      public void updateItem(T item)
      Updates the data property of the cell.

      This is called after updateIndex(int).

      Specified by:
      updateItem in interface io.github.palexdev.virtualizedfx.cell.Cell<T>
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class Region
    • getData

      public T getData()
      Gets the value of the property data.
      Property description:
      Data property of the cell.
    • dataProperty

      public ReadOnlyObjectProperty<T> dataProperty()
      Data property of the cell.
      See Also:
    • setData

      protected void setData(T data)
      Sets the value of the property data.
      Property description:
      Data property of the cell.
    • getIndex

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

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

      protected void setIndex(int index)
      Sets the value of the property index.
      Property description:
      Specifies the cell's index.
    • isSelected

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

      public ReadOnlyBooleanProperty selectedProperty()
      Specifies the selection state of the cell.
      See Also:
    • setSelected

      protected void setSelected(boolean selected)
      Sets the value of the property selected.
      Property description:
      Specifies the selection state of the cell.