xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From malliksomepalli <mallik.somepa...@gmail.com>
Subject How to Attatch Label to DOM node and connectors between nodes
Date Thu, 26 Oct 2006 00:52:19 GMT

Hi,

Can anyone tell me how i can attatch labels to the nodes.Also how can i
render connectors between nodes.I am using DOM API to create SVGdocument and
rasterizing it with transcoder.I can see the shapes i added,But the
connectors between nodes are not rendered.Here is my code.

DOMImplementation docImpl=SVGDOMImplementation.getDOMImplementation();
	    SVGDocument document=(SVGDocument)
docImpl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", null);
	    Element rootnode=document.getDocumentElement();
	  
	    Element first=document.createElementNS(SVG_NAMESPACE_URI,"rect");
	    first.setAttributeNS(null,"width","40");
	    first.setAttributeNS(null,"height","20");
	    first.setAttributeNS(null,"x","100");
	    first.setAttributeNS(null,"y","50");
	    first.setAttributeNS(null,"style", "fill:white;stroke:blue;
stroke-width:1");

 Element second=document.createElementNS(SVG_NAMESPACE_URI,"rect");
	    second.setAttributeNS(null,"width","40");
	    second.setAttributeNS(null,"height","20");
	    second.setAttributeNS(null,"x","100");
	    second.setAttributeNS(null,"y","120");
	    second.setAttributeNS(null,"style", "fill:white;stroke:blue;
stroke-width:1");

 rootnode.appendChild(first);
	    rootnode.appendChild(second);

JPEGTranscoder t = new JPEGTranscoder();
        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new Float(0.8));
        t.addTranscodingHint(JPEGTranscoder.KEY_MAX_WIDTH,new Float(500));
        t.addTranscodingHint(ImageTranscoder.KEY_BACKGROUND_COLOR,
Color.CYAN); 
        TranscoderInput input = new TranscoderInput(document);
        OutputStream ostream = new FileOutputStream("1.jpg");
        TranscoderOutput output = new TranscoderOutput(ostream);
        t.transcode(input, output);
        ostream.flush();
        ostream.close();

Is there any attribute name for labels?Do i need to do anything other than
creating nodes and appending them to get a tree structure with connectors
between parent and child nodes.Anyhelp is verymuch appreciated.

Thanks.



-- 
View this message in context: http://www.nabble.com/How-to-Attatch-Label-to-DOM-node-and-connectors-between-nodes-tf2511187.html#a7003368
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


Mime
View raw message