private void loadURL(URL url)
{
boolean verbose = cmCheck_verbose.isSelected();
// SVGUniverse universe = new SVGUniverse();
SVGUniverse universe = SVGCache.getSVGUniverse();
SVGDiagram diagram = null;
URI uri;
if (!CheckBoxMenuItem_anonInputStream.isSelected())
{
//Load from a disk with a valid URL
uri = universe.loadSVG(url);
if (verbose) System.err.println("Loading document " + uri.toString());
diagram = universe.getDiagram(uri);
}
else
{
//Load from a stream with no particular valid URL
try
{
InputStream is = url.openStream();
uri = universe.loadSVG(is, "defaultName");
if (verbose) System.err.println("Loading document " + uri.toString());
}
catch (Exception e)
{
e.printStackTrace();
return;
}
}
/*
ByteArrayOutputStream bs = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bs);
os.writeObject(universe);
os.close();
ByteArrayInputStream bin = new ByteArrayInputStream(bs.toByteArray());
ObjectInputStream is = new ObjectInputStream(bin);
universe = (SVGUniverse)is.readObject();
is.close();
*/
diagram = universe.getDiagram(uri);
svgDisplayPanel.setDiagram(diagram);
repaint();
}