Hi, I'm trying to change the GraphicsNode color of a relative DOM element via
the BridgeContext but I get as casting error "CompositeGraphicsNode cannot
be cast to ShapeNode". Here is my code:

BridgeContext bc = ((JSVGCanvas) c).getUpdateManager().getBridgeContext();
bc.setDynamic(true);
bc.setInteractive(true);

// This is a CompositeGraphicsNode (implements GraphicsNode)
GraphicsNode gn = (GraphicsNode) bc.getGraphicsNode(element);

ShapeNode sn = (ShapeNode)gn;  <---------- THIS CAST DOESN'T WORK
ShapePainter sp = sn.getShapePainter();
StrokeShapePainter painter = new StrokeShapePainter(sn.getShape());
painter.setPaint(Color.YELLOW);
painter.setStroke(new BasicStroke(10.0f));
sn.setShapePainter(painter);


On the ShapeNode casting I get the following error:

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:
org.apache.batik.gvt.CompositeGraphicsNode cannot be cast to
org.apache.batik.gvt.ShapeNode

Any ideas or suggestion on what to do? Thanks



-- 
View this message in context: 
http://www.nabble.com/CompositeGraphicsNode-to-ShapeNode-tp24531759p24531759.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to