Hi Herv�,
Herv� Girod wrote:
I think I understand the reason of my problem (at least the beginning). In
my application, I use a tabbed pane to show the various SVG documents. When
I load a new document, sometimes the canvas of some of the previously loaded
tabs fire selection events. I never do anything to disallow not showing tabs
to fire selection events,
I'm not entirely sure why any special action should be needed (why would they get event's if they aren't showing)...
do I need to do that (I think so), and how ? (may be set eventsEnabled to false ?).
Unfortunately, I think this only works at initialization time (when the document is loaded).
Herv� Girod wrote:
I have two questions about Batik. They are about the current 1.6 version, but I think they also apply to the previous version :
Hi,
I write an application using Batik at its core, to show and modify SVG images. I have sometimes an IllegalComponentStateException "component must be showing on the screen to determine its location"
when
loading a SVG file in a JSVGCanvas, where the class MouseMoveRunnable (used internally in JSVGComponent) perform the run() method (the code
is
: eventDispatcher.mouseMoved(event)). Is it due to Batik, or do I use wrongly the JSVGCanvas class ?
I suspect that it is something in your code but I'm not sure how it would happen. Are you artificially dispatching events to the canvas? There is even a check for the component being visible before we call getLocationOnScreen so I have a really hard time understanding where this one comes from.
After looking at my code, here are some facts to help understanding my problem (or so I think) : * I wanted to be able to select shapes (not only text), so I created a ShapeSelectionManager class in the event handlng initialization, in the pattern of Batik TextSelectionManager. This component dispatch events as
the
TextSelectionManager do. To do this, I subclassed the JSVGCanvas class. * I looked at the code of AWTEventDispatcher, to see if I could detect what in my code could create that, and as you say, you check if the component is showing before getting its location on the screen !! * and I think the most important : even if I register the listeners on gvt build events provided by the canvas, I don't use the
"gvtBuildCompleted"
event, so may be my problem is due to a sort of race condition (gvt not finished sometimes when I check for mouse events on the canvas). Do I have to disable mouse events before the build is completed or something like
that ?
I would think that it would be good to disable mouse event handling until the document is fully built. The GVT/SVG components initialize this in the 'initializeEventHandling' method so you could subclass that and register your listeners in there. Perhaps you are thinking that this isn't the problem anymore however...
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
