Thomas DeWeesewrote:

> > 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
?
>
> > When a SVG document is generated (for example, with Java code, or a WMF
> > file), one output SVG clippath is generated for each input path, even if
> > the input path is not clipped. This leads to a lot of (unnecessary ?)
> > clippings in the SVG output document. By subclassing the SVGGraphics2D
> > class, I am able to generate only the few necessary output clippings
> > (the output path is clipped only if the corresponding input path is
> > clipped)
>
>     How do you determine if the path being drawn needs to be clipped?
>
I use a very naive (and may be wrong) implementation : I clip the output
path only if the input is clipped (performed in a subclass of
GraphicContext). In fact, as I was not sure it was "valid", I allowed to
choose between the Batik clipping behavior and this new one.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to