Browse Source

updae for scala 2.13 changes

master
Michael D. McCray 1 year ago
parent
commit
7c00f26760
2 changed files with 13 additions and 8 deletions
  1. +1
    -1
      src/main/scala/org/gerweck/scalafx/akka/AkkaFXCollections.scala
  2. +12
    -7
      src/main/scala/org/gerweck/scalafx/util/observableCollection.scala

+ 1
- 1
src/main/scala/org/gerweck/scalafx/akka/AkkaFXCollections.scala View File

@ -2,7 +2,7 @@ package org.gerweck.scalafx.akka
import language.implicitConversions
import scala.collection.generic.{ Clearable, Growable }
import scala.collection.mutable.{ Clearable, Growable }
import scala.concurrent._
import scala.concurrent.duration._
import scala.util._

+ 12
- 7
src/main/scala/org/gerweck/scalafx/util/observableCollection.scala View File

@ -6,19 +6,24 @@ import java.util.function.{ Predicate => JPredicate }
import scalafx.beans.property._
import scalafx.beans.value._
import scalafx.collections._
import scalafx.collections.transformation._
import scalafx.collections.ObservableSet
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]
object ToFlatObservable extends CalculableObservable[ToFlatObservable[_, _]] {
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]] {
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]] {
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 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 */
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
}

Loading…
Cancel
Save