String ext = filename
.substring(filename.lastIndexOf('.') + 1);
if (ext.equalsIgnoreCase("svg"))
{
mxSvgCanvas canvas = (mxSvgCanvas) mxCellRenderer
.drawCells(graph, null, 1, null,
new CanvasFactory()
{
public mxICanvas createCanvas(
int width, int height)
{
mxSvgCanvas canvas = new mxSvgCanvas(
mxDomUtils.createSvgDocument(
width, height));
canvas.setEmbedded(true);
return canvas;
}
});
mxUtils.writeFile(mxXmlUtils.getXml(canvas.getDocument()),
filename);
}
else if (selectedFilter == vmlFileFilter)
{
mxUtils.writeFile(mxXmlUtils.getXml(mxCellRenderer