You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Philippe Converset <pc...@Qarbon.com> on 2001/04/04 21:29:20 UTC

onclick event

I tried to render a simple svg file with an onclick event (a circle which 
size is changed when clicked, found on 
http://www.w3.org/TR/SVG/images/script/script01.svg) inside a JSVGCanvas 
but the click does not seem to be interpreted (the size of the circle 
remains the same).
Is there somtehing special I need to tell my JSVGCanvas?
I'd like as well to be informed when this event is triggered in my Java 
code. Is there a listener for that purpose?

I tried to find a solution by myself but as the last javadoc has not been 
released, there are some differences with the source that make guessing 
painful. As far as I could guess, it seems that this can be done with 
UserAgent but I can't figure out how to create one in order to give it to 
the JSVGCanvas constructor.

Philippe.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: onclick event

Posted by Vincent Hardy <vh...@eng.sun.com>.
Philippe,

Did you check that your class is in your classpath when your run 
Batik?
V.

Philippe Converset wrote:
> 
> Thanks for the advice.
> 
> I looked at samples\batikMusic.svg and found this is exactly what I want to
> do : calling some java code from javascript.
> Unfortunately I can't figure out how to call one of my classes, I always
> get error messages like "scripting error : myclass is not defined".
> Even if I use importPackage(myPackage), any call to myClass will fail but
> it seems to work fine for standard java package. Is there a specific
> configuration to allow proprietary package to be accessed in EcmaScript?
> 
> Thanks,
> 
> Philippe
> 
> At 08:51 AM 4/5/2001 -0700, Vincent Hardy wrote:
> >Philippe,
> >
> >You should be able to position event listeners in your SVG source and
> >you can look at the samples\batikMusic.svg example for an example.
> >Positioning event handlers on the GVT tree is not recommended, even
> >though it is possible, as you discovered. It is not recommended because
> >this ties what you are doing with your SVG to the viewer you are using
> >and, as much as I love Batik, it is not a good idea to tie you SVG
> >code to that particular implementation.
> >
> >V.
> >
> >Philippe Converset wrote:
> > >
> > > OK, I finally managed to be warned when an onclick event appear using a
> > > GraphicsNodeMouseListener.
> > > This listener is added on the GraphicsNode corresponding to the SVG
> > > Element, the GraphicsNode being retrieved using the BridgeContext. That was
> > > hard to guess but it seems to be the right way. Please tell me if there is
> > > a simpler way.
> > >
> > > I'm style worried about the circle in my SVG file example which is not
> > > updated when it is clicked. Is interactive feature not yet supported by
> > > JSVGCanvas?
> > >
> > > Sorry to bother you with all this questions but I'm doing some tests on
> > > Batik in order to decide if it is mature enough to use it in the next
> > > release of our Java based application (see ViewletBuilder at
> > > www.qarbon.com) to do some SVG stuff. So any help would be greatly
> > appreciated.
> > >
> > > Philippe
> > >
> > > At 12:29 PM 4/4/2001 -0700, Philippe Converset wrote:
> > > >I tried to render a simple svg file with an onclick event (a circle which
> > > >size is changed when clicked, found on
> > > >http://www.w3.org/TR/SVG/images/script/script01.svg) inside a JSVGCanvas
> > > >but the click does not seem to be interpreted (the size of the circle
> > > >remains the same).
> > > >Is there somtehing special I need to tell my JSVGCanvas?
> > > >I'd like as well to be informed when this event is triggered in my Java
> > > >code. Is there a listener for that purpose?
> > > >
> > > >I tried to find a solution by myself but as the last javadoc has not been
> > > >released, there are some differences with the source that make guessing
> > > >painful. As far as I could guess, it seems that this can be done with
> > > >UserAgent but I can't figure out how to create one in order to give it to
> > > >the JSVGCanvas constructor.
> > > >
> > > >Philippe.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: batik-dev-help@xml.apache.org
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> >For additional commands, e-mail: batik-dev-help@xml.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: onclick event

Posted by Philippe Converset <pc...@Qarbon.com>.
Thanks for the advice.

I looked at samples\batikMusic.svg and found this is exactly what I want to 
do : calling some java code from javascript.
Unfortunately I can't figure out how to call one of my classes, I always 
get error messages like "scripting error : myclass is not defined".
Even if I use importPackage(myPackage), any call to myClass will fail but 
it seems to work fine for standard java package. Is there a specific 
configuration to allow proprietary package to be accessed in EcmaScript?

Thanks,

Philippe

At 08:51 AM 4/5/2001 -0700, Vincent Hardy wrote:
>Philippe,
>
>You should be able to position event listeners in your SVG source and
>you can look at the samples\batikMusic.svg example for an example.
>Positioning event handlers on the GVT tree is not recommended, even
>though it is possible, as you discovered. It is not recommended because
>this ties what you are doing with your SVG to the viewer you are using
>and, as much as I love Batik, it is not a good idea to tie you SVG
>code to that particular implementation.
>
>V.
>
>Philippe Converset wrote:
> >
> > OK, I finally managed to be warned when an onclick event appear using a
> > GraphicsNodeMouseListener.
> > This listener is added on the GraphicsNode corresponding to the SVG
> > Element, the GraphicsNode being retrieved using the BridgeContext. That was
> > hard to guess but it seems to be the right way. Please tell me if there is
> > a simpler way.
> >
> > I'm style worried about the circle in my SVG file example which is not
> > updated when it is clicked. Is interactive feature not yet supported by
> > JSVGCanvas?
> >
> > Sorry to bother you with all this questions but I'm doing some tests on
> > Batik in order to decide if it is mature enough to use it in the next
> > release of our Java based application (see ViewletBuilder at
> > www.qarbon.com) to do some SVG stuff. So any help would be greatly 
> appreciated.
> >
> > Philippe
> >
> > At 12:29 PM 4/4/2001 -0700, Philippe Converset wrote:
> > >I tried to render a simple svg file with an onclick event (a circle which
> > >size is changed when clicked, found on
> > >http://www.w3.org/TR/SVG/images/script/script01.svg) inside a JSVGCanvas
> > >but the click does not seem to be interpreted (the size of the circle
> > >remains the same).
> > >Is there somtehing special I need to tell my JSVGCanvas?
> > >I'd like as well to be informed when this event is triggered in my Java
> > >code. Is there a listener for that purpose?
> > >
> > >I tried to find a solution by myself but as the last javadoc has not been
> > >released, there are some differences with the source that make guessing
> > >painful. As far as I could guess, it seems that this can be done with
> > >UserAgent but I can't figure out how to create one in order to give it to
> > >the JSVGCanvas constructor.
> > >
> > >Philippe.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-dev-help@xml.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: onclick event

Posted by Vincent Hardy <vh...@eng.sun.com>.
Philippe,

You should be able to position event listeners in your SVG source and
you can look at the samples\batikMusic.svg example for an example.
Positioning event handlers on the GVT tree is not recommended, even
though it is possible, as you discovered. It is not recommended because
this ties what you are doing with your SVG to the viewer you are using
and, as much as I love Batik, it is not a good idea to tie you SVG 
code to that particular implementation.

V.

Philippe Converset wrote:
> 
> OK, I finally managed to be warned when an onclick event appear using a
> GraphicsNodeMouseListener.
> This listener is added on the GraphicsNode corresponding to the SVG
> Element, the GraphicsNode being retrieved using the BridgeContext. That was
> hard to guess but it seems to be the right way. Please tell me if there is
> a simpler way.
> 
> I'm style worried about the circle in my SVG file example which is not
> updated when it is clicked. Is interactive feature not yet supported by
> JSVGCanvas?
> 
> Sorry to bother you with all this questions but I'm doing some tests on
> Batik in order to decide if it is mature enough to use it in the next
> release of our Java based application (see ViewletBuilder at
> www.qarbon.com) to do some SVG stuff. So any help would be greatly appreciated.
> 
> Philippe
> 
> At 12:29 PM 4/4/2001 -0700, Philippe Converset wrote:
> >I tried to render a simple svg file with an onclick event (a circle which
> >size is changed when clicked, found on
> >http://www.w3.org/TR/SVG/images/script/script01.svg) inside a JSVGCanvas
> >but the click does not seem to be interpreted (the size of the circle
> >remains the same).
> >Is there somtehing special I need to tell my JSVGCanvas?
> >I'd like as well to be informed when this event is triggered in my Java
> >code. Is there a listener for that purpose?
> >
> >I tried to find a solution by myself but as the last javadoc has not been
> >released, there are some differences with the source that make guessing
> >painful. As far as I could guess, it seems that this can be done with
> >UserAgent but I can't figure out how to create one in order to give it to
> >the JSVGCanvas constructor.
> >
> >Philippe.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: onclick event

Posted by Philippe Converset <pc...@Qarbon.com>.
OK, I finally managed to be warned when an onclick event appear using a 
GraphicsNodeMouseListener.
This listener is added on the GraphicsNode corresponding to the SVG 
Element, the GraphicsNode being retrieved using the BridgeContext. That was 
hard to guess but it seems to be the right way. Please tell me if there is 
a simpler way.

I'm style worried about the circle in my SVG file example which is not 
updated when it is clicked. Is interactive feature not yet supported by 
JSVGCanvas?

Sorry to bother you with all this questions but I'm doing some tests on 
Batik in order to decide if it is mature enough to use it in the next 
release of our Java based application (see ViewletBuilder at 
www.qarbon.com) to do some SVG stuff. So any help would be greatly appreciated.

Philippe

At 12:29 PM 4/4/2001 -0700, Philippe Converset wrote:
>I tried to render a simple svg file with an onclick event (a circle which 
>size is changed when clicked, found on 
>http://www.w3.org/TR/SVG/images/script/script01.svg) inside a JSVGCanvas 
>but the click does not seem to be interpreted (the size of the circle 
>remains the same).
>Is there somtehing special I need to tell my JSVGCanvas?
>I'd like as well to be informed when this event is triggered in my Java 
>code. Is there a listener for that purpose?
>
>I tried to find a solution by myself but as the last javadoc has not been 
>released, there are some differences with the source that make guessing 
>painful. As far as I could guess, it seems that this can be done with 
>UserAgent but I can't figure out how to create one in order to give it to 
>the JSVGCanvas constructor.
>
>Philippe.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org