Thanks for your answer.
> > I'm using batik for a R&D project and I've got a problem using
> > the JSVGCanvas. In fact the problem is when I put the mouse
> > cursor in the canvas, it takes some seconds to highlight a shape
> > (by using onmouseover event, managed by java, not by ecma script).
> > Then moving the cursor highlights other shapes correctly, without
> > delay.
>
> Can you trace what the program is doing during this time?
> When is your runnable called, when does your runnable exit?
> Is it possible that the loading delay is your code?
What part do you want ? When I put the cursor over a shape ?
I made a test this morning, I loaded the svg in the canvas, avoiding to
move the cursor on it, and loaded the memory viewer. It indicates 7.7Mo.
I then move the cursor on the canvas, not on a shape, then it's not a
mouseover event, it's the canvas directly, and the monitor indicates
after 1s approx. 10Mo, it seems to load some classes no ? After that,
moving on a shape and highlighting it is immediate.
I so think that it's not a problem in my code (maybe I'm wrong :-)), or
it's in a part that I don't know (this could be that :-))
(How do I trace... ?)
>
> > Morever if I don't move the mouse over the canvas, updates made by
> > java (using updatemanager) are not showed. (This my main problem,
> > the delay is accessory)
>
> So this really sounds like you are not using the UpdateManager's
> RunnableQueue. Can you post some code that shows how you post the
> runnable? Also an example runnable would be useful (best of course
> is a standalone reproducable test case).
Well in fact I'm wrong, the updates are done, without moving on the
canvas.
For the runnable :
queueAction.invokeLater(
new Runnable() {
public void run() {
elt.setAttributeNS(null, "visibility", "visible");
}
}
);
where queueAction = canvas.getUpdateManager().getUpdateRunnableQueue();
This is not the method I use to highlight a shape but only the
setAttributeNS part changes :
elt.setAttributeNS(null, "class", "highlighted");
Sorry for the test case, I haven't one.
> >
> > In 1.5 release notes I saw that update's classes were
> loaded lazily.
> > Could it be the problem I encounter ? Is there a mean to make them
> > loaded at startup, not when firstly used ?
> > Actually, is this my problem ? :-)
> > (I use the updatemanager, then, it's not the problem)
>
> I think this refered to the Java Scripting engine which it
> sounds like
> you are not using.
Well, registering a listener on the DOM tree using the following is not
java scripting ?
OnAction onAction = new OnAction(dynUpdt, this);
Element gSets = svgDoc.getElementById("sets");
NodeList nodeList = gSets.getChildNodes();
int i=0;
Node elt;
while ((elt = nodeList.item(i++)) != null) {
if (elt.getNodeName() != "#text") {
EventTarget t = (EventTarget)elt;
t.addEventListener("mouseover", onAction.new Over(), false);
t.addEventListener("mouseout", onAction.new Out(), false);
t.addEventListener("click", onAction.new Click(), false);
}
}
Thanks, Olivier
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]