I've got at least a start at a jsr223 script engine I've written to use
JavaFX from Ringo - I'm calling it RingoFX :).
It's working pretty well on a simple example - maybe kind of neat if JavaFX
ever gains some traction. I'm using it along with the new JavaFX Scene
Builder where you can drag/drop your UI design, but instead of java for the
"controllers" I'm using Ringo (CommonJS) modules.
But I'm struggling a bit with a second example where I was attempting to
convert this iTunes search UI over to Ringo:
http://www.oracle.com/technetwork/articles/java/expressfx-1665720.html
My code is failing to resolve types when I'm calling into java methods from
Ringo.
e.g. Here's some (abbreviated but) pretty simple code that's creating a
javaFX "ImageView" to use a graphic on the search button:
importClass(Packages.javafx.scene.image.Image);
importClass(Packages.javafx.scene.image.ImageView);
var searchImageView = new ImageView(new
Image(getResource("magnifier.png").inputStream));
view.searchButton.graphic = searchImageView;
And I can see in the debugger this is all working fine until that last line
(view.searchButton.graphic = searchImageView;) where it gives the error:
org.mozilla.javascript.EvaluatorException: Cannot convert
ImageView@37806b to javafx.scene.Node.
In that line I've just made this "setGraphic(Node)" into the javascript
style ".graphic = X" form:
http://docs.oracle.com/javafx/2/api/javafx/scene/control/Labeled.html...
But just to make sure that's not the problem, I switch that line to the
standard form i.e.:
view.searchButton.setGraphic(searchImageView);
But I get the similar just slightly different error as follows:
org.mozilla.javascript.EvaluatorException: Can't find method
javax.scene.control.Labeled.setGraphic(javax.scene.image.ImageView)
In the debugger I double checked the types e.g.:
% view.searchButton.class.name
javafx.scene.control.Button
% searchImageView.class.name
javafx.scene.image.ImageView
So I feel like it's a failure to recognize ImageView "isa" Node. But I
don't know why - ImageView directly extends javafx.scene.Node as seen here:
http://docs.oracle.com/javafx/2/api/javafx/scene/image/ImageView.html
So no "conversion" should be needed(?)
If it matters I should mention too that I saw the post about the issue with
JavaAdapter in Rhino 1.7R4:
https://groups.google.com/forum/?hl=en&fromgroups#!search/JavaAdapter...
And I am using the rhino-1.7R5-SNAPSHOT.jar with Ringo. So I don't think
that's the problem...