Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (20 sloc) 816 Bytes
package org.epistatic.app4.controller
import javafx.beans.property.ReadOnlyObjectWrapper
import javafx.beans.value.ObservableValue
import javafx.scene.control.TableColumn
import javafx.util.Callback
import org.epistatic.app4.model.DateItem
import java.time.OffsetDateTime
/**
* Explicitly sets the cell value to the objects date field. Same functionality as:
* PropertyValueFactory<DateItem, OffsetDateTime>("date")
*/
class DateCellValueFactory : Callback<TableColumn.CellDataFeatures<DateItem, OffsetDateTime>, ObservableValue<OffsetDateTime>> {
override fun call(p: TableColumn.CellDataFeatures<DateItem, OffsetDateTime>): ObservableValue<OffsetDateTime> {
return if (p.value != null) {
ReadOnlyObjectWrapper(p.value.date)
} else {
ReadOnlyObjectWrapper()
}
}
}
You can’t perform that action at this time.