updae for scala 2.13 changes
This commit is contained in:
parent
95e33fd0d7
commit
7c00f26760
@ -2,7 +2,7 @@ package org.gerweck.scalafx.akka
|
|||||||
|
|
||||||
import language.implicitConversions
|
import language.implicitConversions
|
||||||
|
|
||||||
import scala.collection.generic.{ Clearable, Growable }
|
import scala.collection.mutable.{ Clearable, Growable }
|
||||||
import scala.concurrent._
|
import scala.concurrent._
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import scala.util._
|
import scala.util._
|
||||||
|
@ -6,19 +6,24 @@ import java.util.function.{ Predicate => JPredicate }
|
|||||||
|
|
||||||
import scalafx.beans.property._
|
import scalafx.beans.property._
|
||||||
import scalafx.beans.value._
|
import scalafx.beans.value._
|
||||||
import scalafx.collections._
|
import scalafx.collections.ObservableSet
|
||||||
import scalafx.collections.transformation._
|
import scalafx.collections.ObservableArray
|
||||||
|
import scalafx.collections.ObservableBuffer
|
||||||
|
import scalafx.collections.transformation.FilteredBuffer
|
||||||
|
import scala.collection.immutable.ArraySeq
|
||||||
|
|
||||||
sealed trait ToFlatObservable[-A, +B] extends Calculable[A, B]
|
sealed trait ToFlatObservable[-A, +B] extends Calculable[A, B]
|
||||||
object ToFlatObservable extends CalculableObservable[ToFlatObservable[_, _]] {
|
object ToFlatObservable extends CalculableObservable[ToFlatObservable[_, _]] {
|
||||||
implicit def obOps[A] = new ToFlatObservable[ObservableBuffer[A], Seq[A]] {
|
implicit def obOps[A] = new ToFlatObservable[ObservableBuffer[A], Seq[A]] {
|
||||||
def recalculate(oba: ObservableBuffer[A]) = oba.toVector
|
override def recalculate(oba: ObservableBuffer[A]) = oba.toVector
|
||||||
}
|
}
|
||||||
implicit def oaOps[A] = new ToFlatObservable[ObservableArray[A, _, _], Seq[A]] {
|
implicit def oaOps[A] = new ToFlatObservable[ObservableArray[A, _, _], Seq[A]] {
|
||||||
def recalculate(oaa: ObservableArray[A, _, _]) = oaa.toVector
|
override def recalculate(oaa: ObservableArray[A, _, _]) = {
|
||||||
|
ArraySeq.unsafeWrapArray(oaa.toArray)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
implicit def osOps[A] = new ToFlatObservable[ObservableSet[A], collection.immutable.Set[A]] {
|
implicit def osOps[A] = new ToFlatObservable[ObservableSet[A], collection.immutable.Set[A]] {
|
||||||
def recalculate(os: ObservableSet[A]) = os.toSet
|
override def recalculate(os: ObservableSet[A]) = os.toSet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,11 +50,11 @@ final class RichObservableBuffer[A](val obs: ObservableBuffer[A]) extends AnyVal
|
|||||||
def observableSize = ObservableSized.toObservable(obs)
|
def observableSize = ObservableSized.toObservable(obs)
|
||||||
|
|
||||||
def observeFiltered(predicate: A => Boolean) = {
|
def observeFiltered(predicate: A => Boolean) = {
|
||||||
new transformation.FilteredBuffer(obs, predicate)
|
new FilteredBuffer(obs, predicate)
|
||||||
}
|
}
|
||||||
/* The dummy implicit is here to ensure the `observeFiltered` methods all have different post-erasure types */
|
/* The dummy implicit is here to ensure the `observeFiltered` methods all have different post-erasure types */
|
||||||
def observeFiltered[B >: A](predicate: ObservableValue[JPredicate[B], JPredicate[B]])(implicit dummy: DummyImplicit): FilteredBuffer[A] = {
|
def observeFiltered[B >: A](predicate: ObservableValue[JPredicate[B], JPredicate[B]])(implicit dummy: DummyImplicit): FilteredBuffer[A] = {
|
||||||
val fb = new transformation.FilteredBuffer(obs)
|
val fb = new FilteredBuffer(obs)
|
||||||
fb.predicate <== predicate
|
fb.predicate <== predicate
|
||||||
fb
|
fb
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user