# HG changeset patch # User berghofe # Date 1003755316 -7200 # Node ID 6ac0627167ed641440d25c0618cd7dfbc35bba51 # Parent 5fcf6b6436af40034f9b4c2fc11ce490182c7d1c Fixed problem with batch mode layout, which caused an AWT exception when no X11 connection was available. diff -r 5fcf6b6436af -r 6ac0627167ed lib/browser/GraphBrowser/GraphBrowser.java --- a/lib/browser/GraphBrowser/GraphBrowser.java Mon Oct 22 14:53:52 2001 +0200 +++ b/lib/browser/GraphBrowser/GraphBrowser.java Mon Oct 22 14:55:16 2001 +0200 @@ -127,11 +127,12 @@ return tb==null; } - public void initBrowser(InputStream is) { + public void initBrowser(InputStream is, boolean noAWT) { try { - TreeNode tn=new TreeNode("Root","",-1,true); - gv=new GraphView(new Graph(is,tn),this); - tb=new TreeBrowser(tn,gv); + Font font = noAWT ? null : new Font("Helvetica", Font.PLAIN, 12); + TreeNode tn = new TreeNode("Root", "", -1, true); + gv = new GraphView(new Graph(is, tn), this, font); + tb = new TreeBrowser(tn, gv, font); gv.setTreeBrowser(tb); Vector v = new Vector(10,10); tn.collapsedDirectories(v); @@ -175,7 +176,7 @@ gfname=getParameter("graphfile"); try { InputStream is=(new URL(getDocumentBase(), gfname)).openConnection().getInputStream(); - initBrowser(is); + initBrowser(is, false); is.close(); } catch (MalformedURLException exn) { System.err.println("Invalid URL: "+gfname); @@ -190,22 +191,20 @@ GraphBrowser gb=new GraphBrowser(args.length > 0 ? args[0] : ""); if (args.length > 0) { InputStream is=new FileInputStream(args[0]); - gb.initBrowser(is); + gb.initBrowser(is, args.length > 1); is.close(); } if (args.length > 1) { try { - if (args[1].endsWith(".ps")) { + if (args[1].endsWith(".ps")) gb.gv.PS(args[1], true); - } else if (args[1].endsWith(".eps")) { + else if (args[1].endsWith(".eps")) gb.gv.PS(args[1], false); - } else { + else System.err.println("Unknown file type: " + args[1]); - } } catch (IOException exn) { System.err.println("Unable to write file " + args[1]); } - System.exit(0); } else { f=new GraphBrowserFrame(gb); f.setSize(700,500);