Class ShortLongTextCellFactory<T>

java.lang.Object
org.tentackle.fx.ShortLongTextCellFactory<T>
All Implemented Interfaces:
javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>

public class ShortLongTextCellFactory<T> extends Object implements javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>
Cell factory to display items implementing ShortLongText.
  • Constructor Details

    • ShortLongTextCellFactory

      public ShortLongTextCellFactory()
      Creates the short/long-text cell factory.
  • Method Details

    • call

      public javafx.scene.control.ListCell<T> call(javafx.scene.control.ListView<T> listView)
      Specified by:
      call in interface javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>
    • getShortLongText

      protected ShortLongText getShortLongText(T item)
      Returns whether the long text should be shown for the given item.
      Parameters:
      item - the item
      Returns:
      the ShortLongText to be displayed, null if only short text as toString()
    • updateLabels

      protected void updateLabels(T item, javafx.scene.control.Label shortLabel, javafx.scene.control.Label longLabel)
      Updates the labels of a cell.
      Parameters:
      item - the item to display
      shortLabel - the label for the short text
      longLabel - the label for the long text