xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John C. Turnbull" <ozem...@ozemail.com.au>
Subject RE: Problem rendering an SVG DOM built on the fly in Applet
Date Tue, 20 Jan 2009 23:44:35 GMT
Maybe try an existing SVG that you know renders OK and embed it in a String
and load the canvas with that to see if it renders.

John

> -----Original Message-----
> From: paddy [mailto:patrick_arnould@hotmail.co.uk]
> Sent: Wednesday, 21 January 2009 10:13
> To: batik-users@xmlgraphics.apache.org
> Subject: Re: Problem rendering an SVG DOM built on the fly in Applet
> 
> 
> Thanks for the quick reply, I tried it as below, but still no joy i'm
> afraid.
> This is the relevant code from DrawNode:
> 
> Element nodeElmt =
> m_objSVGDoc.createElementNS(m_objSVGDoc.getNamespaceURI(), "rect");
>         nodeElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "x",
> m_strX);
>         nodeElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "y",
> m_strY);
>         nodeElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "width",
> "40");
>         nodeElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(),
> "height",
> "40");
>         nodeElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "style",
> "stroke:black; fill:white;");
>         registerListeners(nodeElmt);
>         m_objSVGRoot.appendChild(nodeElmt);
>         array[0] = nodeElmt;
> 
>         Element txtElmt =
> m_objSVGDoc.createElementNS(m_objSVGDoc.getNamespaceURI(), "text");
>         Text value = m_objSVGDoc.createTextNode(m_strName);
>         txtElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "x",
> m_strX);
>         txtElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "y",
> m_strY);
>         txtElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "dx",
> "2");
>         txtElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "dy",
> "20");
>         txtElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(),
> "textLength",
> "36" );
>         txtElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(),
> "lengthAdjust", "spacingAndGlyphs" );
>         txtElmt.setAttributeNS(m_objSVGDoc.getNamespaceURI(), "style",
> "fill:black");
>         txtElmt.appendChild(value);
>         m_objSVGRoot.appendChild(txtElmt);
>         registerListeners(txtElmt);
>         array[1] = txtElmt;
> 
> 
> Is there something I should be doing when initialising the applet, or
> some
> special way the canvas has to be added to a swing component. I'm really
> at a
> loss.
> 
> 
> 
> Hi Paddy,
> 
> paddy <patrick_arnould@hotmail.co.uk> wrote on 01/20/2009 03:41:05 PM:
> 
> > Incidentally my DrawNode object just draws a rectangle on the SVG
> with a
> > label, and pnlSVGMain is directly on the applet.
> 
>    I suspect the problem is in your DrawNode code.  In particular I
> suspect that you are using 'createElement' instead of 'createElementNS'
> with the SVG_NAMESPACE_URI for the namespace.  It would produce
> exactly this sort of problem.
> 
> >             objSVGCanvas.setSVGDocument((SVGDocument)m_objSVGDoc);
> >             objSVGCanvas.repaint();
> 
>     The above repaint is not useful and could be harmful.  I suggest
> you remove it.  The Canvas will repaint as needed.
> 
> --
> View this message in context: http://www.nabble.com/Problem-rendering-
> an-SVG-DOM-built-on-the-fly-in-Applet-tp21571223p21573842.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-
> help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message