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
55 lines
1.5 KiB
package nova.monadic_sfx.util.controls
|
|
|
|
import com.jfoenix.{controls => jfoenixc}
|
|
import javafx.scene.{control => jfxsc}
|
|
import scalafx.Includes._
|
|
import scalafx.beans.property.ReadOnlyObjectProperty
|
|
import scalafx.delegate.SFXDelegate
|
|
import scalafx.scene.control.IndexedCell
|
|
import scalafx.scene.control.ListCell
|
|
import scalafx.scene.control.ListView
|
|
|
|
object JFXListCell {
|
|
implicit def sfxListCell2jfx[T](
|
|
l: JFXListCell[T]
|
|
): ListCell[T] =
|
|
if (l != null) l.delegate else null
|
|
}
|
|
|
|
class JFXListCell[T](
|
|
override val delegate: jfoenixc.JFXListCell[T] =
|
|
new jfoenixc.JFXListCell[T] {
|
|
override def updateItem(
|
|
item: T,
|
|
empty: Boolean
|
|
): Unit = {
|
|
super.updateItem(item, empty)
|
|
// setText(null)
|
|
setText(getText())
|
|
setGraphic(getGraphic())
|
|
// setGraphic(null)
|
|
// remove empty (Trailing cells)
|
|
// setMouseTransparent(true)
|
|
// setStyle("-fx-background-color:TRANSPARENT;")
|
|
}
|
|
override def makeChildrenTransparent(): Unit = {}
|
|
}
|
|
) extends IndexedCell(delegate)
|
|
with SFXDelegate[jfoenixc.JFXListCell[T]] {
|
|
|
|
/**
|
|
* The ListView associated with this Cell.
|
|
*/
|
|
def listView: ReadOnlyObjectProperty[jfxsc.ListView[T]] =
|
|
delegate.listViewProperty
|
|
|
|
/**
|
|
* Updates the ListView associated with this Cell.
|
|
*/
|
|
def updateListView(listView: ListView[T]): Unit = {
|
|
delegate.updateListView(listView)
|
|
}
|
|
|
|
// delegate.cell
|
|
|
|
}
|