Browse Source

Allow javafx to be run.

The current version of openjfx has a requirement
that beans are defined with their types in
the format <bean-name>:<class-name>
Hopefully, this will change, in the meantime
this hack allows openjfx scripts to be run
in ant as follows:
  <script language="FX" manager="javax">
    <classpath>
      <fileset dir="${user.home}/apps/openjfx/trunk/lib"/>
    </classpath>
import javafx.ui.*;
		
     Frame {
            title: "hello"
            width: 200
            height: 50
            content: Label {
                text: "Hello World"
            }
            visible: true
     }
  </script>



git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@537194 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
f18d4b424d
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java

+ 10
- 2
src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java View File

@@ -90,8 +90,16 @@ public class JavaxScriptRunner extends ScriptRunnerBase {
for (Iterator i = getBeans().keySet().iterator(); i.hasNext();) {
String key = (String) i.next();
Object value = getBeans().get(key);
engine.invoke(
"put", String.class, key, Object.class, value);
if ("FX".equals(getLanguage())) {
engine.invoke(
"put", String.class, key
+ ":" + value.getClass().getName(),
Object.class, value);
} else {
engine.invoke(
"put", String.class, key,
Object.class, value);
}
}
// execute the script
return engine.invoke("eval", String.class, getScript());


Loading…
Cancel
Save