tornadofx / tornadofx / BindingAwareSimpleListProperty

BindingAwareSimpleListProperty

class BindingAwareSimpleListProperty<T> : SimpleListProperty<T>

Constructors

<init> BindingAwareSimpleListProperty(viewModel: ViewModel, name: String?)

Functions

bind fun bind(newObservable: ObservableValue<out ObservableList<T>>?): Unit
bindContentBidirectional fun bindContentBidirectional(list: ObservableList<T>?): Unit
equals fun equals(other: Any?): Boolean
hashCode fun hashCode(): Int

Return a unique id for this object instead of the default hashCode which is dependent on the children. Without this override we wouldnt be able to identify the facade in our internal maps.

recordBinding fun recordBinding(observableValue: Observable?): Unit

Extension Properties

isDirty val <T> Property<T>.isDirty: Boolean

Check if a given property from the ViewModel is dirty. This is a shorthand form of:

isNotDirty val <T> Property<T>.isNotDirty: Boolean
sizeProperty val ObservableList<*>.sizeProperty: IntegerBinding
viewModel val Property<*>.viewModel: ViewModel?

Extract the ViewModel from a property that is bound towards a ViewModel Facade

viewModelFacade val ObservableValue<*>.viewModelFacade: Property<*>?

Extract the ViewModel Facade from a property that is bound towards it

Extension Functions

addClass fun <T : Styleable> Iterable<T>.addClass(vararg cssClass: CssRule): <ERROR CLASS>

Add the given type safe css classes to every Node in this Iterable. Pseudo classes are also supported.

addValidator fun <T> Property<T>.addValidator(node: Node, trigger: ValidationTrigger = ValidationTrigger.OnChange(), validator: ValidationContext.(T?) -> ValidationMessage?): <ERROR CLASS>

Add the given validator to a property that resides inside a ViewModel. The supplied node will be decorated by the current decorationProvider for this context inside the ViewModel of the property if validation fails.

animate fun <T> WritableValue<T>.animate(endValue: T, duration: Duration, interpolator: Interpolator? = null, op: Timeline.() -> Unit = {}): Unit
asObservable fun <T> List<T>.asObservable(): ObservableList<T>

Returns a new ObservableList that is backed by the original list.

asUnmodifiable fun <T> ObservableList<T>.asUnmodifiable(): ObservableList<T>

Returns an unmodifiable ObservableList that wraps the original list.

assignIfNull fun <T> WritableValue<T>.assignIfNull(creator: () -> T): Unit

Assign the value from the creator to this WritableValue if and only if it is currently null

asyncItems fun <T> ListProperty<T>.asyncItems(func: FXTask<*>.() -> Collection<T>): <ERROR CLASS>
asyncItems fun <T> ObservableList<T>.asyncItems(func: FXTask<*>.() -> Collection<T>): <ERROR CLASS>
awaitUntil fun <T> ObservableValue<T>.awaitUntil(condition: (T) -> Boolean): Unit

Wait on the UI thread until a certain value is available on this observable.

bind fun <SourceType, TargetType> MutableList<TargetType>.bind(sourceList: ObservableList<SourceType>, converter: (SourceType) -> TargetType): ListConversionListener<SourceType, TargetType>
fun <SourceType, TargetType> MutableList<TargetType>.bind(sourceSet: ObservableSet<SourceType>, converter: (SourceType) -> TargetType): SetConversionListener<SourceType, TargetType>

Bind this list to the given observable list by converting them into the correct type via the given converter. Changes to the observable list are synced.

fun <SourceTypeKey, SourceTypeValue, TargetType> MutableList<TargetType>.bind(sourceMap: ObservableMap<SourceTypeKey, SourceTypeValue>, converter: (SourceTypeKey, SourceTypeValue) -> TargetType): MapConversionListener<SourceTypeKey, SourceTypeValue, TargetType>
booleanBinding fun <T> ObservableValue<T>.booleanBinding(vararg dependencies: Observable, op: (T?) -> Boolean): BooleanBinding
cleanBind fun <T> Property<T>.cleanBind(observable: ObservableValue<T>): Unit

Binds this property to an observable, automatically unbinding it before if already bound.

contains fun <T : Node> Iterable<T>.contains(cmp: UIComponent): <ERROR CLASS>
doubleBinding fun <T> ObservableValue<T>.doubleBinding(vararg dependencies: Observable, op: (T?) -> Double): DoubleBinding
fill fun <T> ObservableList<T>.fill(value: T): Unit

Fills the observable list with the provided value. Fires only one change notification on the list.

floatBinding fun <T> ObservableValue<T>.floatBinding(vararg dependencies: Observable, op: (T?) -> Float): FloatBinding
getProperty fun <T> Any.getProperty(prop: KMutableProperty1<*, T>): ObjectProperty<T>
getValue operator fun <T> ObservableValue<T>.getValue(thisRef: Any, property: KProperty<*>): T
integerBinding fun <T> ObservableValue<T>.integerBinding(vararg dependencies: Observable, op: (T?) -> Int): IntegerBinding
invalidate fun <T> ObservableList<T>.invalidate(): Unit
longBinding fun <T> ObservableValue<T>.longBinding(vararg dependencies: Observable, op: (T?) -> Long): LongBinding
mapEach fun <T, R> Iterable<T>.mapEach(action: T.() -> R): <ERROR CLASS>

map with the element as receiver.

mapEachTo fun <T, R, C : MutableCollection<in R>> Iterable<T>.mapEachTo(destination: C, action: T.() -> R): <ERROR CLASS>

mapTo with the element as receiver.

markDirty fun Property<*>.markDirty(): Unit?

Mark this ViewModel facade property as dirty in its owning ViewModel.

move fun <T> MutableList<T>.move(item: T, newIndex: Int): Unit

Moves the given T item to the specified index

moveAll fun <T> MutableList<T>.moveAll(newIndex: Int, predicate: (T) -> Boolean): Unit

Moves all items meeting a predicate to the given index

moveAt fun <T> MutableList<T>.moveAt(oldIndex: Int, newIndex: Int): Unit

Moves the given item at the oldIndex to the newIndex

moveDown fun <T> MutableList<T>.moveDown(item: T): Boolean

Moves the given element T up the MutableList by an index increment unless it is at the bottom already which will result in no movement. Returns a Boolean indicating if move was successful

fun <T> MutableList<T>.moveDown(predicate: (T) -> Boolean): <ERROR CLASS>

Moves first element T down an index that satisfies the given predicate, unless its already at the bottom

moveDownAll fun <T> MutableList<T>.moveDownAll(predicate: (T) -> Boolean): <ERROR CLASS>

Moves all T elements down an index that satisfy the given predicate, unless they are already at the bottom

moveDownAt fun <T> MutableList<T>.moveDownAt(index: Int): Unit

Moves the given element T up the MutableList by one increment unless it is at the bottom already which will result in no movement

moveToBottomWhere fun <T> MutableList<T>.moveToBottomWhere(predicate: (T) -> Boolean): Unit
moveToTopWhere fun <T> MutableList<T>.moveToTopWhere(predicate: (T) -> Boolean): Unit
moveUp fun <T> MutableList<T>.moveUp(item: T): Boolean

Moves the given element T up the MutableList by an index increment unless it is at the top already which will result in no movement. Returns a Boolean indicating if move was successful

fun <T> MutableList<T>.moveUp(predicate: (T) -> Boolean): <ERROR CLASS>

Moves first element T up an index that satisfies the given predicate, unless its already at the top

moveUpAll fun <T> MutableList<T>.moveUpAll(predicate: (T) -> Boolean): <ERROR CLASS>

Moves all T elements up an index that satisfy the given predicate, unless they are already at the top

moveUpAt fun <T> MutableList<T>.moveUpAt(index: Int): Unit

Moves the given element at specified index up the MutableList by one increment unless it is at the top already which will result in no movement

mutateOnChange fun <T> Property<T>.mutateOnChange(mutator: (T?) -> T?): <ERROR CLASS>

Listen to changes and update the value of the property if the given mutator results in a different value

objectBinding fun <T, R> ObservableValue<T>.objectBinding(vararg dependencies: Observable, op: (T?) -> R?): Binding<R?>
observable fun <T : Any> Any.observable(propName: String): ObjectProperty<T>
observable fun <T> List<T>.observable(): ObservableList<T>
onChange fun <T> ObservableValue<T>.onChange(op: (T?) -> Unit): <ERROR CLASS>
onChange fun <T> ObservableList<T>.onChange(op: (Change<out T>) -> Unit): <ERROR CLASS>
onChangeOnce fun <T> ObservableValue<T>.onChangeOnce(op: (T?) -> Unit): Unit
onChangeTimes fun <T> ObservableValue<T>.onChangeTimes(times: Int, op: (T?) -> Unit): Unit

Listen for changes to this observable. Optionally only listen x times. The lambda receives the changed value when the change occurs, which may be null,

removeClass fun <T : Styleable> Iterable<T>.removeClass(vararg cssClass: CssRule): <ERROR CLASS>

Remove the given type safe css classes from every node in this Iterable. Pseudo classes are also supported.

reverse fun <T> ObservableList<T>.reverse(): Unit

Reverse the order in the observable list. Fires only one change notification on the list.

select fun <T, N> ObservableValue<T>.select(nested: (T) -> ObservableValue<N>): Property<N>
selectBoolean fun <T> ObservableValue<T>.selectBoolean(nested: (T) -> BooleanExpression): BooleanExpression
setValue operator fun <T> Property<T>.setValue(thisRef: Any, property: KProperty<*>, value: T?): Unit
shuffle fun <T> ObservableList<T>.shuffle(): Unit

Randomly shuffles elements in this observable list. Fires only one change notification on the list.

fun <T> ObservableList<T>.shuffle(random: Random): Unit

Randomly shuffles elements in this observable list using the specified random instance as the source of randomness. Fires only one change notification on the list.

sort fun <T : Comparable<T>> ObservableList<T>.sort(): Unit

Sorts elements in the observable list according to their natural sort order. Fires only one change notification on the list.

sortBy fun <T, R : Comparable<R>> ObservableList<T>.sortBy(selector: (T) -> R?): Unit

Sorts elements in the observable list according to natural sort order of the value returned by specified selector function. Fires only one change notification on the list.

sortByDescending fun <T, R : Comparable<R>> ObservableList<T>.sortByDescending(selector: (T) -> R?): Unit

Sorts elements in the observable list descending according to natural sort order of the value returned by specified selector function. Fires only one change notification on the list.

sortWith fun <T> ObservableList<T>.sortWith(comparator: Comparator<in T>): Unit

Sorts elements in the observable list according to the order specified with comparator. Fires only one change notification on the list.

stringBinding fun <T> ObservableValue<T>.stringBinding(vararg dependencies: Observable, op: (T?) -> String?): StringBinding
swap fun <T> MutableList<T>.swap(indexOne: Int, indexTwo: Int): Unit

Swaps the position of two items at two respective indices

fun <T> MutableList<T>.swap(itemOne: T, itemTwo: T): Unit

Swaps the index position of two items

toJSON fun <T : JsonModel> Iterable<T>.toJSON(): <ERROR CLASS>
toObservable fun <T> List<T>.toObservable(): ObservableList<T>

Returns a new ObservableList with the elements from the original list.

toggleClass fun <T : Styleable> Iterable<T>.toggleClass(cssClass: CssRule, predicate: Boolean): <ERROR CLASS>

Toggle the given type safe css class on every node in this iterable based on the given predicate. Pseudo classes are also supported.

withEach fun <T> Iterable<T>.withEach(action: T.() -> Unit): <ERROR CLASS>

forEach with the element as receiver.