Java 8.0_u40 with many additions to JavaFX was released yesterday,
including Spinner, TextFormatter, and dialogs. Most of those are
already wrapped on SFX8u40 branch. It could be released as
8.0.40-R8.
One thing that I am not completely happy is the implementation for
`Dialog[R].showAndWait()`. JavaFX version returns `Optional[R]`,
ScalaFX implementation returns `Option[S]`. Type R is sometimes a
JavaFX type. The implementation attempts to convert, when needed,
the JavaFX type `R` to ScalaFX type `S`. This kind of works, but the
returned type is not clean, it contains reference to implementation
details. For instance, for `Dialog[String]`, `showAndWait()` should
return `Option[String]` but it returns `Option[DConvert[String,
(String) => Nothing]#S]`, it can be casted to `Option[String]`:
`dialog.showAndWait().asInstanceOf[Option[String]]`
but that is kind of ugly. Note it works OK with `Alerts`, so the
main issue is with custom dialogs. Without casting, matching on
dialog result does not always behaves as expected, something like
val selectedItem = dialog.showAndWait()
//.asInstanceOf[Option[String]]
selectedItem match {
case Some(s) => processString(s)
case None =>
}
will not compile when `
processString(s:String)` needs
`String` argument, though it curiously works
in
some cases.
Help needed here from a Scala types guru :)
I may just release it as is for now, since most of other new 8.0_u40
works fine, only `Dialog[R].showAndWait()` is shaky in custom
dialogs . Thoughts?
Jarek