All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tornadofx.adapters.TornadoFXResizeFeatures.kt Maven / Gradle / Ivy

There is a newer version: 1.7.20
Show newest version
package tornadofx.adapters

import javafx.collections.ObservableMap
import javafx.scene.control.TableColumn
import javafx.scene.control.TableView
import javafx.scene.control.TreeTableColumn
import javafx.scene.control.TreeTableView
import javafx.util.Callback

typealias Properties = ObservableMap
typealias TableViewResizeCallback = Callback, Boolean>
typealias TreeTableViewResizeCallback = Callback, Boolean>

fun TreeTableView.ResizeFeatures<*>.toTornadoFXResizeFeatures() = TornadoFXTreeTableResizeFeatures(this)
fun TableView.ResizeFeatures<*>.toTornadoFXFeatures() = TornadoFxTableResizeFeatures(this)

interface TornadoFXResizeFeatures {
    val table: TornadoFXTable
    val delta: Double
    val column: TornadoFXColumn?
}

class TornadoFXTreeTableResizeFeatures(val param: TreeTableView.ResizeFeatures) : TornadoFXResizeFeatures, TreeTableView<*>> {
    override val column = param.column?.toTornadoFXColumn()
    override val table = param.table.toTornadoFXTable()
    override val delta: Double get() = param.delta
}

class TornadoFxTableResizeFeatures(val param: TableView.ResizeFeatures) : TornadoFXResizeFeatures, TableView<*>> {
    override val table: TornadoFXTable, TableView<*>> = TornadoFXNormalTable(param.table)
    override val delta: Double = param.delta
    override val column: TornadoFXColumn>? = param.column?.let { TornadoFxNormalTableColumn(it) }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy