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 Ga...@csiro.au on 2002/11/07 07:30:45 UTC
RE: Dynamic batik in applet & tool tip bug
Hi Thomas,
I think I have a solution for the tool tip bug I indicated
earlier (which fails with both 1.4.0 & 1.4.1).
Tool tips are managed in JSVGCanvas within the ToolTipModifier
class. It tries to fool the Canvas component that the mouse has
just entered and so should consider displaying a tool tip.
ToolTipModifier doesn't tell the Canvas component it is leaving
to remove the tool tip, but it does set the tool tip to null. I
have changed the JSVGCanvas.ToolTipModifier.handleEvent() code as
attached. Essentially creating a fake exit event. This fixes the
problem with my test example.
Why the problem only occurs when ALWAYS_DYNAMIC is set I do not
know. It is possible that there is a race condition between the
event that exits one SVG object and the event that enters the next
SVG object. Setting ALWAYS_DYNAMIC could alter the race condition
enough to fail. If that is the case then my code change is just
a work around and doesn't really fix the problem.
I did try synchronising the method but that had no effect.
Now if we can just fix the applet problem. :)
Gavin Walker
Gavin.Walker@csiro.au Computer Scientist
CSIRO Mathematical and Information Sciences Internet Marketplaces
GPO Box 664 tel: +61 2 6216 7030
CANBERRA ACT 2601 AUSTRALIA fax: +61 2 6216 7111
/* from JSVGCanvas.ToolTipModifier */
public void handleEvent(Event evt){
if (toolTip != null) {
setToolTipText(toolTip);
MouseEvent e = new MouseEvent(JSVGCanvas.this,
MouseEvent.MOUSE_ENTERED,
System.currentTimeMillis(),
0,
locationListener.getLastX(),
locationListener.getLastY(),
0,
false);
ToolTipManager.sharedInstance().mouseEntered(e);
} else {
MouseEvent e = new MouseEvent(JSVGCanvas.this,
MouseEvent.MOUSE_EXITED,
System.currentTimeMillis(),
0,
locationListener.getLastX(),
locationListener.getLastY(),
0,
false);
ToolTipManager.sharedInstance().mouseExited(e);
setToolTipText(null);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
RE: Dynamic batik in applet & tool tip bug
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "GW" == Gavin Walker <Ga...@csiro.au> writes:
GW> I think I have a solution for the tool tip bug I
GW> indicated earlier (which fails with both 1.4.0 & 1.4.1).
Thanks for tracking this down...
[...]
GW> Why the problem only occurs when ALWAYS_DYNAMIC is set I do not
GW> know. It is possible that there is a race condition between the
GW> event that exits one SVG object and the event that enters the next
GW> SVG object. Setting ALWAYS_DYNAMIC could alter the race condition
GW> enough to fail. If that is the case then my code change is just a
GW> work around and doesn't really fix the problem.
I suspect that the source of the problem is that we may be
calling setToolTipText in a thread other than the AWT Event thread.
I would test this myself (but as I said 1.4 don't work well for me),
could you try the following?
Given the information you have provided I feel pretty good that
this will work.
import java.awt.EventQueue;
[...]
/* from JSVGCanvas.ToolTipModifier */
public void handleEvent(Event evt){
final String tt = toolTip;
EventQueue.invokeLater(new Runnable() {
public void run() {
setToolTipText(tt);
}});
[...]
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org