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 Thomas E Deweese <th...@kodak.com> on 2002/12/03 19:14:16 UTC
RE: batik JSVGCanvas won't display
>>>>> "BR" == Baron, Randy {PRG~Basel} <RA...@Roche.COM> writes:
BR> but get an error like this:
BR> java.lang.NullPointerException at
BR> org.apache.batik.bridge.CSSUtilities.getComputedStyle(Unknown
BR> Source) at
You are not setting the CSSEngine on the BridgeContext.
BR> The source that corresponds to this error comes from this method:
String elementText =
aTextElement.getFirstChild().getNodeValue();
log.debug(" the element's text: " + elementText);
int textLength = elementText.length();
// Given the Element representing the current line of sequence,
find it's x0,y0 and height & width using GVT methods.
Element overlayRect = doc.createElementNS(svgNS, "rect");
GVTBuilder builder = new GVTBuilder();
BridgeContext ctx = new BridgeContext(new UserAgentAdapter());
GraphicsNode aTextElementNode = builder.build(ctx,
aTextElement);
double width = aTextElementNode.getBounds().getWidth();
double height = aTextElementNode.getBounds().getHeight();
double x = aTextElementNode.getBounds().getX();
double y = aTextElementNode.getBounds().getMinY();
(...code continues)
BR> I thought of and tried to test for various things like maybe
BR> there wasn't a big enough Frame or JSVGCanvas or something funny
BR> was happening with the timing of the JSVGCanvas creation, but
BR> haven't had an luck. I suspect it has something to do with the
BR> BridgeContext or maybe UserAgent, but don't really know.
BR> Any ideas would be appreciated.
You could provide a CSSEngine but I wonder why you are bothering to
build this second SVG tree? Why not just query the tree you already
have?
BridgeContext context = /* get the BridgeContext used to build
gvt tree possibly by subclassing
JSVGCanvas */
GraphicsNode aTextElementNode = context.getGraphicsNode(aTextElement);
/*...*/
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org