pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandro Martini <sandro.mart...@gmail.com>
Subject Re: Using pivot *from* JVM-based scripting languages
Date Fri, 04 Jan 2013 15:29:39 GMT
Hi Maarten,

> Thank you for the warm welcome to Pivot.
:-)

> I've ran through the examples you mentioned, and have been able to create
> a Hello World example in Groovy with Pivot.
good


> I am confused about some things however:
>
> First, I don't like the fact that it seems to be necessary to write your
> logic in a class that extends/implements Application. My programs are more
> than just a GUI and using this kind of naming/method suggest that everything
> is centered around the application. I suspect that this is partly because
> you're trying to hide the logic of initializing the graphics subsystem/awt
> as well as trying to hide the event loop.
yes, even because changing only the launcher class we can execute our
code as a Desktop application (DesktopApplicationContext) and as an
Applet (BrowserApplicationContext).
But to simplify a little, your classes could do like in this:
JavascriptConsoleTest extends Application.Adapter
And of course because graphics things must run in the right Thread.

> There's other ways that that could be done however.
yes, and of course if you have siggestions ...
Probably Groovy can further simplify things.


> I'm also still confused about pivot Windows. These seem to be a strange mix
> between a 'virtual desktop' and an actual window, eg if I extend a Hello
> World example with "window.setPreferredSize(200,500)" I'm getting strange
> results. The *window* isn't resized, but the way the Label is displayed
> inside the window is affected by this. Manually resizing the window by
> dragging the bottom right corner on the other hand seems to be have just as
> you would expect.
I understand, I try to explain:
- Window is a Top-level container representing the entry point into a
user interface.
    Windows are direct descendants of the display.
- otherwise for a typical desktop application you could use: Frame
(which extends Window) has an empty menu bar, etc ...

Anyway, if you need more primary window, here you should find some info:
http://apache-pivot-users.399431.n3.nabble.com/How-to-open-two-windows-td2022668.html
  -- and probably that feature has never been explored so much ...
and for the resize:
http://mail-archives.apache.org/mod_mbox/pivot-user/201104.mbox/%3C9C89B3FB-E539-4585-8908-4CFCE0050CCB@verizon.net%3E

Last, to open more windows (like a Window and an Alert), in some cases
you should instead use the following extension of Pivot:
http://code.google.com/a/apache-extras.org/p/pivot-contrib/wiki/GuretzkiFeatures
  -- this was a candidate to be included in Pivot core (2.1 or later),
but we have to hear from the original author, get an ICLA from he, do
a vote, etc ...

> Finally, and I don't know if this is a bug or not, but if I create 2 windows
> and call window.close() on one of them, pivot closes both windows instead
> and my application exits.
for this I have to look ... but for previous reasons I don't think it's a bug.
Roger, have you never seen this ?


> Let me give you an example of what I'd ideally would expect from using a
> windowing toolkit from Groovy. First of all, it wouldn't use XML to define
> the GUI layout. I know that in the Java world such an approach makes sense
> because Java code would get very verbose and it's not very good in showing
> the hierarchical relationships of the various GUI components. However in
> Groovy there's another way of addressing that, and that's by creating a
> Domain Specific Language by writing a so-called "Builder". Assuming we'd
> have a "PivotBuilder" in groovy, the equivalent of
> ...
yes, I agree that a more modern way is to use DSL to make those things
(I'm a great fan of Scala, great even for this kind of things), but
hadn't time to try. There are some experimental projects both from
Groovy and Scala, targeting JavaFX ... so why not in Pivot ? :-)

> That's a first approximation of what a PivotBuilder in groovy could look
> like, heavily inspired by how the exist SwingBuilder (and to a lesser extend
> the SwtBuilder) work.
yes, could be good ... I know that the great Griffon framework has a
Pivot Builder, but don't know if it's still updated.

> On the implementation side of such a PivotBuilder, I don't have any specific
> ideas yet. I know I don't particularly like using DesktopApplicationContext,
> it doesn't seem to fit the model very well to me (but again I need to look
> deeper into this). So any suggestions would be appreciated.
ok, but I know very little on Groovy Builders, probably it would be
better for us to update on this after some study time :-) ...

> Just to let you know upfront as well, I'm interested in this (provided I can
> get over the first technical hurdle of how to just simply open a darn
> window), but I can't spend much time on this. Work doesn't allow it, and at
> home I can probably only get a few hours per weekend on this, maybe an hour
> here or there during the week.
Don't worry, I'm busy a lot as you, so things are always longer, but
for me it's not a problem ...

Note that if you want, I could grant you write access to one of our
secondary projects (like a sandbox) for example here:
http://code.google.com/a/apache-extras.org/p/pivot-contrib/
and work in a dedicated subproject (I can do the initial setup of an
eclipse project (you like pivot-groovy-builder ?) with Groovy support,
and references to latest released Pivot jars). I only need your Google
account name (and of course you have to follow usual rules for open
source software at Apache), you can send me via private email if you
want.
So we could make some experiments there and maybe see later what to do
with that code.

Let's update.

Bye,
Sandro

Mime
View raw message