A short while ago I uploaded a new beta of BSF4ooRexx to Sourceforge:
<https://sourceforge.net/projects/bsf4oorexx/files/beta/20161026/BSF4ooRexx_install_v600-20161124-beta.zip/download>.

The new major version number 6.00 (represented as "600") indicates that this 
version needs Java
1.6/6 as a minimum (currently Java 1.8/8 is current).

One major new feature is full support for JavaFX, which is a Java class library 
that comes with Java
since Java 1.7/7. This means that if you have Java installed on your computer 
you will be
immediately able to run the samples in the BSF4ooRexx-directory 
"samples/JavaFX".

One nice feature about JavaFX is the ability to create the GUI with the help of 
a tool named
"SceneBuilder" available for all platforms. The code for SceneBuilder comes 
from Oracle but without
an installer, so if you point your browser to 
<http://gluonhq.com/labs/scene-builder/> you will get
installation packages for all platforms. This tool will also pack applications 
in a jar-file (a
"Java" archive file).

This beta of BSF4ooRexx contains nutshell examples that can be run "in the 
wild", no need to package
them in a jar. Please note that quite some effort was put into creating 
"standalone" Rexx programs
using JavaFX classes without any XML definitions. OTOH, its subdirectories 
contain XML-based
GUI-definition files that are used with the help of JavaFX, which you can 
compare 1:1 with the
"standalone" versions.

The Rexx programs serving as the controllers for the XML-GUI-definition file 
(e.g. created and
maintained with the help of the SceneBuilder) are being invoked by Java using 
the Rexx scripting
interface for Java (new in BSF4ooRexx, presented at the last International Rexx 
symposium in Tampa
this past August). The JavaFX instrumentation does only invoke the script 
programs by means of
calling them without arguments. For that reason it is necessary (added support 
for that) to interact
with Java ScriptContext which manages two collections of attributes (named 
"Bindings"):
"GLOBAL_SCOPE" entries are available to all script engines, and "ENGINE_SCOPE" 
which are related to
a certain script engine (ooRexx in this case). To make it simple for ooRexx 
programmers fetching
entries from the ScriptContext there is a "Rexx script annotation" introduced, 
which must be
contained in a Rexx block-comment on one line. As each GUI-element in the 
XML-file that has a unique
"fx:id" value is placed into the ScriptContext by JavaFX, one can fetch those 
entries (get access
e.g. to a Button, a Label, a TextField etc.) from there. The "Rexx script 
annotation" allows one to
a) fetch any such object and b) make it immediately available as a local Rexx 
variable (!) such that
you can use it right after that annotation. An example would be something like:

    ... cut ...
    /* @get("label button") */
    say "label:" label~getText
    say "button:" button~getText
    ... cut ...

For debugging purposes there is also a Rexx script annotation named 
"/*@showsource*/" which will
cause the Java Rexx script engine to display the Rexx source code as seen by 
Java. If there are Rexx
script annotations of the form "/*@get("attr1 attr2... ")*/" or "/*@set("attr1 
attr2... ")*/" then
the edited version of the same Rexx source code will be shown that will get 
executed by ooRexx. (The
@get and @set annotations will cause ooRexx code to be injected in front of it, 
so with the
@showsource annotation you will be able to see what code gets injected.)

There are many tutorials available for JavaFX (use the word "JavaFX").

If you have never worked with GUIs on Java (the founding principles are the 
same as in all GUI
programming on all platforms), then it might be helpful, if you first skim over 
"swing" tutorials
(e.g. excellent Oracle resource: 
<https://docs.oracle.com/javase/tutorial/uiswing/TOC.html>, or
<http://www.java2s.com/Tutorials/Java/Java_Swing/index.htm>), which is 
superceded by JavaFX. There
are many interesting explanations and showcases for swing on the net, which 
concepts you can take
over to JavaFX.

Here another nice place with examples that can be easily transcribed to ooRexx 
after studying the
nutshell programs in "samples/JavaFX": 
<http://www.java2s.com/Tutorials/Java/JavaFX/index.htm> and
<http://www.java2s.com/Tutorials/Java/JavaFX_How_to/index.htm>.

In the case that you explore this option (it may be an option also to 
eventually, over time forgo
ooDialog) and create short nutshell examples while experimenting with JavaFX 
that you think can
serve the community, then please post them! Also, if you want, I would be more 
than happy to add
JavaFX samples to the BSF4ooRexx distribution!

[Also, if you experiment with ooRexx and JavaFX then please consider of giving 
presentations on the
upcoming International Rexx Symposium in Amsterdam (probably from April 9th 
thru April 12th), from
introductions, nutshell examples and migrating from ooDialog to JavaFX or the 
like.]

If you have BSF4ooRexx related questions, then please post them to the 
BSF4ooRexx developer list on
Sourceforge, cf. 
<https://sourceforge.net/p/bsf4oorexx/mailman/bsf4oorexx-devel/>. If you find 
bugs
please file them at <https://sourceforge.net/p/bsf4oorexx/bugs/> with a short 
sample, if possible.

Have fun! :)

---rony


------------------------------------------------------------------------------
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to