You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.5 KiB

3 years ago
3 years ago
3 years ago
3 years ago
  1. package nova.monadic_sfx.util.controls
  2. import com.jfoenix.{controls => jfoenixc}
  3. import javafx.scene.{control => jfxsc}
  4. import scalafx.Includes._
  5. import scalafx.beans.property.ReadOnlyObjectProperty
  6. import scalafx.delegate.SFXDelegate
  7. import scalafx.scene.control.IndexedCell
  8. import scalafx.scene.control.ListCell
  9. import scalafx.scene.control.ListView
  10. object JFXListCell {
  11. implicit def sfxListCell2jfx[T](
  12. l: JFXListCell[T]
  13. ): ListCell[T] =
  14. if (l != null) l.delegate else null
  15. }
  16. class JFXListCell[T](
  17. override val delegate: jfoenixc.JFXListCell[T] =
  18. new jfoenixc.JFXListCell[T] {
  19. override def updateItem(
  20. item: T,
  21. empty: Boolean
  22. ): Unit = {
  23. super.updateItem(item, empty)
  24. // setText(null)
  25. setText(getText())
  26. setGraphic(getGraphic())
  27. // setGraphic(null)
  28. // remove empty (Trailing cells)
  29. // setMouseTransparent(true)
  30. // setStyle("-fx-background-color:TRANSPARENT;")
  31. }
  32. override def makeChildrenTransparent(): Unit = {}
  33. }
  34. ) extends IndexedCell(delegate)
  35. with SFXDelegate[jfoenixc.JFXListCell[T]] {
  36. /**
  37. * The ListView associated with this Cell.
  38. */
  39. def listView: ReadOnlyObjectProperty[jfxsc.ListView[T]] =
  40. delegate.listViewProperty
  41. /**
  42. * Updates the ListView associated with this Cell.
  43. */
  44. def updateListView(listView: ListView[T]): Unit = {
  45. delegate.updateListView(listView)
  46. }
  47. // delegate.cell
  48. }