New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap missing `Bindings.create*Binding` #232

Closed
jpsacha opened this Issue Feb 8, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@jpsacha
Member

jpsacha commented Feb 8, 2016

create*Binding methods allow creation binding of arbitrary expression created from any number of observable values.

Here is a possible wrapper for createStringBinding:

  def createStringBinding(op: () => String, values: Observable*): StringBinding = {

    jfxbb.Bindings.createStringBinding(
      new jfxuc.Callable[String] {
        override def call() = op()
      },
      values.map(_.delegate): _*)
  }

it allows writing code like, that creates binding that converts String property to lower case:

  val a = new StringProperty()
  val b = createStringBinding(() => Option(a.value).getOrElse("").toLowerCase(), a)

See also discussion at #231.

@jpsacha jpsacha added this to the 8.0.*-R10 milestone Feb 8, 2016

jpsacha added a commit that referenced this issue Apr 1, 2016

@jpsacha jpsacha added the enhancement label Apr 1, 2016

@jpsacha jpsacha closed this Apr 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment