You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Niclas Hedhman <ni...@hedhman.org> on 2011/11/14 04:49:37 UTC

Proposal "Pivot goes HTML5"

Gang,

I have been toying around with the idea of abstracting away the AWT
dependency in Pivot, and make that pluggable.

Why would you like to do that?

Well, my secondary target is to make Pivot run on GWT, so that we can have
Pivot applications running on HTML5 Canvas as well as AWT, and potentially
Android...

I think the Pivot+GWT+HTML5Canvas would be a killer feature. No one else
offers a windowing toolkit for HTML5+Java written in Java. Messing with
<div/> and CSS is fine, but not that nice when richer applications are
needed.

So for the GUI part of Pivot, we would end up with something like this;

+--------------------+
|     Application    |
+--------------------+
+--------------------+
|     Pivot API      |
+--------------+     |
+------------+ |     |
| Pivot Skin | |     |
+------------+ +-----+
+--------------------+
|     Pivot SPI      |
+--------------------+
+-----+ +------------+
| AWT | |    GWT     |
+-----+ +------------+
+-----+ +------------+
| JVM | | JavaScript |
+-----+ +------------+
        +------------+
        | HTML5      |
        +------------+
        +------------+
        | Browser    |
        +------------+

The refactorings needed to make this a reality are quite extensive, and the
GWT implementation is going to take some time as well. But I think it is a
reasonable scope and something that can gather quite a lot of new
contributors, plenty to scratch and revived interest in Pivot. As you
figured, it is not possible to keep compatibility with this change, so it
is fairly clear that the changes don't qualify for 2.1 ;-)


WDYT?


Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/6a2pl4j
I relax here; http://tinyurl.com/2cgsug

Re: Proposal "Pivot goes HTML5"

Posted by Greg Brown <gk...@verizon.net>.
> Just after the pluggable AWT backend I see even a pluggable JavaFX 2
> backend (if compatible by license) 

I don't think there would be any licensing issues, but there would definitely be an "impedance mismatch" here since JavaFX doesn't currently provide any public immediate-mode drawing API.


Re: Proposal "Pivot goes HTML5"

Posted by Sandro Martini <sa...@gmail.com>.
Hi Greg,

> FYI, the 3.0 code was removed because I was not legally allowed to contribute it. So unfortunately you won't be able to use that as a starting point.
Uh, sorry, but good to know.

Bye

Re: Proposal "Pivot goes HTML5"

Posted by Greg Brown <gk...@verizon.net>.
FYI, the 3.0 code was removed because I was not legally allowed to contribute it. So unfortunately you won't be able to use that as a starting point.

On Nov 16, 2011, at 8:47 AM, Sandro Martini <sa...@gmail.com> wrote:

> Hi Niclas,
> 
>> My work is visible on GitHub. niclash/pivot
> Ok, found here: https://github.com/niclash/pivot
> Note that searching on GitHub doesn't find it ...
> 
>>  1. The first cut on this is extremely crude. Brute force break things out.
>>  2. It doesn't compile yet.
> I imagine, it's a big task and not-so-simple.
> If can help, I remember a test commit in our svn of an experimental
> branch pivot3 (or similar) with a concept for a multi-backend inside,
> after has been deleted, but in the history you could find something
> useful.
> 
>>  3. Once AWT is isolated, the "interesting" refactoring needs to start, when everything is scrutinized and shaped into something we want to be proud of.
> After a quick look at it, how to you prefer we can communicate some
> feedback to you: via mail here, or other ?
> 
>>  4. The many small commits on trunk will be attended to sooner or later...
>>  5. When it compiles, and IF people here thinks it is worth while pursuing, I will move it into a SVN branch @ASF.
> Very good :-) ... but I think there is much interest on this.
> 
> @Users: send your voice to Niclas ...
> 
> Thanks for now.
> Sandro

Re: Proposal "Pivot goes HTML5"

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Wed, Nov 16, 2011 at 9:47 PM, Sandro Martini
<sa...@gmail.com> wrote:

>>  3. Once AWT is isolated, the "interesting" refactoring needs to start, when everything is scrutinized and shaped into something we want to be proud of.
> After a quick look at it, how to you prefer we can communicate some
> feedback to you: via mail here, or other ?

Here is fine...


Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/6a2pl4j
I relax here; http://tinyurl.com/2cgsug

Re: Proposal "Pivot goes HTML5"

Posted by Sandro Martini <sa...@gmail.com>.
Hi Niclas,

> My work is visible on GitHub. niclash/pivot
Ok, found here: https://github.com/niclash/pivot
Note that searching on GitHub doesn't find it ...

>  1. The first cut on this is extremely crude. Brute force break things out.
>  2. It doesn't compile yet.
I imagine, it's a big task and not-so-simple.
If can help, I remember a test commit in our svn of an experimental
branch pivot3 (or similar) with a concept for a multi-backend inside,
after has been deleted, but in the history you could find something
useful.

>  3. Once AWT is isolated, the "interesting" refactoring needs to start, when everything is scrutinized and shaped into something we want to be proud of.
After a quick look at it, how to you prefer we can communicate some
feedback to you: via mail here, or other ?

>  4. The many small commits on trunk will be attended to sooner or later...
>  5. When it compiles, and IF people here thinks it is worth while pursuing, I will move it into a SVN branch @ASF.
Very good :-) ... but I think there is much interest on this.

@Users: send your voice to Niclas ...

Thanks for now.
Sandro

Re: Proposal "Pivot goes HTML5"

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Wed, Nov 16, 2011 at 5:11 PM, Sandro Martini
<sa...@gmail.com> wrote:
> for sure Niclas can say something on this.
> At least you can start with some patch but I understand this is not
> the best ... but could be temporary.

For new people, patches is the way forward, big or small (preferred).
If they are really big (whole systems) then a Software Grant is
something that ASF wants to see as well. Sending in an ICLA is always
welcome, and a requirement before becoming a formal committer.

> Yes, but if Niclas has already do something on this, could be a great
> start point.

My work is visible on GitHub. niclash/pivot

 1. The first cut on this is extremely crude. Brute force break things out.
 2. It doesn't compile yet.
 3. Once AWT is isolated, the "interesting" refactoring needs to
start, when everything is scrutinized and shaped into something we
want to be proud of.
 4. The many small commits on trunk will be attended to sooner or later...
 5. When it compiles, and IF people here thinks it is worth while
pursuing, I will move it into a SVN branch @ASF.

Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/6a2pl4j
I relax here; http://tinyurl.com/2cgsug

Re: Proposal "Pivot goes HTML5"

Posted by Sandro Martini <sa...@gmail.com>.
Hi,

> I also like the idea (in fact, I was working also in something similar for android, using Apache Harmony sources). I think that I can help.
Very good, you are welcome :-) ... the problem we have now is that in
Apache, Committers have to sign the ICLA (see:
http://www.apache.org/dev/new-committers-guide.html ,
http://www.apache.org/dev/committers.html ). I don't remember if
before adding a new Committer we need a Vote, for sure Niclas can say
something on this.
At least you can start with some patch but I understand this is not
the best ... but could be temporary.

> My opinion is that GWT/HTML5 and Android are more important that JavaFX for now.
Yes, even in my opinion.
At least until Dart will be more mature ( http://www.dartlang.org/ ),
in Google vision seems that they want to write code in Dart and
generate Javascript (for GWT but not only) in the Browser now (and in
the future even run directly Dart as s scripting language inside
browsers).
And they are writing even a standalone VM, like our dear JVM ... let's
see in the future.
We could even think on a Dart porting for Pivot ...

> Maybe from JavaFX we can use the Prism engine,
I was trying to say this, but badly ...
> but in any case the first big and difficult step is split AWT (and maybe some other no AWT packages like StaX and bsf) from Pivot and create Pivot SPI.
Yes, but if Niclas has already do something on this, could be a great
start point.

Bye,
Sandro

Re: Proposal "Pivot goes HTML5"

Posted by DreamTangerine <dr...@hotmail.com>.
On mar, 2011-11-15 at 11:39 +0100, Sandro Martini wrote:
> Just after the pluggable AWT backend I see even a pluggable JavaFX 2
> backend (if compatible by license) ... could give us another vision on
> the future (and start playing with it).
> 

I also like the idea (in fact, I was working also in something similar
for android, using Apache Harmony sources). I think that I can help.

My opinion is that GWT/HTML5 and Android are more important that JavaFX
for now. Maybe from JavaFX we can use the Prism engine, but in any case
the first big and difficult step is split AWT (and maybe some other no
AWT packages like StaX and bsf) from Pivot and create Pivot SPI.



Re: Proposal "Pivot goes HTML5"

Posted by Sandro Martini <sa...@gmail.com>.
Hi Roger,

so maybe our 2.1 could become more a 2.5 release ... what do you think ?

> I think it's a great idea.  And it sounds like a Pivot 3.0 timeframe.
Great.

> I'm a little concerned, reading others' replies, about the "impedance mismatch" that Noel mentioned and Greg's concern about font metrics, but in general I think this is the "right way" to go (farther) forward.  The key thing for the short-term would be defining the "Pivot SPI" in your diagram and getting the existing AWT plugged into it, which it sounds like you are already working on.
> So, count me in.
For sure .-) .

Just after the pluggable AWT backend I see even a pluggable JavaFX 2
backend (if compatible by license) ... could give us another vision on
the future (and start playing with it).


So, Niclas, do you like the idea to work on it in a pivot3_branch by
copying existing trunk as a starting point (or if you prefer, start
with a clean branch) ?
And then move/copy there your changes ?


Bye

Re: Proposal "Pivot goes HTML5"

Posted by Roger and Beth Whitcomb <Ro...@rbwhitcomb.com>.
I think it's a great idea.  And it sounds like a Pivot 3.0 timeframe.

I'm a little concerned, reading others' replies, about the "impedance 
mismatch" that Noel mentioned and Greg's concern about font metrics, but 
in general I think this is the "right way" to go (farther) forward.  The 
key thing for the short-term would be defining the "Pivot SPI" in your 
diagram and getting the existing AWT plugged into it, which it sounds 
like you are already working on.

So, count me in.

~Roger Whitcomb

On 11/13/11 7:49 PM, Niclas Hedhman wrote:
> Gang,
>
> I have been toying around with the idea of abstracting away the AWT
> dependency in Pivot, and make that pluggable.
>
> Why would you like to do that?
>
> Well, my secondary target is to make Pivot run on GWT, so that we can have
> Pivot applications running on HTML5 Canvas as well as AWT, and potentially
> Android...
>
> I think the Pivot+GWT+HTML5Canvas would be a killer feature. No one else
> offers a windowing toolkit for HTML5+Java written in Java. Messing with
> <div/>  and CSS is fine, but not that nice when richer applications are
> needed.
>
> So for the GUI part of Pivot, we would end up with something like this;
>
> +--------------------+
> |     Application    |
> +--------------------+
> +--------------------+
> |     Pivot API      |
> +--------------+     |
> +------------+ |     |
> | Pivot Skin | |     |
> +------------+ +-----+
> +--------------------+
> |     Pivot SPI      |
> +--------------------+
> +-----+ +------------+
> | AWT | |    GWT     |
> +-----+ +------------+
> +-----+ +------------+
> | JVM | | JavaScript |
> +-----+ +------------+
>          +------------+
>          | HTML5      |
>          +------------+
>          +------------+
>          | Browser    |
>          +------------+
>
> The refactorings needed to make this a reality are quite extensive, and the
> GWT implementation is going to take some time as well. But I think it is a
> reasonable scope and something that can gather quite a lot of new
> contributors, plenty to scratch and revived interest in Pivot. As you
> figured, it is not possible to keep compatibility with this change, so it
> is fairly clear that the changes don't qualify for 2.1 ;-)
>
>
> WDYT?
>
>
> Cheers

Re: Proposal "Pivot goes HTML5"

Posted by Andrei Pozolotin <an...@gmail.com>.
wow, this is so cool!

-------- Original Message  --------
Subject: Proposal "Pivot goes HTML5"
From: Niclas Hedhman <ni...@hedhman.org>
To: pivot-dev@incubator.apache.org
Date: Sun 13 Nov 2011 09:49:37 PM CST
> Gang,
>
> I have been toying around with the idea of abstracting away the AWT
> dependency in Pivot, and make that pluggable.
>
> Why would you like to do that?
>
> Well, my secondary target is to make Pivot run on GWT, so that we can have
> Pivot applications running on HTML5 Canvas as well as AWT, and potentially
> Android...
>
> I think the Pivot+GWT+HTML5Canvas would be a killer feature. No one else
> offers a windowing toolkit for HTML5+Java written in Java. Messing with
> <div/> and CSS is fine, but not that nice when richer applications are
> needed.
>
> So for the GUI part of Pivot, we would end up with something like this;
>
> +--------------------+
> |     Application    |
> +--------------------+
> +--------------------+
> |     Pivot API      |
> +--------------+     |
> +------------+ |     |
> | Pivot Skin | |     |
> +------------+ +-----+
> +--------------------+
> |     Pivot SPI      |
> +--------------------+
> +-----+ +------------+
> | AWT | |    GWT     |
> +-----+ +------------+
> +-----+ +------------+
> | JVM | | JavaScript |
> +-----+ +------------+
>         +------------+
>         | HTML5      |
>         +------------+
>         +------------+
>         | Browser    |
>         +------------+
>
> The refactorings needed to make this a reality are quite extensive, and the
> GWT implementation is going to take some time as well. But I think it is a
> reasonable scope and something that can gather quite a lot of new
> contributors, plenty to scratch and revived interest in Pivot. As you
> figured, it is not possible to keep compatibility with this change, so it
> is fairly clear that the changes don't qualify for 2.1 ;-)
>
>
> WDYT?
>
>
> Cheers


Re: Proposal "Pivot goes HTML5"

Posted by Noel Grandin <no...@gmail.com>.
Hi

It sounds nice, but to be honest, as a UI developer for 20+ years now,
I've seen a lot of these multi-backend UI toolkit projects come and
go.
They normally start out with fanfare and then bog down quickly when
the realities of the difficulties of meshing several different
backends come to light.

They have several draw-backs
- they require a ton of work
- they have lots of problems with things that work with one backend
but not with another
- they suffer from impendance mismatch where the toolkit and the
back-end don't mesh well, frustrating developers
- they require multiple skill sets from the maintainers, which is not common

All that being said, don't let me stop you. I'd just prefer if the
work was done on a branch, where things can get worked before we
commit to such an approach.

Regards, Noel Grandin

On Mon, Nov 14, 2011 at 15:43, Sandro Martini <sa...@gmail.com> wrote:
> Hi all,
> I like the proposal from Niclas, the only problem I see now is to not
> separate our efforts in multiple developments, so none of our goals
> risk to be completed.
>
> For sure we need more developers to help us and/or to work on it.
>
> As Niclas I see (in my real-world experience) that currently Pivot
> suffer from the single (JVM only, and only on PC) target platform, so
> in my opinion a task like this is really important (we already have it
> for 3.0, but with our slow times could be too much).
>
> It someone of us is interested I think we could even open a new
> pivot-3 branch in main svn, or if someone other is interested maybe
> hosting the experimental repository in another public and shared place
> would be the best (to avoid Apache bureaucracy, at least for the
> beginning) like apache-extras or GitHub ...
>
> What do you think ?
>
> Bye,
> Sandro
>

Re: Proposal "Pivot goes HTML5"

Posted by Sandro Martini <sa...@gmail.com>.
Hi all,
I like the proposal from Niclas, the only problem I see now is to not
separate our efforts in multiple developments, so none of our goals
risk to be completed.

For sure we need more developers to help us and/or to work on it.

As Niclas I see (in my real-world experience) that currently Pivot
suffer from the single (JVM only, and only on PC) target platform, so
in my opinion a task like this is really important (we already have it
for 3.0, but with our slow times could be too much).

It someone of us is interested I think we could even open a new
pivot-3 branch in main svn, or if someone other is interested maybe
hosting the experimental repository in another public and shared place
would be the best (to avoid Apache bureaucracy, at least for the
beginning) like apache-extras or GitHub ...

What do you think ?

Bye,
Sandro

Re: Proposal "Pivot goes HTML5"

Posted by Greg Brown <gk...@verizon.net>.
This is actually something I had considered attempting myself a couple of years back. One challenge that you may run into is text measurement. HTML 5 does not provide a means for calculating font metrics. I emailed the HTML 5 working group about this a while back, but they did not have any plans to add it to the HTML 5 spec. Not sure if that has changed since. If not, you'll need to come up with some other way to determine font metrics. 

One possibility is to include a small binary in the runtime that will call into native platform methods to get font info. It may not be completely accurate since you won't know how the <canvas> tag is actually performing those calculations under the hood, but it might work.

On Nov 14, 2011, at 7:50 AM, Niclas Hedhman wrote:

> On Mon, Nov 14, 2011 at 4:38 PM, Chris Bartlett <cb...@gmail.com>wrote:
> 
>> I like the idea, but don't see it being feasible in terms of manpower
>> unless it is possible to attract the new contributors you mentioned.
>> 
> 
> Alright, I might be completely wrong, and that Pivot has a big enough
> niche, but from my perspective it is a 'hard sell' at the moment. It is not
> unique enough, compared to various other choices available. I think this
> could be "it"...
> 
> 
>> I imagine this new blood would have the HTML5/GWT/? knowledge but
>> there will obviously be a need for some experienced Pivot people to
>> commit time to this too. (Not necessarily current Pivot committers)
>> 
> 
> Ok, so what I have done over the last few weeks (probably a man-week in
> total), is to move AWT away from Pivot's internals and use its own
> abstraction for things like Color, Shape, Stroke... Then create a pluggable
> bridging mechanism so that you "install" a Platform, where AWT will be the
> first deliverable. I expect I can have this ready before end of this year.
> At that point, you have "Pivot AWT" pretty much same as Pivot is today. And
> I don't expect there to be 2 versions, but a single version that can run on
> multiple host systems.
> 
> 
> 
> Cheers
> -- 
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
> 
> I live here; http://tinyurl.com/3xugrbk
> I work here; http://tinyurl.com/6a2pl4j
> I relax here; http://tinyurl.com/2cgsug


Re: Proposal "Pivot goes HTML5"

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Mon, Nov 14, 2011 at 4:38 PM, Chris Bartlett <cb...@gmail.com>wrote:

> I like the idea, but don't see it being feasible in terms of manpower
> unless it is possible to attract the new contributors you mentioned.
>

Alright, I might be completely wrong, and that Pivot has a big enough
niche, but from my perspective it is a 'hard sell' at the moment. It is not
unique enough, compared to various other choices available. I think this
could be "it"...


> I imagine this new blood would have the HTML5/GWT/? knowledge but
> there will obviously be a need for some experienced Pivot people to
> commit time to this too. (Not necessarily current Pivot committers)
>

Ok, so what I have done over the last few weeks (probably a man-week in
total), is to move AWT away from Pivot's internals and use its own
abstraction for things like Color, Shape, Stroke... Then create a pluggable
bridging mechanism so that you "install" a Platform, where AWT will be the
first deliverable. I expect I can have this ready before end of this year.
At that point, you have "Pivot AWT" pretty much same as Pivot is today. And
I don't expect there to be 2 versions, but a single version that can run on
multiple host systems.



Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/6a2pl4j
I relax here; http://tinyurl.com/2cgsug

Re: Proposal "Pivot goes HTML5"

Posted by Chris Bartlett <cb...@gmail.com>.
On 14 November 2011 03:49, Niclas Hedhman <ni...@hedhman.org> wrote:
> ...
> The refactorings needed to make this a reality are quite extensive, and the
> GWT implementation is going to take some time as well. But I think it is a
> reasonable scope and something that can gather quite a lot of new
> contributors, plenty to scratch and revived interest in Pivot. As you
> figured, it is not possible to keep compatibility with this change, so it
> is fairly clear that the changes don't qualify for 2.1 ;-)
>
> WDYT?
>

I like the idea, but don't see it being feasible in terms of manpower
unless it is possible to attract the new contributors you mentioned.
I imagine this new blood would have the HTML5/GWT/? knowledge but
there will obviously be a need for some experienced Pivot people to
commit time to this too. (Not necessarily current Pivot committers)

Getting 2.0.1 out of the door has got to be the main priority right
now, but that could then serve as a good base for a branch to
experiment with idea.

I wouldn't like to see the limited time & resources of the current
Pivot dev team diluted by this if it means that the main dev branch
stagnates at 2.0.1 or 2.1, but I suppose that it is feasible that this
could bring in new developers and end up driving the 'classic' Pivot
along too.

Chris