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.

22 lines
562 B

package org.gerweck.scalafx.util.control
class GenericCell[A, B] extends javafx.scene.control.TableCell[A, B] {
def handleItemUpdate(item: B) = {
text = item.toString
}
override def updateItem(item: B, empty: Boolean) = {
super.updateItem(item, empty)
if (empty || item == null) {
text = null
graphic = null
} else {
handleItemUpdate(item)
}
}
final def text = getText()
final def text_=(s: String) = setText(s)
final def graphic = getGraphic()
final def graphic_=(g: javafx.scene.Node) = setGraphic(g)
}