Introduce new SimpleProperty alias.

This commit is contained in:
Sarah Gerweck 2015-04-15 21:05:38 -07:00
parent a9f4085786
commit 2e002336b4
2 changed files with 4 additions and 3 deletions

View File

@ -15,7 +15,7 @@ import scalafx.beans.property._
* @author Sarah Gerweck <sarah@atscale.com> * @author Sarah Gerweck <sarah@atscale.com>
*/ */
trait PropertyBuilder[A] { trait PropertyBuilder[A] {
type Prop <: Property[A, _] type Prop <: SimpleProperty[A]
def makeNew(default: A): Prop def makeNew(default: A): Prop
} }
@ -52,7 +52,7 @@ object PropertyBuilder extends PropertyBuilderLP {
def makeNew(default: String) = StringProperty(default) def makeNew(default: String) = StringProperty(default)
} }
def apply[A](default: A)(implicit builder: PropertyBuilder[A]): Property[A, _] = { def apply[A](default: A)(implicit builder: PropertyBuilder[A]): SimpleProperty[A] = {
builder.makeNew(default) builder.makeNew(default)
} }
} }

View File

@ -19,6 +19,7 @@ import Scalaz._
*/ */
package object util { package object util {
type Observable[A] = ObservableValue[A, _] type Observable[A] = ObservableValue[A, _]
type SimpleProperty[A] = Property[A, _]
implicit val observableApplicative = new Applicative[Observable] { implicit val observableApplicative = new Applicative[Observable] {
def point[A](a: => A): Observable[A] = { def point[A](a: => A): Observable[A] = {
@ -48,7 +49,7 @@ package object util {
} }
} }
implicit class RichProperty[A](val inner: Property[A, _]) extends AnyVal { implicit class RichProperty[A](val inner: SimpleProperty[A]) extends AnyVal {
def biMap[B <: AnyRef](push: A => B, pull: B => A): ObjectProperty[B] = { def biMap[B <: AnyRef](push: A => B, pull: B => A): ObjectProperty[B] = {
val original = push(inner.value) val original = push(inner.value)
val op = ObjectProperty[B](original) val op = ObjectProperty[B](original)