#35 tooltips java.lang.ClassCastException

open
nobody
TagLibrary (33)
5
2013-01-13
2003-09-25
Anonymous
No

Hi,

I have a jsp page that switch between a bar3D and a
pie3D graphics of the same data, I need to put tooltis on
both (bar and pie), to do that I create a class that
implements both CategoryToolTipGenerator and
PieToolTipGenerator, but when I switch to pie3D graph,
an java.lang.ClassCastException is thrown.

I see the source code, and I found that

private String generateToolTip(Dataset
dataset,ChartEntity ce)
{
String tooltip = null;
if (toolTipGenerator instanceof
CategoryToolTipGenerator)
{
CategoryItemEntity catEnt = (CategoryItemEntity) ce;
...
}
else if (toolTipGenerator instanceof
XYToolTipGenerator)
{
XYItemEntity xyEnt = (XYItemEntity) ce;
...
}
else if (toolTipGenerator instanceof
PieToolTipGenerator)
{
PieSectionEntity pieEnt = (PieSectionEntity) ce;
...
}
}

In the code I can see the always my class is instance of
CategoryToolTipGenerator (because implements the two
interfaces describes bellow), but I am actually displaying
a Pie3D, I expected that use my class as
PieToolTipGenerator.

JaimeS
jsalvador@eclac.cl

Discussion