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 Kerschbaum Michael <m....@pke.at> on 2008/08/06 13:54:08 UTC

Xlink Problem

Hello,
 
I have still some problems. Currently with links in an SVG File. When we define a link via xlink into a nother svg File, sometimes the area for this link is not recognized as link (normally the mouse courser changed, and when you click on the area the link is exectued via the openLink method in the SVGUserAgent interface)
 
I looks like that sometimes the Elements in the SVG Tree does not react on Events . e.g. 
 
SVGConstants.SVG_MOUSEOUT_EVENT_TYPE
SVGConstants.SVG_MOUSEOVER_EVENT_TYPE
 
because when this happens the handleEvent Method is never called.
 
We defined the link ... like
 
....
<g id="group4975-140" v:layerMember="0">
   
   <g id="group4976-141" v:layerMember="0">
    
    <rect x="0" y="597" width="326.25" height="63" class="st15" />
    <a xlink:href="LAGEPLAN.svg" xmlns:xlink="http://www.w3.org/1999/xlink">
     <g id="shape4978-144" transform="translate(256.5,-33.3529)">
 
...
 
When this happens i still get MouseEvents on my JSVGComponent.... but no events from org.w3c.dom.events.EventListener... ?! There is no error in the console and no exception is thrown ?!...
 
Mit freundlichen Grüßen Michael Kerschbaum

 

DI (FH) Michael Kerschbaum

PKE Electronics AG

Zentrale Wien / Entwicklung

Computerstraße 6

A - 1101 Wien

TEL: +43 (0) 50 150 - 1210

m.kerschbaum@pke.at

www.pke.at <http://www.pke.at/>  

 

Aktiengesellschaft mit dem Sitz in Wien

Firmenbuchnummer 103264i

HG Wien, DVR 0159701

Johann Helf - Vorsitzender des Vorstandes

Bruno Faustka - Mitglied des Vorstandes

Christian Prelz - Vorsitzender des Aufsichtsrates

 

AW: AW: Xlink Problem

Posted by Kerschbaum Michael <m....@pke.at>.
Hello...
 
Thanks for explaining... I hope i solved the problem by using only Batik EventHandler...
 
The hint that i should not not call DOM or gvt methods from Swing is good to know if some problems occure in future...
 
thanks...
 
Mit freundlichen Grüßen Michael Kerschbaum

 

DI (FH) Michael Kerschbaum

PKE Electronics AG

Zentrale Wien / Entwicklung

Computerstraße 6

A - 1101 Wien

TEL: +43 (0) 50 150 - 1210

m.kerschbaum@pke.at

www.pke.at <http://www.pke.at/>  

 

Aktiengesellschaft mit dem Sitz in Wien

Firmenbuchnummer 103264i

HG Wien, DVR 0159701

Johann Helf - Vorsitzender des Vorstandes

Bruno Faustka - Mitglied des Vorstandes

Christian Prelz - Vorsitzender des Aufsichtsrates

 

________________________________

Von: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Gesendet: Donnerstag, 07. August 2008 11:54
An: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Betreff: Re: AW: Xlink Problem



Hi Kerschbaum,

"Kerschbaum Michael " <m....@pke.at> wrote on 08/07/2008 04:14:10 AM:

> I thing i get the problem. The application uses SymbolEventListener 
> and MouseListener from the Swing Component. And the MouseListener 
> listen to mouseMoved... everyTime when mouseMoved the Location from 
> the Mouse is captured and the application tries to find a Node on 
> this position.... If a node was found, the element for this node is 
> located and then some action is made... Now i use only EventListener
> from Batik and the Link problem does not accure anymore... 

   It is not safe to interact with the DOM or GVT tree outside of 
the UpdateManager Runnable queue.  It is very possible that your 
calling nodeHitAt from the AWT thread was disrupting the normal 
DOM event dispatch and/or the repaint. 

> I mean sometimes a NPE in public GraphicsNode nodeHitAt(Point2D p) 
> in the class org.apache.batik.gvt.CompositeGraphicsNode occured. 
> This method calls this method... and in this method a NPE occures.... 

   During a drawing operation say in response to changing the stroke 
of an element we will clear cached geometry information like 
'sensitiveBounds'.  If you are in the middle of updating the sensitive 
bounds (which is done during a call to nodeHitAt) then the clear 
will cause sensitiveBounds to suddenly become null in the middle of 
the call. 

>     public Rectangle2D getSensitiveBounds() {
>         if (sensitiveBounds != null)
>             return sensitiveBounds; 
[...] 
>                 sensitiveBounds.add(cgb); ==> NPE can't tell why ?! ==> line 409 !!

> Perhaps someone could tell me why.... 
>   
> This happens... it seems that the sensitiveBounds is null for a 
> while, as long as this happens the method is called again... and 
> then its not null anymore but, not really ?! 
>   
> [AWT-EventQueue-0] WARN AGComponent - java.lang.NullPointerException 
> java.lang.NullPointerException 
> at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(
> CompositeGraphicsNode.java:409) 
[...] 
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) 

   Don't ever call DOM or GVT methods from the Swing thread! 

> Von: Kerschbaum Michael [mailto:m.kerschbaum@pke.at] 
> Gesendet: Mittwoch, 06. August 2008 15:30
> An: batik-users@xmlgraphics.apache.org
> Betreff: AW: Xlink Problem

> Hello, 
>   
> I tried this but no real success... 
>   
> Okay i will explain what i do... 
>   
> At creation time of the application i call that ... where 
> AGUserAgent implements SVGUserAgent... 
>   
> svgUserAgent = new AGUserAgent(this); 
>   
> then when the user wants to load an SVG... 
>   
> 1.)Load a SVG Document..by 
> 2.)On the do documentLoadingCompleted event i create an Instance of 
> a Object i call SymbolManager.. this object parses some information 
> within the SVG Document like we call "custProps",....  and creates 
> Symbol objects, every Symbol has an Element (org.w3c.dom).. for this
> symbols i add EventListener... like 
>   
> ... 
>  public void addSymbolListeners(SVGOMElement elt) {
>   elt.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, symbolListener,
>     false);
>   elt.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, symbolListener,
>     false);
>  } 
>   
> ... 
>   
> at this code it tried useCapture , true and false.... no real dífference... 
>   
> this is the only code where i add Event Listeners 
>   
> We also have "Layers" , for that we use the "layerMember", and some 
> elements are not visible... when they have a not currently displayed Layer... 
>   
> for that i use the code 
>   
> ... 
>  for (int i = 0; i < layerMembers.size(); i++) {
>    Element elt = (Element) layerMembers.get(i);
>    if (elt != null) { 
>   
>     if (visible) {
>          elt.removeAttributeNS(null, "visibility"); 
>          elt.setAttributeNS(null, "pointer-events", "all");
>      } 
>     else {
>      elt.setAttributeNS(null, "visibility", "hidden");
>      elt.setAttributeNS(null, "pointer-events", "none");
>     } 
> .... 
>   
> If the application is in that situation, that the Links are not 
> regocnized and the Events Listerns do not call the handleEvent... 
> mostly it helps that i change the visibity of one layer... after 
> this code was executed everythings seems to be normal ... but not 
> 100 % sure.. ?! 
>   
> Mit freundlichen Grüßen Michael Kerschbaum 
>   
> DI (FH) Michael Kerschbaum 
> PKE Electronics AG 
> Zentrale Wien / Entwicklung 
> Computerstraße 6 
> A - 1101 Wien 
> TEL: +43 (0) 50 150 - 1210 
> m.kerschbaum@pke.at 
> www.pke.at 
>   
> Aktiengesellschaft mit dem Sitz in Wien 
> Firmenbuchnummer 103264i 
> HG Wien, DVR 0159701 
> Johann Helf - Vorsitzender des Vorstandes 
> Bruno Faustka - Mitglied des Vorstandes 
> Christian Prelz - Vorsitzender des Aufsichtsrates 
>   
> 
> Von: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> Gesendet: Mittwoch, 06. August 2008 14:28
> An: batik-users@xmlgraphics.apache.org
> Cc: batik-users@xmlgraphics.apache.org
> Betreff: Re: Xlink Problem

> 
> Hi Kerschbaum,
> 
> "Kerschbaum Michael " <m....@pke.at> wrote on 08/06/2008 07:54:08 AM:
> 
> > I have still some problems. Currently with links in an SVG File. 
> > When we define a link via xlink into a nother svg File, sometimes 
> > the area for this link is not recognized as link (normally the mouse
> > courser changed, and when you click on the area the link is exectued
> > via the openLink method in the SVGUserAgent interface) 
> >   
> > I looks like that sometimes the Elements in the SVG Tree does not 
> > react on Events . e.g. 
> 
>    My guess is that you have an event listener somewhere high in the tree 
> (like the root SVG node) and you are listening during the 'bubble' phase 
> of event propagation.  Since the Anchor captures the event to change 
> the cursor and handle clicks it never bubbles back to the root of the 
> SVG document.  So the simplest solution would be to change your event 
> listener to listen during the 'capture' phase of event propagation 
> (see the DOM level 2 Events Spec). 
> 
> >   
> > SVGConstants.SVG_MOUSEOUT_EVENT_TYPE
> > SVGConstants.SVG_MOUSEOVER_EVENT_TYPE 
> >   
> > because when this happens the handleEvent Method is never called. 
> >   
> > We defined the link ... like 
> >   
> > .... 
> > <g id="group4975-140" v:layerMember="0">
> >    
> >    <g id="group4976-141" v:layerMember="0">
> >     
> >     <rect x="0" y="597" width="326.25" height="63" class="st15" />
> >     <a xlink:href="LAGEPLAN.svg" xmlns:xlink="http://www.w3.org/1999/xlink">
> >      <g id="shape4978-144" transform="translate(256.5,-33.3529)"> 
> >   
> > ... 
> >   
> > When this happens i still get MouseEvents on my JSVGComponent.... 
> > but no events from org.w3c.dom.events.EventListener... ?! There is 
> > no error in the console and no exception is thrown ?!... 
> >   
> > Mit freundlichen Grüßen Michael Kerschbaum 
> >   
> > DI (FH) Michael Kerschbaum 
> > PKE Electronics AG 
> > Zentrale Wien / Entwicklung 
> > Computerstraße 6 
> > A - 1101 Wien 
> > TEL: +43 (0) 50 150 - 1210 
> > m.kerschbaum@pke.at 
> > www.pke.at 
> >   
> > Aktiengesellschaft mit dem Sitz in Wien 
> > Firmenbuchnummer 103264i 
> > HG Wien, DVR 0159701 
> > Johann Helf - Vorsitzender des Vorstandes 
> > Bruno Faustka - Mitglied des Vorstandes 
> > Christian Prelz - Vorsitzender des Aufsichtsrates 
> >  [attachment "test.zip" deleted by Thomas E. DeWeese/449433/EKC] 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org 

Re: AW: Xlink Problem

Posted by th...@kodak.com.
Hi Kerschbaum,

"Kerschbaum Michael " <m....@pke.at> wrote on 08/07/2008 04:14:10 
AM:

> I thing i get the problem. The application uses SymbolEventListener 
> and MouseListener from the Swing Component. And the MouseListener 
> listen to mouseMoved... everyTime when mouseMoved the Location from 
> the Mouse is captured and the application tries to find a Node on 
> this position.... If a node was found, the element for this node is 
> located and then some action is made... Now i use only EventListener
> from Batik and the Link problem does not accure anymore...

   It is not safe to interact with the DOM or GVT tree outside of
the UpdateManager Runnable queue.  It is very possible that your
calling nodeHitAt from the AWT thread was disrupting the normal
DOM event dispatch and/or the repaint.

> I mean sometimes a NPE in public GraphicsNode nodeHitAt(Point2D p) 
> in the class org.apache.batik.gvt.CompositeGraphicsNode occured. 
> This method calls this method... and in this method a NPE occures....

   During a drawing operation say in response to changing the stroke
of an element we will clear cached geometry information like 
'sensitiveBounds'.  If you are in the middle of updating the sensitive
bounds (which is done during a call to nodeHitAt) then the clear 
will cause sensitiveBounds to suddenly become null in the middle of 
the call.

>     public Rectangle2D getSensitiveBounds() {
>         if (sensitiveBounds != null)
>             return sensitiveBounds;
[...]
>                 sensitiveBounds.add(cgb); ==> NPE can't tell why ?! ==> 
line 409 !!

> Perhaps someone could tell me why....
> 
> This happens... it seems that the sensitiveBounds is null for a 
> while, as long as this happens the method is called again... and 
> then its not null anymore but, not really ?! 
> 
> [AWT-EventQueue-0] WARN AGComponent - java.lang.NullPointerException
> java.lang.NullPointerException
> at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(
> CompositeGraphicsNode.java:409)
[...]
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

   Don't ever call DOM or GVT methods from the Swing thread!

> Von: Kerschbaum Michael [mailto:m.kerschbaum@pke.at] 
> Gesendet: Mittwoch, 06. August 2008 15:30
> An: batik-users@xmlgraphics.apache.org
> Betreff: AW: Xlink Problem

> Hello,
> 
> I tried this but no real success...
> 
> Okay i will explain what i do...
> 
> At creation time of the application i call that ... where 
> AGUserAgent implements SVGUserAgent...
> 
> svgUserAgent = new AGUserAgent(this);
> 
> then when the user wants to load an SVG...
> 
> 1.)Load a SVG Document..by
> 2.)On the do documentLoadingCompleted event i create an Instance of 
> a Object i call SymbolManager.. this object parses some information 
> within the SVG Document like we call "custProps",....  and creates 
> Symbol objects, every Symbol has an Element (org.w3c.dom).. for this
> symbols i add EventListener... like
> 
> ...
>  public void addSymbolListeners(SVGOMElement elt) {
>   elt.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, 
symbolListener,
>     false);
>   elt.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, 
symbolListener,
>     false);
>  }
> 
> ... 
> 
> at this code it tried useCapture , true and false.... no real 
dífference...
> 
> this is the only code where i add Event Listeners
> 
> We also have "Layers" , for that we use the "layerMember", and some 
> elements are not visible... when they have a not currently displayed 
Layer...
> 
> for that i use the code
> 
> ...
>  for (int i = 0; i < layerMembers.size(); i++) {
>    Element elt = (Element) layerMembers.get(i);
>    if (elt != null) {
> 
>     if (visible) {
>          elt.removeAttributeNS(null, "visibility");
>          elt.setAttributeNS(null, "pointer-events", "all");
>      }
>     else {
>      elt.setAttributeNS(null, "visibility", "hidden");
>      elt.setAttributeNS(null, "pointer-events", "none");
>     }
> ....
> 
> If the application is in that situation, that the Links are not 
> regocnized and the Events Listerns do not call the handleEvent... 
> mostly it helps that i change the visibity of one layer... after 
> this code was executed everythings seems to be normal ... but not 
> 100 % sure.. ?!
> 
> Mit freundlichen Grüßen Michael Kerschbaum
> 
> DI (FH) Michael Kerschbaum
> PKE Electronics AG
> Zentrale Wien / Entwicklung
> Computerstraße 6
> A - 1101 Wien
> TEL: +43 (0) 50 150 - 1210
> m.kerschbaum@pke.at
> www.pke.at 
> 
> Aktiengesellschaft mit dem Sitz in Wien
> Firmenbuchnummer 103264i
> HG Wien, DVR 0159701
> Johann Helf – Vorsitzender des Vorstandes
> Bruno Faustka – Mitglied des Vorstandes
> Christian Prelz – Vorsitzender des Aufsichtsrates
> 
> 
> Von: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> Gesendet: Mittwoch, 06. August 2008 14:28
> An: batik-users@xmlgraphics.apache.org
> Cc: batik-users@xmlgraphics.apache.org
> Betreff: Re: Xlink Problem

> 
> Hi Kerschbaum,
> 
> "Kerschbaum Michael " <m....@pke.at> wrote on 08/06/2008 07:54:08 
AM:
> 
> > I have still some problems. Currently with links in an SVG File. 
> > When we define a link via xlink into a nother svg File, sometimes 
> > the area for this link is not recognized as link (normally the mouse
> > courser changed, and when you click on the area the link is exectued
> > via the openLink method in the SVGUserAgent interface) 
> > 
> > I looks like that sometimes the Elements in the SVG Tree does not 
> > react on Events . e.g. 
> 
>    My guess is that you have an event listener somewhere high in the 
tree 
> (like the root SVG node) and you are listening during the 'bubble' phase 

> of event propagation.  Since the Anchor captures the event to change 
> the cursor and handle clicks it never bubbles back to the root of the 
> SVG document.  So the simplest solution would be to change your event 
> listener to listen during the 'capture' phase of event propagation 
> (see the DOM level 2 Events Spec). 
> 
> > 
> > SVGConstants.SVG_MOUSEOUT_EVENT_TYPE
> > SVGConstants.SVG_MOUSEOVER_EVENT_TYPE 
> > 
> > because when this happens the handleEvent Method is never called. 
> > 
> > We defined the link ... like 
> > 
> > .... 
> > <g id="group4975-140" v:layerMember="0">
> > 
> >    <g id="group4976-141" v:layerMember="0">
> > 
> >     <rect x="0" y="597" width="326.25" height="63" class="st15" />
> >     <a xlink:href="LAGEPLAN.svg" 
xmlns:xlink="http://www.w3.org/1999/xlink">
> >      <g id="shape4978-144" transform="translate(256.5,-33.3529)"> 
> > 
> > ... 
> > 
> > When this happens i still get MouseEvents on my JSVGComponent.... 
> > but no events from org.w3c.dom.events.EventListener... ?! There is 
> > no error in the console and no exception is thrown ?!... 
> > 
> > Mit freundlichen Grüßen Michael Kerschbaum 
> > 
> > DI (FH) Michael Kerschbaum 
> > PKE Electronics AG 
> > Zentrale Wien / Entwicklung 
> > Computerstraße 6 
> > A - 1101 Wien 
> > TEL: +43 (0) 50 150 - 1210 
> > m.kerschbaum@pke.at 
> > www.pke.at 
> > 
> > Aktiengesellschaft mit dem Sitz in Wien 
> > Firmenbuchnummer 103264i 
> > HG Wien, DVR 0159701 
> > Johann Helf – Vorsitzender des Vorstandes 
> > Bruno Faustka – Mitglied des Vorstandes 
> > Christian Prelz – Vorsitzender des Aufsichtsrates 
> >  [attachment "test.zip" deleted by Thomas E. DeWeese/449433/EKC] 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org 

AW: Xlink Problem

Posted by Kerschbaum Michael <m....@pke.at>.
Hello,
 
I thing i get the problem. The application uses SymbolEventListener and MouseListener from the Swing Component. And the MouseListener listen to mouseMoved... everyTime when mouseMoved the Location from the Mouse is captured and the application tries to find a Node on this position.... If a node was found, the element for this node is located and then some action is made... Now i use only EventListener from Batik and the Link problem does not accure anymore...
 
The only problem is that do not know why....? I hate it if an error does not accure anymore, but i can't explain why ?!
 
I mean sometimes a NPE in public GraphicsNode nodeHitAt(Point2D p) in the class org.apache.batik.gvt.CompositeGraphicsNode occured. This method calls this method... and in this method a NPE occures....
 
    public Rectangle2D getSensitiveBounds() {
        if (sensitiveBounds != null)
            return sensitiveBounds;
 
        // System.out.println("sensitiveBoundsBounds are null");
        int i=0;
        while(sensitiveBounds == null && i < count){
            sensitiveBounds =
                children[i++].getTransformedSensitiveBounds(IDENTITY);
        }
 
        while (i<count) {
            Rectangle2D cgb = children[i++].getTransformedSensitiveBounds(IDENTITY);
            if (cgb != null) {
                if (sensitiveBounds == null)
                    // another thread has set the geometry bounds to null,
                    // need to recall this function
                    return getSensitiveBounds();  ==> line 407 !!
 
                sensitiveBounds.add(cgb); ==> NPE can't tell why ?! ==> line 409 !!
            }
        }
 
        return sensitiveBounds;
    }
 
Perhaps someone could tell me why....
 
This happens... it seems that the sensitiveBounds is null for a while, as long as this happens the method is called again... and then its not null anymore but, not really ?! 
 
[AWT-EventQueue-0] WARN AGComponent - java.lang.NullPointerException

java.lang.NullPointerException

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:409)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:407)

at org.apache.batik.gvt.CompositeGraphicsNode.getTransformedSensitiveBounds(CompositeGraphicsNode.java:435)

at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(CompositeGraphicsNode.java:397)

at org.apache.batik.gvt.CompositeGraphicsNode.nodeHitAt(CompositeGraphicsNode.java:490)

at at.pke.ag.AGComponent.getHitNode(AGComponent.java:4687)

at at.pke.ag.AGComponent$SymbolInteractor.mouseMoved(AGComponent.java:5437)

at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:272)

at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:271)

at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:271)

at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:271)

at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:271)

at java.awt.Component.processMouseMotionEvent(Component.java:5562)

at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3153)

at java.awt.Component.processEvent(Component.java:5286)

at java.awt.Container.processEvent(Container.java:1966)

at java.awt.Component.dispatchEventImpl(Component.java:3984)

at java.awt.Container.dispatchEventImpl(Container.java:2024)

at java.awt.Component.dispatchEvent(Component.java:3819)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3905)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)

at java.awt.Container.dispatchEventImpl(Container.java:2010)

at java.awt.Window.dispatchEventImpl(Window.java:1791)

at java.awt.Component.dispatchEvent(Component.java:3819)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

 
Mit freundlichen Grüßen Michael Kerschbaum

 

DI (FH) Michael Kerschbaum

PKE Electronics AG

Zentrale Wien / Entwicklung

Computerstraße 6

A - 1101 Wien

TEL: +43 (0) 50 150 - 1210

m.kerschbaum@pke.at

www.pke.at <http://www.pke.at/>  

 

Aktiengesellschaft mit dem Sitz in Wien

Firmenbuchnummer 103264i

HG Wien, DVR 0159701

Johann Helf - Vorsitzender des Vorstandes

Bruno Faustka - Mitglied des Vorstandes

Christian Prelz - Vorsitzender des Aufsichtsrates

 

________________________________

Von: Kerschbaum Michael [mailto:m.kerschbaum@pke.at] 
Gesendet: Mittwoch, 06. August 2008 15:30
An: batik-users@xmlgraphics.apache.org
Betreff: AW: Xlink Problem


Hello,
 
I tried this but no real success...
 
Okay i will explain what i do...
 
At creation time of the application i call that ... where AGUserAgent implements SVGUserAgent...
 
svgUserAgent = new AGUserAgent(this);
 
then when the user wants to load an SVG...
 
1.)Load a SVG Document..by
2.)On the do documentLoadingCompleted event i create an Instance of a Object i call SymbolManager.. this object parses some information within the SVG Document like we call "custProps",....  and creates Symbol objects, every Symbol has an Element (org.w3c.dom).. for this symbols i add EventListener... like
 
...
 public void addSymbolListeners(SVGOMElement elt) {
  elt.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, symbolListener,
    false);
  elt.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, symbolListener,
    false);
 }
 
... 
 
at this code it tried useCapture , true and false.... no real dífference...
 
this is the only code where i add Event Listeners
 
We also have "Layers" , for that we use the "layerMember", and some elements are not visible... when they have a not currently displayed Layer...
 
for that i use the code
 
...
 for (int i = 0; i < layerMembers.size(); i++) {
   Element elt = (Element) layerMembers.get(i);
   if (elt != null) {
 
    if (visible) {
         elt.removeAttributeNS(null, "visibility");
         elt.setAttributeNS(null, "pointer-events", "all");
     }
    else {
     elt.setAttributeNS(null, "visibility", "hidden");
     elt.setAttributeNS(null, "pointer-events", "none");
    }
....
 
If the application is in that situation, that the Links are not regocnized and the Events Listerns do not call the handleEvent... mostly it helps that i change the visibity of one layer... after this code was executed everythings seems to be normal ... but not 100 % sure.. ?!
 
Mit freundlichen Grüßen Michael Kerschbaum

 

DI (FH) Michael Kerschbaum

PKE Electronics AG

Zentrale Wien / Entwicklung

Computerstraße 6

A - 1101 Wien

TEL: +43 (0) 50 150 - 1210

m.kerschbaum@pke.at

www.pke.at <http://www.pke.at/>  

 

Aktiengesellschaft mit dem Sitz in Wien

Firmenbuchnummer 103264i

HG Wien, DVR 0159701

Johann Helf - Vorsitzender des Vorstandes

Bruno Faustka - Mitglied des Vorstandes

Christian Prelz - Vorsitzender des Aufsichtsrates

 

________________________________

Von: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Gesendet: Mittwoch, 06. August 2008 14:28
An: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Betreff: Re: Xlink Problem



Hi Kerschbaum,

"Kerschbaum Michael " <m....@pke.at> wrote on 08/06/2008 07:54:08 AM:

> I have still some problems. Currently with links in an SVG File. 
> When we define a link via xlink into a nother svg File, sometimes 
> the area for this link is not recognized as link (normally the mouse
> courser changed, and when you click on the area the link is exectued
> via the openLink method in the SVGUserAgent interface) 
>   
> I looks like that sometimes the Elements in the SVG Tree does not 
> react on Events . e.g. 

   My guess is that you have an event listener somewhere high in the tree 
(like the root SVG node) and you are listening during the 'bubble' phase 
of event propagation.  Since the Anchor captures the event to change 
the cursor and handle clicks it never bubbles back to the root of the 
SVG document.  So the simplest solution would be to change your event 
listener to listen during the 'capture' phase of event propagation 
(see the DOM level 2 Events Spec). 

>   
> SVGConstants.SVG_MOUSEOUT_EVENT_TYPE
> SVGConstants.SVG_MOUSEOVER_EVENT_TYPE 
>   
> because when this happens the handleEvent Method is never called. 
>   
> We defined the link ... like 
>   
> .... 
> <g id="group4975-140" v:layerMember="0">
>    
>    <g id="group4976-141" v:layerMember="0">
>     
>     <rect x="0" y="597" width="326.25" height="63" class="st15" />
>     <a xlink:href="LAGEPLAN.svg" xmlns:xlink="http://www.w3.org/1999/xlink">
>      <g id="shape4978-144" transform="translate(256.5,-33.3529)"> 
>   
> ... 
>   
> When this happens i still get MouseEvents on my JSVGComponent.... 
> but no events from org.w3c.dom.events.EventListener... ?! There is 
> no error in the console and no exception is thrown ?!... 
>   
> Mit freundlichen Grüßen Michael Kerschbaum 
>   
> DI (FH) Michael Kerschbaum 
> PKE Electronics AG 
> Zentrale Wien / Entwicklung 
> Computerstraße 6 
> A - 1101 Wien 
> TEL: +43 (0) 50 150 - 1210 
> m.kerschbaum@pke.at 
> www.pke.at 
>   
> Aktiengesellschaft mit dem Sitz in Wien 
> Firmenbuchnummer 103264i 
> HG Wien, DVR 0159701 
> Johann Helf - Vorsitzender des Vorstandes 
> Bruno Faustka - Mitglied des Vorstandes 
> Christian Prelz - Vorsitzender des Aufsichtsrates 
>  [attachment "test.zip" deleted by Thomas E. DeWeese/449433/EKC] 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org 

AW: Xlink Problem

Posted by Kerschbaum Michael <m....@pke.at>.
Hello,
 
I tried this but no real success...
 
Okay i will explain what i do...
 
At creation time of the application i call that ... where AGUserAgent implements SVGUserAgent...
 
svgUserAgent = new AGUserAgent(this);
 
then when the user wants to load an SVG...
 
1.)Load a SVG Document..by
2.)On the do documentLoadingCompleted event i create an Instance of a Object i call SymbolManager.. this object parses some information within the SVG Document like we call "custProps",....  and creates Symbol objects, every Symbol has an Element (org.w3c.dom).. for this symbols i add EventListener... like
 
...
 public void addSymbolListeners(SVGOMElement elt) {
  elt.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, symbolListener,
    false);
  elt.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, symbolListener,
    false);
 }
 
... 
 
at this code it tried useCapture , true and false.... no real dífference...
 
this is the only code where i add Event Listeners
 
We also have "Layers" , for that we use the "layerMember", and some elements are not visible... when they have a not currently displayed Layer...
 
for that i use the code
 
...
 for (int i = 0; i < layerMembers.size(); i++) {
   Element elt = (Element) layerMembers.get(i);
   if (elt != null) {
 
    if (visible) {
         elt.removeAttributeNS(null, "visibility");
         elt.setAttributeNS(null, "pointer-events", "all");
     }
    else {
     elt.setAttributeNS(null, "visibility", "hidden");
     elt.setAttributeNS(null, "pointer-events", "none");
    }
....
 
If the application is in that situation, that the Links are not regocnized and the Events Listerns do not call the handleEvent... mostly it helps that i change the visibity of one layer... after this code was executed everythings seems to be normal ... but not 100 % sure.. ?!
 
Mit freundlichen Grüßen Michael Kerschbaum

 

DI (FH) Michael Kerschbaum

PKE Electronics AG

Zentrale Wien / Entwicklung

Computerstraße 6

A - 1101 Wien

TEL: +43 (0) 50 150 - 1210

m.kerschbaum@pke.at

www.pke.at <http://www.pke.at/>  

 

Aktiengesellschaft mit dem Sitz in Wien

Firmenbuchnummer 103264i

HG Wien, DVR 0159701

Johann Helf - Vorsitzender des Vorstandes

Bruno Faustka - Mitglied des Vorstandes

Christian Prelz - Vorsitzender des Aufsichtsrates

 

________________________________

Von: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Gesendet: Mittwoch, 06. August 2008 14:28
An: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Betreff: Re: Xlink Problem



Hi Kerschbaum,

"Kerschbaum Michael " <m....@pke.at> wrote on 08/06/2008 07:54:08 AM:

> I have still some problems. Currently with links in an SVG File. 
> When we define a link via xlink into a nother svg File, sometimes 
> the area for this link is not recognized as link (normally the mouse
> courser changed, and when you click on the area the link is exectued
> via the openLink method in the SVGUserAgent interface) 
>   
> I looks like that sometimes the Elements in the SVG Tree does not 
> react on Events . e.g. 

   My guess is that you have an event listener somewhere high in the tree 
(like the root SVG node) and you are listening during the 'bubble' phase 
of event propagation.  Since the Anchor captures the event to change 
the cursor and handle clicks it never bubbles back to the root of the 
SVG document.  So the simplest solution would be to change your event 
listener to listen during the 'capture' phase of event propagation 
(see the DOM level 2 Events Spec). 

>   
> SVGConstants.SVG_MOUSEOUT_EVENT_TYPE
> SVGConstants.SVG_MOUSEOVER_EVENT_TYPE 
>   
> because when this happens the handleEvent Method is never called. 
>   
> We defined the link ... like 
>   
> .... 
> <g id="group4975-140" v:layerMember="0">
>    
>    <g id="group4976-141" v:layerMember="0">
>     
>     <rect x="0" y="597" width="326.25" height="63" class="st15" />
>     <a xlink:href="LAGEPLAN.svg" xmlns:xlink="http://www.w3.org/1999/xlink">
>      <g id="shape4978-144" transform="translate(256.5,-33.3529)"> 
>   
> ... 
>   
> When this happens i still get MouseEvents on my JSVGComponent.... 
> but no events from org.w3c.dom.events.EventListener... ?! There is 
> no error in the console and no exception is thrown ?!... 
>   
> Mit freundlichen Grüßen Michael Kerschbaum 
>   
> DI (FH) Michael Kerschbaum 
> PKE Electronics AG 
> Zentrale Wien / Entwicklung 
> Computerstraße 6 
> A - 1101 Wien 
> TEL: +43 (0) 50 150 - 1210 
> m.kerschbaum@pke.at 
> www.pke.at 
>   
> Aktiengesellschaft mit dem Sitz in Wien 
> Firmenbuchnummer 103264i 
> HG Wien, DVR 0159701 
> Johann Helf - Vorsitzender des Vorstandes 
> Bruno Faustka - Mitglied des Vorstandes 
> Christian Prelz - Vorsitzender des Aufsichtsrates 
>  [attachment "test.zip" deleted by Thomas E. DeWeese/449433/EKC] 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

Re: Xlink Problem

Posted by th...@kodak.com.
Hi Kerschbaum,

"Kerschbaum Michael " <m....@pke.at> wrote on 08/06/2008 07:54:08 
AM:

> I have still some problems. Currently with links in an SVG File. 
> When we define a link via xlink into a nother svg File, sometimes 
> the area for this link is not recognized as link (normally the mouse
> courser changed, and when you click on the area the link is exectued
> via the openLink method in the SVGUserAgent interface)
> 
> I looks like that sometimes the Elements in the SVG Tree does not 
> react on Events . e.g. 

   My guess is that you have an event listener somewhere high in the tree
(like the root SVG node) and you are listening during the 'bubble' phase
of event propagation.  Since the Anchor captures the event to change
the cursor and handle clicks it never bubbles back to the root of the
SVG document.  So the simplest solution would be to change your event
listener to listen during the 'capture' phase of event propagation 
(see the DOM level 2 Events Spec).

> 
> SVGConstants.SVG_MOUSEOUT_EVENT_TYPE
> SVGConstants.SVG_MOUSEOVER_EVENT_TYPE
> 
> because when this happens the handleEvent Method is never called.
> 
> We defined the link ... like
> 
> ....
> <g id="group4975-140" v:layerMember="0">
> 
>    <g id="group4976-141" v:layerMember="0">
> 
>     <rect x="0" y="597" width="326.25" height="63" class="st15" />
>     <a xlink:href="LAGEPLAN.svg" 
xmlns:xlink="http://www.w3.org/1999/xlink">
>      <g id="shape4978-144" transform="translate(256.5,-33.3529)">
> 
> ...
> 
> When this happens i still get MouseEvents on my JSVGComponent.... 
> but no events from org.w3c.dom.events.EventListener... ?! There is 
> no error in the console and no exception is thrown ?!...
> 
> Mit freundlichen Grüßen Michael Kerschbaum
> 
> DI (FH) Michael Kerschbaum
> PKE Electronics AG
> Zentrale Wien / Entwicklung
> Computerstraße 6
> A - 1101 Wien
> TEL: +43 (0) 50 150 - 1210
> m.kerschbaum@pke.at
> www.pke.at 
> 
> Aktiengesellschaft mit dem Sitz in Wien
> Firmenbuchnummer 103264i
> HG Wien, DVR 0159701
> Johann Helf ? Vorsitzender des Vorstandes
> Bruno Faustka ? Mitglied des Vorstandes
> Christian Prelz ? Vorsitzender des Aufsichtsrates
>  [attachment "test.zip" deleted by Thomas E. DeWeese/449433/EKC] 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org