pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandro Martini <sandro.mart...@gmail.com>
Subject Improve interaction with Scripting languages inside the JVM, starting from JavaScript
Date Fri, 17 Aug 2012 14:43:51 GMT
Hi all,
in last weeks I have committed under the tests subproject (both for
2.0.x maintenance branch, and trunk, for 2.1) a test application
called JavascriptConsole (JavascriptConsoleTest* and
javascript_console_test* files). It's more a test than a real
sample/demo now, but thanks to this I have made some small improvement
in the BXMLSerializer.
It's full of comments and many different tests because I'd like to
show different ways to do some kind of things, some working and some
not, as a sample (even to know how to not do things).


Now the reasons behind this: trying to show and improve interaction of
Pivot with Scripting languages inside the JVM.
In a world of HTML 5 webapps (and much more JavaScript than in past) I
think it's important for Pivot to start aligning better with this kind
of programming.

So a little more focus on JavaScript (in this case interpreted by the
JVM, and as soon as possible even other JVM scripting languages,
starting from Groovy, then maybe others), at least for quick
prototypes.
Inside this sample, I tried to show how to write a minimal amount of
Java code (ok, i know it's appliable only on smaller applications),
and have JS take control, but in a not-so-trivial dynamic application.
And show how from JS to load and display Pivot GUI Containers like
Frames and Windows, request data (like ajax query in html pages) and
then display it, using java methods if/when useful (better
debuggability, performances, etc).

Another test inside is to show how to interact with remote bxml files
(now static and in a folder of Pivot web site, but for example they
could be generated or simply hosted at server-side) and do all the
processing client side but in JS, more aligned to the HTML 5 way to do
things. In this way we could even start to have some parts of Pivot
applications hosted at server side.

And even the ability to get Resources from JS, for example to put
label values in JS variables, and even in Pivot components, but all
from the JS side.

Last, the Console (but still not working, didn't have time for it now)
to show that thanks to the dynamic nature of JS we could write code in
the text area and run it directly ... Ok, all things already seen, but
not in Pivot :-) .

If possible, for a future release (could be 2.1, or maybe later) I'd
like to put a polished version of it under tutorials, or under demos
...

For a quick look, see here:
http://svn.apache.org/repos/asf/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/
or
http://svn.apache.org/repos/asf/pivot/trunk/tests/src/org/apache/pivot/tests/


Do you think it's something that needs further
documentation/samples/exploration in Pivot ?
For suggestions and comments we are here ...


Bye,
Sandro

Mime
View raw message