Re: [scalafx-users] Howto convert IntegerProperty to ObservableValue

485 views
Skip to first unread message

Piotr Tarsa

unread,
Sep 28, 2012, 5:43:20 AM9/28/12
to scalaf...@googlegroups.com
try to use the field "delegate" directly or import the "sfxIntegerProperty2jfx" implicit function from IntegerProperty object.

2012/9/27 ayvango <ayv...@gmail.com>
I'm trying to write cellValueFactory.

I've got error with naive method:

    [error]  found   : scalafx.beans.property.IntegerProperty
    [error]  required: javafx.beans.value.ObservableValue[Int]

What should I do to extract javafx obervablevalue from scalafx wrapper?

Piotr Tarsa

unread,
Sep 30, 2012, 3:39:16 PM9/30/12
to scalaf...@googlegroups.com
I haven't programmed in Scala for a long time (let alone ScalaFX), but I smell some API bug with generics. Though I could be wrong. As a workaround I suggest to make some explicit bindings, with the required parametrization.

2012/9/29 ayvango <ayv...@gmail.com>
I've tried to use delegate and got following error:

    [error]  found   : javafx.beans.property.IntegerProperty
    [error]  required: javafx.beans.value.ObservableValue[Int]

пятница, 28 сентября 2012 г., 13:43:20 UTC+4 пользователь Piotr Tarsa написал:

Piotr Tarsa

unread,
Oct 1, 2012, 10:44:27 AM10/1/12
to scalaf...@googlegroups.com
Yes, you're right. Even generics mechanism prohibits that. But ObservableValue interface doesn't exhibit setters.

Maybe you have applied @specialized annotation somewhere and that causes the problem?

Try making a subclass of IntegerBinding or ObjectBinding[Int] and see if that helps.

2012/10/1 ayvango <ayv...@gmail.com>
I may suggest that ObservableValue[Int] and ObservableValue[Number] is different kinds of observables. You can not cast first to second since, Number observable may be updated with Float value.

воскресенье, 30 сентября 2012 г., 23:39:17 UTC+4 пользователь Piotr Tarsa написал:
Reply all
Reply to author
Forward
0 new messages