You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by freeway139 <fr...@googlemail.com> on 2008/03/13 14:08:48 UTC

Tooltips/Swing with Batik?

Hi everyone,

I'm developing an application which gets data from a database. The content
is shown as an image like a bar chart and so on. Therefore I want to use
Batik. My questions are the following:

How is it possible to add tooltips to specific positions (like when you put
the mouse on the bar chart, I know it's possible within svg but how can I
create this with Batik?)?

How can I convert Swing components to svg with batik? From what I read it
seems possible but I have no clue how to do that. For example how can I
convert a JTable into svg?

I hope someone can help me with that. Or just give me some hints. Thanks for
that

Re: Tooltips/Swing with Batik?

Posted by Mark Fortner <ph...@yahoo.com>.
I don't use Batik to construct SVGs; merely to render and transform them.  I
tend to use InkScape to rough out the drawing, and then insert JSP code
and/or JavaScript to add additional functionality or dynamism.

Converting Swing components to SVG seems like a stretch.  The
SwingSVGPrettyPrinter may suit your needs, but I've never used it so I can't
really advise you.  If you're trying to convert a Swing app to a web app,
then something like WebOnSwing (http://webonswing.sourceforge.net/xoops/) or
SwingWeb (http://swingweb.sourceforge.net/swingweb/) might suit your needs
better.

Hope this helps,

Mark

On Fri, Mar 14, 2008 at 12:52 AM, freeway139 <fr...@googlemail.com>
wrote:

> Hi Mark,
>
> thanks for your reply.
> Ok, I see how to add a tooltip, but how can I do this in Java code with
> batik?
>
> and is it possible to paint a swing component with SwingSVGPrettyPrinter
> to svg?
>
> thanks
>
>
> 2008/3/13, Mark Fortner <ph...@yahoo.com>:
>
> > To add a tooltip simply surround the object with an anchor tag like
> > this:
> > <a href="" title="My tooltip"><rect ..../></a>
> >
> > As for creating a table, you might want to consider creating a hybrid
> > solution that is partly SVG and partly HTML.  You could then render the
> > table using HTML, and create your graph in SVG.  You'd be able to add any
> > interactivity you wanted to the SVG using JavaScript.  So if you wanted to
> > click on a bar in a barchart, you could update the table with relevant
> > information.
> >
> > Hope this helps,
> >
> > Mark
> >
> > On Thu, Mar 13, 2008 at 6:08 AM, freeway139 <fr...@googlemail.com>
> > wrote:
> >
> > > Hi everyone,
> > >
> > > I'm developing an application which gets data from a database. The
> > > content is shown as an image like a bar chart and so on. Therefore I want to
> > > use Batik. My questions are the following:
> > >
> > > How is it possible to add tooltips to specific positions (like when
> > > you put the mouse on the bar chart, I know it's possible within svg but how
> > > can I create this with Batik?)?
> > >
> > > How can I convert Swing components to svg with batik? From what I read
> > > it seems possible but I have no clue how to do that. For example how can I
> > > convert a JTable into svg?
> > >
> > > I hope someone can help me with that. Or just give me some hints.
> > > Thanks for that
> > >
> >
> >
> >
> > --
> > Mark Fortner
> >
> > blog: http://www.jroller.com/phidias
>
>
>


-- 
Mark Fortner

blog: http://www.jroller.com/phidias

Re: Tooltips/Swing with Batik?

Posted by Mark Fortner <ph...@gmail.com>.
Hi Thomas,
It does render properly in FireFox, I haven't tried it using Squiggle, or
IE.  But good to know there's a proper way of doing it.

Thanks,

Mark

On Thu, Mar 27, 2008 at 3:14 AM, <th...@kodak.com> wrote:

> Hi Mark, Freeway,
>
> freeway139 <fr...@googlemail.com> wrote on 03/14/2008 03:52:08 AM:
>
> > Ok, I see how to add a tooltip, but how can I do this in Java code with
> batik?
>
>    I actually don't think Mark's suggestion will work (that's an HTMLism).
> In SVG you can provide tooltips in Batik through the 'title' and 'desc'
> elements.
>
>    As for adding them in Java.  You can use createElementNS
> with the SVG Namespace, and "title" or "desc".  Then append a
> text node, document.createTextNode("your text") and appendChild.
> Then append the title/desc element to the element you want the tooltip
> to appear over (also with appendChild).
>
>    Finding the element you want to attach the title/desc to
> is most easily done by getElementById if your element has a
> unique 'id' attribute.
>
>
> > and is it possible to paint a swing component with
> > SwingSVGPrettyPrinter to svg?
>
>     Yes, it is possible.  It only captures a 'static' view
> of the component but it does a pretty good job of that.
>
>
> > 2008/3/13, Mark Fortner <ph...@yahoo.com>:
> > To add a tooltip simply surround the object with an anchor tag like
> this:
> > <a href="" title="My tooltip"><rect ..../></a>
> >
> > As for creating a table, you might want to consider creating a
> > hybrid solution that is partly SVG and partly HTML.  You could then
> > render the table using HTML, and create your graph in SVG.  You'd be
> > able to add any interactivity you wanted to the SVG using
> > JavaScript.  So if you wanted to click on a bar in a barchart, you
> > could update the table with relevant information.
> >
> > Hope this helps,
> >
> > Mark
> >
>
> > On Thu, Mar 13, 2008 at 6:08 AM, freeway139 <fr...@googlemail.com>
> wrote:
> > Hi everyone,
> >
> > I'm developing an application which gets data from a database. The
> > content is shown as an image like a bar chart and so on. Therefore I
> > want to use Batik. My questions are the following:
> >
> > How is it possible to add tooltips to specific positions (like when
> > you put the mouse on the bar chart, I know it's possible within svg
> > but how can I create this with Batik?)?
> >
> > How can I convert Swing components to svg with batik? From what I
> > read it seems possible but I have no clue how to do that. For
> > example how can I convert a JTable into svg?
> >
> > I hope someone can help me with that. Or just give me some hints.
> > Thanks for that
> >
> >
>
> > --
> > Mark Fortner
> >
> > blog: http://www.jroller.com/phidias
>



-- 
Mark Fortner

blog: http://www.jroller.com/phidias

Re: Tooltips/Swing with Batik?

Posted by th...@kodak.com.
Hi Mark, Freeway,

freeway139 <fr...@googlemail.com> wrote on 03/14/2008 03:52:08 AM:

> Ok, I see how to add a tooltip, but how can I do this in Java code with
batik?

   I actually don't think Mark's suggestion will work (that's an HTMLism).
In SVG you can provide tooltips in Batik through the 'title' and 'desc'
elements.

   As for adding them in Java.  You can use createElementNS
with the SVG Namespace, and "title" or "desc".  Then append a
text node, document.createTextNode("your text") and appendChild.
Then append the title/desc element to the element you want the tooltip
to appear over (also with appendChild).

   Finding the element you want to attach the title/desc to
is most easily done by getElementById if your element has a
unique 'id' attribute.

> and is it possible to paint a swing component with
> SwingSVGPrettyPrinter to svg?

    Yes, it is possible.  It only captures a 'static' view
of the component but it does a pretty good job of that.

> 2008/3/13, Mark Fortner <ph...@yahoo.com>:
> To add a tooltip simply surround the object with an anchor tag like this:
> <a href="" title="My tooltip"><rect ..../></a>
>
> As for creating a table, you might want to consider creating a
> hybrid solution that is partly SVG and partly HTML.  You could then
> render the table using HTML, and create your graph in SVG.  You'd be
> able to add any interactivity you wanted to the SVG using
> JavaScript.  So if you wanted to click on a bar in a barchart, you
> could update the table with relevant information.
>
> Hope this helps,
>
> Mark
>

> On Thu, Mar 13, 2008 at 6:08 AM, freeway139 <fr...@googlemail.com>
wrote:
> Hi everyone,
>
> I'm developing an application which gets data from a database. The
> content is shown as an image like a bar chart and so on. Therefore I
> want to use Batik. My questions are the following:
>
> How is it possible to add tooltips to specific positions (like when
> you put the mouse on the bar chart, I know it's possible within svg
> but how can I create this with Batik?)?
>
> How can I convert Swing components to svg with batik? From what I
> read it seems possible but I have no clue how to do that. For
> example how can I convert a JTable into svg?
>
> I hope someone can help me with that. Or just give me some hints.
> Thanks for that
>
>

> --
> Mark Fortner
>
> blog: http://www.jroller.com/phidias

Re: Tooltips/Swing with Batik?

Posted by freeway139 <fr...@googlemail.com>.
Hi Mark,

thanks for your reply.
Ok, I see how to add a tooltip, but how can I do this in Java code with
batik?

and is it possible to paint a swing component with SwingSVGPrettyPrinter to
svg?

thanks


2008/3/13, Mark Fortner <ph...@yahoo.com>:
>
> To add a tooltip simply surround the object with an anchor tag like this:
> <a href="" title="My tooltip"><rect ..../></a>
>
> As for creating a table, you might want to consider creating a hybrid
> solution that is partly SVG and partly HTML.  You could then render the
> table using HTML, and create your graph in SVG.  You'd be able to add any
> interactivity you wanted to the SVG using JavaScript.  So if you wanted to
> click on a bar in a barchart, you could update the table with relevant
> information.
>
> Hope this helps,
>
> Mark
>
> On Thu, Mar 13, 2008 at 6:08 AM, freeway139 <fr...@googlemail.com>
> wrote:
>
> > Hi everyone,
> >
> > I'm developing an application which gets data from a database. The
> > content is shown as an image like a bar chart and so on. Therefore I want to
> > use Batik. My questions are the following:
> >
> > How is it possible to add tooltips to specific positions (like when you
> > put the mouse on the bar chart, I know it's possible within svg but how can
> > I create this with Batik?)?
> >
> > How can I convert Swing components to svg with batik? From what I read
> > it seems possible but I have no clue how to do that. For example how can I
> > convert a JTable into svg?
> >
> > I hope someone can help me with that. Or just give me some hints. Thanks
> > for that
> >
>
>
>
> --
> Mark Fortner
>
> blog: http://www.jroller.com/phidias

Re: Tooltips/Swing with Batik?

Posted by Mark Fortner <ph...@yahoo.com>.
To add a tooltip simply surround the object with an anchor tag like this:
<a href="" title="My tooltip"><rect ..../></a>

As for creating a table, you might want to consider creating a hybrid
solution that is partly SVG and partly HTML.  You could then render the
table using HTML, and create your graph in SVG.  You'd be able to add any
interactivity you wanted to the SVG using JavaScript.  So if you wanted to
click on a bar in a barchart, you could update the table with relevant
information.

Hope this helps,

Mark

On Thu, Mar 13, 2008 at 6:08 AM, freeway139 <fr...@googlemail.com>
wrote:

> Hi everyone,
>
> I'm developing an application which gets data from a database. The content
> is shown as an image like a bar chart and so on. Therefore I want to use
> Batik. My questions are the following:
>
> How is it possible to add tooltips to specific positions (like when you
> put the mouse on the bar chart, I know it's possible within svg but how can
> I create this with Batik?)?
>
> How can I convert Swing components to svg with batik? From what I read it
> seems possible but I have no clue how to do that. For example how can I
> convert a JTable into svg?
>
> I hope someone can help me with that. Or just give me some hints. Thanks
> for that
>



-- 
Mark Fortner

blog: http://www.jroller.com/phidias