tornadofx / tornadofx / javafx.scene.control.TableView

Extensions for javafx.scene.control.TableView

addColumnInternal fun <S> TableView<S>.addColumnInternal(column: TableColumn<S, *>, index: Int? = null): Unit
asyncItems fun <T> TableView<T>.asyncItems(func: FXTask<*>.() -> Collection<T>): <ERROR CLASS>
bindSelected fun <T> TableView<T>.bindSelected(property: Property<T>): Unit
fun <T> TableView<out T>.bindSelected(model: ItemViewModel<in T>): Unit
column fun <S, T> TableView<S>.column(title: String, propertyName: String, op: TableColumn<S, T>.() -> Unit = {}): TableColumn<S, T>

Create a column using the propertyName of the attribute you want shown.

fun <S, T> TableView<S>.column(title: String, getter: KFunction<T>): TableColumn<S, T>

Create a column using the getter of the attribute you want shown.

fun <S, T> TableView<S>.column(title: String, prop: KMutableProperty1<S, T>, op: TableColumn<S, T>.() -> Unit = {}): TableColumn<S, T>

Create a column with a value factory that extracts the value from the given mutable property and converts the property to an observable value.

fun <S, T> TableView<S>.column(title: String, prop: KProperty1<S, ObservableValue<T>>, op: TableColumn<S, T>.() -> Unit = {}): TableColumn<S, T>

Create a column with a value factory that extracts the value from the given ObservableValue property.

fun <S, T : Any> TableView<S>.column(title: String, cellType: KClass<T>, op: TableColumn<S, T>.() -> Unit = {}): TableColumn<S, T>

Create a column with a title specified cell type and operate on it. Inside the code block you can call value { it.value.someProperty } to set up a cellValueFactory that must return T or ObservableValue

fun <S, T> TableView<S>.column(title: String, valueProvider: (CellDataFeatures<S, T>) -> ObservableValue<T>): TableColumn<S, T>

Create a column with a value factory that extracts the value from the given callback.

fun <S, T> TableView<S>.column(title: String, observableFn: KFunction<ObservableValue<T>>): TableColumn<S, T>

Create a column with a value factory that extracts the observable value from the given function reference. This method requires that you have kotlin-reflect on your classpath.

contentColumns val TableView<*>.contentColumns: List<TableColumn<*, *>>
editModel val <S> TableView<S>.editModel: TableViewEditModel<S>
editableWhen fun TableView<*>.editableWhen(predicate: ObservableValue<Boolean>): <ERROR CLASS>
enableCellEditing fun <T> TableView<T>.enableCellEditing(): Unit
enableDirtyTracking fun <S> TableView<S>.enableDirtyTracking(): Unit
getContentWidth fun TableView<*>.getContentWidth(): <ERROR CLASS>

Get the width of the area available for columns inside the TableView

makeIndexColumn fun <S> TableView<S>.makeIndexColumn(name: String = "#", startNumber: Int = 1): TableColumn<S, Number>
moveToBottomWhere fun <T> TableView<T>.moveToBottomWhere(backingList: ObservableList<T> = items, select: Boolean = true, predicate: (T) -> Boolean): Unit
moveToTopWhere fun <T> TableView<T>.moveToTopWhere(backingList: ObservableList<T> = items, select: Boolean = true, predicate: (T) -> Boolean): Unit
multiSelect fun <T> TableView<T>.multiSelect(enable: Boolean = true): Unit
nestedColumn fun <S> TableView<S>.nestedColumn(title: String, op: TableView<S>.(TableColumn<S, Any?>) -> Unit = {}): TableColumn<S, Any?>

Create a column holding children columns

onEditCommit fun <S> TableView<S>.onEditCommit(onCommit: CellEditEvent<S, Any>.(S) -> Unit): Unit

Add a global edit commit handler to the TableView. You avoid assuming the responsibility for writing back the data into your domain object and can consentrate on the actual response you want to happen when a column commits and edit.

onEditStart fun <S> TableView<S>.onEditStart(onEditStart: CellEditEvent<S, Any?>.(S) -> Unit): Unit

Add a global edit start handler to the TableView. You can use this callback to cancel the edit request by calling cancel()

onSelectionChange fun <S> TableView<S>.onSelectionChange(func: (S?) -> Unit): Unit
onUserDelete fun <T> TableView<T>.onUserDelete(action: (T) -> Unit): Unit
onUserSelect fun <T> TableView<T>.onUserSelect(clickCount: Int = 2, action: (T) -> Unit): Unit

Execute action when the enter key is pressed or the mouse is clicked

readonlyColumn fun <S, T> TableView<S>.readonlyColumn(title: String, prop: KProperty1<S, T>, op: TableColumn<S, T>.() -> Unit = {}): TableColumn<S, T>

Create a column with a value factory that extracts the value from the given property and converts the property to an observable value.

regainFocusAfterEdit fun <T> TableView<T>.regainFocusAfterEdit(): <ERROR CLASS>
requestResize fun TableView<*>.requestResize(): Unit
resizeColumnsToFitContent fun TableView<out Any>.resizeColumnsToFitContent(resizeColumns: List<TableColumn<*, *>> = contentColumns, maxRows: Int = 50, afterResize: () -> Unit = {}): Unit
rowExpander fun <S> TableView<S>.rowExpander(expandOnDoubleClick: Boolean = false, expandedNodeCallback: RowExpanderPane.(S) -> Unit): ExpanderColumn<S>
selectFirst fun <T> TableView<T>.selectFirst(): Unit
selectOnDrag fun <T> TableView<T>.selectOnDrag(): Unit
selectWhere fun <T> TableView<T>.selectWhere(scrollTo: Boolean = true, condition: (T) -> Boolean): Unit
selectedCell val <T> TableView<T>.selectedCell: TablePosition<T, *>?
selectedColumn val <T> TableView<T>.selectedColumn: TableColumn<T, *>?
selectedItem val <T> TableView<T>.selectedItem: T?
selectedValue val <T> TableView<T>.selectedValue: Any?
smartResize fun TableView<*>.smartResize(): Unit