# HG changeset patch # User kleing # Date 1052322048 -7200 # Node ID fac2aa7618ed8756c13b1c664c417c3d6d22f1d9 # Parent aa5b6c8c7c4ca666d436feff14fcb4f45cfea835 fixed uncollapsed dirs (should be collapsed by default) diff -r aa5b6c8c7c4c -r fac2aa7618ed lib/browser/GraphBrowser/Console.java --- a/lib/browser/GraphBrowser/Console.java Wed May 07 17:06:11 2003 +0200 +++ b/lib/browser/GraphBrowser/Console.java Wed May 07 17:40:48 2003 +0200 @@ -5,6 +5,8 @@ License: GPL (GNU GENERAL PUBLIC LICENSE) This is the graph browser's main class when run as a console application. + It duplicates some logic from GraphBrowser and GraphView. + It does so to remove dependency on AWT. ***************************************************************************/ @@ -17,7 +19,7 @@ public class Console { Graph g; - String gfname; + String gfname; public Console(String name) { gfname = name; @@ -28,10 +30,29 @@ g.PS(fname,printable); } + + public void collapseNodes(Vector collapsedDir) { + Enumeration e1=collapsedDir.elements(); + Graph gra=(Graph)(g.clone()); + + while (e1.hasMoreElements()) { + Directory d=(Directory)(e1.nextElement()); + Vector v=gra.decode(d.getCollapsed()); + if (!v.isEmpty()) + gra.collapse(v,"["+d.getName()+"]",d.getCollapsed()); + } + + g = gra; + } + + public void initBrowser(InputStream is) { try { TreeNode tn = new TreeNode("Root", "", -1, true); g = new Graph(is, tn); + Vector v = new Vector(10,10); + tn.collapsedDirectories(v); + collapseNodes(v); } catch (IOException exn) { System.err.println("\nI/O error while reading graph file."); } catch (ParseError exn) {