You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Scott Baxter <sc...@gmail.com> on 2010/02/23 20:12:37 UTC
Rich Text (HTML) Display
Has anyone tried to display HTML inside of Pivot? If so, what route did you
take? Do Swing components behave properly inside of Pivot containers?
Re: Rich Text (HTML) Display
Posted by Greg Brown <gk...@mac.com>.
I think the "HTML provider" model would work better anyways. Less messy, more functional. :-)
On Feb 23, 2010, at 4:22 PM, Todd Volkert wrote:
> FYI, I tried to get Swing components able to drop into Pivot apps back in the day via a SwingAdapter component. It *almost* worked :)
>
> On Tue, Feb 23, 2010 at 4:18 PM, Greg Brown <gk...@mac.com> wrote:
>> On Tue, Feb 23, 2010 at 3:46 PM, Greg Brown <gk...@mac.com> wrote:
>> Good question. I neglected to mention in my previous post there is currently no way to embed Swing components in a Pivot app. However, you might be able to wrap a JTextPane in a custom Pivot component and delegate paint() calls to it. Alternatively, there may be some lower-level Swing text rendering APIs you could delegate to and bypass JTextPane altogether.
>>
>> OK, one last (probably obvious) question: Why might flying saucer work better with Pivot? I assume that it is not based on Swing? Does it use SWT or something else that plays well with Pivot? Again, I apologize for the basic questions, I have almost no Java GUI experience.
>
> Like Swing, Pivot uses Java2D for rendering. However, Pivot doesn't doesn't depend on or extend Swing, so it's not especially straightforward to drop a Swing component into a Pivot app. I haven't looked into Flying Saucer in any great detail, but I imagine that it renders directly to Java2D, which would make it a lot easier to embed in a Pivot app. We did something similar with JFreeChart:
>
> http://code.google.com/p/pivot-jfree/
>
> We can't include JFreeChart in the Pivot distribution for the same reason we can't have a dependency on Flying Saucer. However, it would be possible to write a bridge library to Flying Saucer similar to what we did for JFreeChart...that is definitely worth considering.
>
> G
>
>
>
Re: Rich Text (HTML) Display
Posted by Todd Volkert <tv...@gmail.com>.
Hi Scott,
As I recall, there was really only one big sticking point, and that was that
some Swing components painted directly to the display, which wreaked havoc
with Pivot's own paint() calls. Basically, it caused paint artifacts since
the Pivot components weren't notified that they needed to repaint. For some
Swing components, it worked perfectly, so if you have a specific use case in
mind, it may suit your needs.
The last that SwingAdapter saw the light of day was in Pivot 1.0.1, so you
can see it in the tags folder:
http://svn.apache.org/repos/asf/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SwingAdapter.java
http://svn.apache.org/repos/asf/pivot/tags/v1.0.1/wtk/src/pivot/wtk/SwingAdapterListener.java
Cheers,
-T
On Tue, Feb 23, 2010 at 4:49 PM, Scott Baxter <sc...@gmail.com>wrote:
> Todd,
>
> What were the sticking points with the Swing adapter? It seems like a
> Swing adapter would add a lot of extensibility to Pivot that may be needed
> as it grows. Specifically, there is a commercial Swing component (Ephox
> LiveEdit) that I'd like to integrate into the content management type app
> I'm prototyping now in Pivot. I'm sure other potential Pivot developers
> have other Swing components they'd like to integrate as well. At the
> moment, I'm afraid once I move to the implementation stage, I might have to
> switch back to a JavaScript framework, which I'd really like to get away
> from.
>
> Is your SwingAdapter code available for me (or anyone else) to look at as a
> starting point? (Not that I'd put much confidence in my ability to get it
> to work if you haven't had any success.)
>
> Scott
>
Re: Rich Text (HTML) Display
Posted by Scott Baxter <sc...@gmail.com>.
Todd,
What were the sticking points with the Swing adapter? It seems like a Swing
adapter would add a lot of extensibility to Pivot that may be needed as it
grows. Specifically, there is a commercial Swing component (Ephox LiveEdit)
that I'd like to integrate into the content management type app I'm
prototyping now in Pivot. I'm sure other potential Pivot developers have
other Swing components they'd like to integrate as well. At the moment, I'm
afraid once I move to the implementation stage, I might have to switch back
to a JavaScript framework, which I'd really like to get away from.
Is your SwingAdapter code available for me (or anyone else) to look at as a
starting point? (Not that I'd put much confidence in my ability to get it
to work if you haven't had any success.)
Scott
Re: Rich Text (HTML) Display
Posted by Todd Volkert <tv...@gmail.com>.
FYI, I tried to get Swing components able to drop into Pivot apps back in
the day via a SwingAdapter component. It *almost* worked :)
On Tue, Feb 23, 2010 at 4:18 PM, Greg Brown <gk...@mac.com> wrote:
> On Tue, Feb 23, 2010 at 3:46 PM, Greg Brown <gk...@mac.com> wrote:
>
>> Good question. I neglected to mention in my previous post there is
>> currently no way to embed Swing components in a Pivot app. However, you
>> might be able to wrap a JTextPane in a custom Pivot component and delegate
>> paint() calls to it. Alternatively, there may be some lower-level Swing text
>> rendering APIs you could delegate to and bypass JTextPane altogether.
>>
>
> OK, one last (probably obvious) question: Why might flying saucer work
> better with Pivot? I assume that it is not based on Swing? Does it use SWT
> or something else that plays well with Pivot? Again, I apologize for the
> basic questions, I have almost no Java GUI experience.
>
>
> Like Swing, Pivot uses Java2D for rendering. However, Pivot doesn't doesn't
> depend on or extend Swing, so it's not especially straightforward to drop a
> Swing component into a Pivot app. I haven't looked into Flying Saucer in any
> great detail, but I imagine that it renders directly to Java2D, which would
> make it a lot easier to embed in a Pivot app. We did something similar with
> JFreeChart:
>
> http://code.google.com/p/pivot-jfree/
>
> We can't include JFreeChart in the Pivot distribution for the same reason
> we can't have a dependency on Flying Saucer. However, it would be possible
> to write a bridge library to Flying Saucer similar to what we did for
> JFreeChart...that is definitely worth considering.
>
> G
>
>
>
Re: Rich Text (HTML) Display
Posted by Greg Brown <gk...@mac.com>.
> On Tue, Feb 23, 2010 at 3:46 PM, Greg Brown <gk...@mac.com> wrote:
> Good question. I neglected to mention in my previous post there is currently no way to embed Swing components in a Pivot app. However, you might be able to wrap a JTextPane in a custom Pivot component and delegate paint() calls to it. Alternatively, there may be some lower-level Swing text rendering APIs you could delegate to and bypass JTextPane altogether.
>
> OK, one last (probably obvious) question: Why might flying saucer work better with Pivot? I assume that it is not based on Swing? Does it use SWT or something else that plays well with Pivot? Again, I apologize for the basic questions, I have almost no Java GUI experience.
Like Swing, Pivot uses Java2D for rendering. However, Pivot doesn't doesn't depend on or extend Swing, so it's not especially straightforward to drop a Swing component into a Pivot app. I haven't looked into Flying Saucer in any great detail, but I imagine that it renders directly to Java2D, which would make it a lot easier to embed in a Pivot app. We did something similar with JFreeChart:
http://code.google.com/p/pivot-jfree/
We can't include JFreeChart in the Pivot distribution for the same reason we can't have a dependency on Flying Saucer. However, it would be possible to write a bridge library to Flying Saucer similar to what we did for JFreeChart...that is definitely worth considering.
G
Re: Rich Text (HTML) Display
Posted by Scott Baxter <sc...@gmail.com>.
On Tue, Feb 23, 2010 at 3:46 PM, Greg Brown <gk...@mac.com> wrote:
> Good question. I neglected to mention in my previous post there is
> currently no way to embed Swing components in a Pivot app. However, you
> might be able to wrap a JTextPane in a custom Pivot component and delegate
> paint() calls to it. Alternatively, there may be some lower-level Swing text
> rendering APIs you could delegate to and bypass JTextPane altogether.
>
OK, one last (probably obvious) question: Why might flying saucer work
better with Pivot? I assume that it is not based on Swing? Does it use SWT
or something else that plays well with Pivot? Again, I apologize for the
basic questions, I have almost no Java GUI experience.
Re: Rich Text (HTML) Display
Posted by Greg Brown <gk...@mac.com>.
Good question. I neglected to mention in my previous post there is currently no way to embed Swing components in a Pivot app. However, you might be able to wrap a JTextPane in a custom Pivot component and delegate paint() calls to it. Alternatively, there may be some lower-level Swing text rendering APIs you could delegate to and bypass JTextPane altogether.
On Feb 23, 2010, at 3:37 PM, Scott Baxter wrote:
> On Tue, Feb 23, 2010 at 2:19 PM, Greg Brown <gk...@mac.com> wrote:
> It is not currently supported. You might take a look at the Flying Saucer library. I have not used it myself, but it seems promising. Note that it is LGPL and therefore not compatible with the Apache License:
>
> https://xhtmlrenderer.dev.java.net/
>
> Looks like it might work. For simple HTML rendering, why do you recommend this over JTextPane?
Re: Rich Text (HTML) Display
Posted by Scott Baxter <sc...@gmail.com>.
On Tue, Feb 23, 2010 at 2:19 PM, Greg Brown <gk...@mac.com> wrote:
> It is not currently supported. You might take a look at the Flying Saucer
> library. I have not used it myself, but it seems promising. Note that it is
> LGPL and therefore not compatible with the Apache License:
>
> https://xhtmlrenderer.dev.java.net/
Looks like it might work. For simple HTML rendering, why do you recommend
this over JTextPane?
Re: Rich Text (HTML) Display
Posted by Greg Brown <gk...@mac.com>.
It is not currently supported. You might take a look at the Flying Saucer library. I have not used it myself, but it seems promising. Note that it is LGPL and therefore not compatible with the Apache License:
https://xhtmlrenderer.dev.java.net/
On Feb 23, 2010, at 2:12 PM, Scott Baxter wrote:
> Has anyone tried to display HTML inside of Pivot? If so, what route did you take? Do Swing components behave properly inside of Pivot containers?