client: Small tweaks

This commit is contained in:
Andras Slemmer 2016-09-01 10:55:59 +01:00
parent 2ef59ff2ba
commit 3a5247f016
3 changed files with 3 additions and 4 deletions

View File

@ -8,10 +8,10 @@ import javafx.collections.ObservableList
import rx.Observable
/**
* Simple utilities for converting an [rx.Observable] into an [ObservableValue]/[ObservableList]
* Simple utilities for converting an [rx.Observable] into a javafx [ObservableValue]/[ObservableList]
*/
fun <A, B> Observable<A>.foldToObservable(initial: B, folderFun: (A, B) -> B): ObservableValue<B> {
fun <A, B> Observable<A>.foldToObservableValue(initial: B, folderFun: (A, B) -> B): ObservableValue<B> {
val result = SimpleObjectProperty<B>(initial)
subscribe {
Platform.runLater {

View File

@ -8,7 +8,6 @@ import com.r3corda.client.fxutils.foldToObservableList
import com.r3corda.node.services.monitor.ServiceToClientEvent
import javafx.collections.ObservableList
import kotlinx.support.jdk8.collections.removeIf
import org.reactfx.EventStream
import rx.Observable
class StatesDiff<out T : ContractState>(

View File

@ -110,7 +110,7 @@ sealed class TrackedDelegate<M : Any>(val klass: KClass<M>) {
return observableListProperty(Models.get(klass, thisRef.javaClass.kotlin))
}
}
class ObservableListReadOnlyDelegate<M : Any, T>(klass: KClass<M>, val observableListReadOnlyProperty: (M) -> ObservableList<out T>) : TrackedDelegate<M>(klass) {
class ObservableListReadOnlyDelegate<M : Any, out T>(klass: KClass<M>, val observableListReadOnlyProperty: (M) -> ObservableList<out T>) : TrackedDelegate<M>(klass) {
operator fun getValue(thisRef: Any, property: KProperty<*>): ObservableList<out T> {
return observableListReadOnlyProperty(Models.get(klass, thisRef.javaClass.kotlin))
}