This page is no longer maintained — Please continue to the home page at www.scala-lang.org

"Scala FX" and properties

3 replies
Walter Smith
Joined: 2009-05-13,
User offline. Last seen 1 year 39 weeks ago.

Hi!

did I understand it correctly, that Scala couldn't be used as a direct
alternative to Java FX Script? I think that Scala is powerful enough so it
should be possible to wrap properties into a class that allows you to bind
them; i.e. when one property of one object changes (e.g. a check box is
toggled) then another property of a different object changes as well (e.g. a
boolean property of a business model object). In Java FX Script, this
feature is a very fundamental part of the language, automatically enabled
for all properties, but not so in Scala.

Scala has so many powerful and simplifying features, so I think this would
suit it perfectly.

Kind regards
Walter

Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
"Scala FX" and properties

Did you see the ScalaFX project? It's pretty ambitious.
I'm sure its author wouldn't mind if you download it and try to fix some bugs. :) But you have to use -Xexperimental.
I did start working on a more basic property/animation framework.

-----Original Message-----
From: Walter Smith
Sent: Sunday, June 21, 2009 1:32 AM
To: scala-debate [at] listes [dot] epfl [dot] ch
Subject: [scala-debate] "Scala FX" and properties

Hi!

did I understand it correctly, that Scala couldn't be used as a direct
alternative to Java FX Script? I think that Scala is powerful enough so it
should be possible to wrap properties into a class that allows you to bind
them; i.e. when one property of one object changes (e.g. a check box is
toggled) then another property of a different object changes as well (e.g. a
boolean property of a business model object). In Java FX Script, this
feature is a very fundamental part of the language, automatically enabled
for all properties, but not so in Scala.

Scala has so many powerful and simplifying features, so I think this would
suit it perfectly.

Kind regards
Walter

Scot McSweeney-...
Joined: 2009-06-22,
User offline. Last seen 42 years 45 weeks ago.
"Scala FX" and properties
> did I understand it correctly, that Scala couldn't be used as a direct alternative to Java FX Script?
I think there are a couple of problems with using Scala as direct alternative to JavaFXScript. The biggest problem I can think of (and which affects both desktop and mobile JavaFX profiles) is that there doesn't appear to be any documentation for how Java code can access the JavaFX runtime. I haven't been able to find any such docs, but if they existed then it might be possible to just use Scala in place of Java, at least on the desktop. The mobile profile presents even more of a challenge as it's meant to run on top of JavaME. I don't think Scala has ever worked on JavaME (I could be wrong, but that was the last thing I heard) and if 2.8 is dropping JDK 1.4 support then it certainly won't be possible.
>  I think that Scala is powerful enough so it should be possible to wrap properties into a class that allows you to bind them; i.e. when one property of one object changes (e.g. a check box is toggled) then another property of a different object changes as well (e.g. a boolean property of a business model object). In Java FX Script, this feature is a very fundamental part of the language, automatically enabled for all properties, but not so in Scala. 
I haven't been able to replicate JavaFXScript's binding style in Scala - no matter what I try the variable/value on the LHS of the bind takes the value of the variable on the RHS at the time of binding and never changes. Maybe somebody else can come up with a way to do it - if so I'd love to see how to do it, as I'm stumped. And that was just variable binding - bound functions and replace triggers are probably even more of challenge. To be honest though, I haven't yet found any real use for JavaFXScript's data binding - but that could be because the docs don't really show it being used in any meaningful way.
As an aside, I really wish the JavaFXScript developers would have used Scala style syntax for things like vals (which in JavaFXScript are "def"s) and traits (which are defined by preceding class with "mixin"), had made semicolons optional and had used any other syntax than the one chosen for appending values to sequences ("insert x into xs;" - yuck). Had they done so, then JavaFXScript might have been a good stepping stone to Scala. 
imaier
Joined: 2008-07-01,
User offline. Last seen 23 weeks 2 days ago.
Re: "Scala FX" and properties

Naftoli Gugenheim wrote:
> Did you see the ScalaFX project? It's pretty ambitious.
> I'm sure its author wouldn't mind if you download it and try to fix some bugs. :) But you have to use -Xexperimental.
> I did start working on a more basic property/animation framework.

May I ask what you need that could not be supplied by sfx?

Thanks

Ingo

>
> -----Original Message-----
> From: Walter Smith
> Sent: Sunday, June 21, 2009 1:32 AM
> To: scala-debate [at] listes [dot] epfl [dot] ch
> Subject: [scala-debate] "Scala FX" and properties
>
>
> Hi!
>
> did I understand it correctly, that Scala couldn't be used as a direct
> alternative to Java FX Script? I think that Scala is powerful enough so it
> should be possible to wrap properties into a class that allows you to bind
> them; i.e. when one property of one object changes (e.g. a check box is
> toggled) then another property of a different object changes as well (e.g. a
> boolean property of a business model object). In Java FX Script, this
> feature is a very fundamental part of the language, automatically enabled
> for all properties, but not so in Scala.
>
> Scala has so many powerful and simplifying features, so I think this would
> suit it perfectly.
>
> Kind regards
> Walter

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland