diff --git a/src/main/scala/org/gerweck/scalafx/util/LowPriorityImplicits.scala b/src/main/scala/org/gerweck/scalafx/util/LowPriorityImplicits.scala new file mode 100644 index 0000000..cff9301 --- /dev/null +++ b/src/main/scala/org/gerweck/scalafx/util/LowPriorityImplicits.scala @@ -0,0 +1,15 @@ +package org.gerweck.scalafx.util + +import scala.language.implicitConversions + +import scalafx.beans.property._ + +trait LowPriorityImplicits { + implicit def scalaBooleanToBooleanProperty(ob: ReadOnlyObjectProperty[Boolean]): ReadOnlyBooleanProperty = { + val b = BooleanProperty(ob.value) + ob onChange { (_, oldV, newV) => + b.value = newV + } + b + } +} diff --git a/src/main/scala/org/gerweck/scalafx/util/package.scala b/src/main/scala/org/gerweck/scalafx/util/package.scala index c20a430..0e119ac 100644 --- a/src/main/scala/org/gerweck/scalafx/util/package.scala +++ b/src/main/scala/org/gerweck/scalafx/util/package.scala @@ -3,6 +3,7 @@ package org.gerweck.scalafx import language.implicitConversions import language.existentials +import scalafx.Includes._ import scalafx.beans.property._ import scalafx.beans.value._ import scalafx.event.subscriptions.Subscription @@ -19,7 +20,7 @@ import scalaz._ * * @author Sarah Gerweck */ -package object util extends ObservableImplicits { +package object util extends ObservableImplicits with LowPriorityImplicits { type Observable[A] = ObservableValue[A, _] type SimpleProperty[A] = Property[A, _]