1 /*************************************************************************** |
1 /*************************************************************************** |
2 Title: GraphBrowser/Console.java |
2 Title: GraphBrowser/Console.java |
3 ID: $Id$ |
3 ID: $Id$ |
4 Author: Stefan Berghofer, TU Muenchen |
4 Author: Gerwin Klein, TU Muenchen |
5 License: GPL (GNU GENERAL PUBLIC LICENSE) |
5 License: GPL (GNU GENERAL PUBLIC LICENSE) |
6 |
6 |
7 This is the graph browser's main class when run as a console application. |
7 This is the graph browser's main class when run as a console application. |
8 |
8 |
9 ***************************************************************************/ |
9 ***************************************************************************/ |
15 import java.net.*; |
15 import java.net.*; |
16 import awtUtilities.*; |
16 import awtUtilities.*; |
17 |
17 |
18 public class Console { |
18 public class Console { |
19 Graph g; |
19 Graph g; |
20 // TreeBrowser tb; |
|
21 String gfname; |
20 String gfname; |
22 |
21 |
23 public Console(String name) { |
22 public Console(String name) { |
24 gfname = name; |
23 gfname = name; |
25 } |
24 } |
26 |
25 |
27 public void PS(String fname,boolean printable) throws IOException { |
26 public void PS(String fname, boolean printable) throws IOException { |
28 g.layout(null); |
27 g.layout(null); |
29 g.PS(fname,printable); |
28 g.PS(fname,printable); |
30 } |
29 } |
31 |
30 |
32 public void initBrowser(InputStream is) { |
31 public void initBrowser(InputStream is) { |
33 try { |
32 try { |
34 TreeNode tn = new TreeNode("Root", "", -1, true); |
33 TreeNode tn = new TreeNode("Root", "", -1, true); |
35 g = new Graph(is, tn); |
34 g = new Graph(is, tn); |
36 |
|
37 // gv = new GraphView(new Graph(is, tn), null, null); |
|
38 // tb = new TreeBrowser(tn, gv, font); |
|
39 // gv.setTreeBrowser(tb); |
|
40 // Vector v = new Vector(10,10); |
|
41 // tn.collapsedDirectories(v); |
|
42 // gv.collapseDir(v); |
|
43 } catch (IOException exn) { |
35 } catch (IOException exn) { |
44 System.err.println("\nI/O error while reading graph file."); |
36 System.err.println("\nI/O error while reading graph file."); |
45 } catch (ParseError exn) { |
37 } catch (ParseError exn) { |
46 System.err.println("\nParse error in graph file:"); |
38 System.err.println("\nParse error in graph file:"); |
47 System.err.println(exn.getMessage()); |
39 System.err.println(exn.getMessage()); |
48 System.err.println("\nSyntax:\n<vertexname> <vertexID> <dirname> [ + ] <path> [ < | > ] [ <vertexID> [ ... [ <vertexID> ] ... ] ] ;"); |
40 System.err.println("\nSyntax:\n<vertexname> <vertexID> <dirname> [ + ] <path> "+ |
|
41 "[ < | > ] [ <vertexID> [ ... [ <vertexID> ] ... ] ] ;"); |
49 } |
42 } |
50 } |
43 } |
51 |
44 |
52 public static void main(String[] args) { |
45 public static void main(String[] args) { |
53 try { |
46 try { |
54 if (args.length <= 1) { |
47 if (args.length <= 1) { |
55 System.err.println("Graph and output file expected"); |
48 System.err.println("Graph and output file expected."); |
56 return; |
49 return; |
57 } |
50 } |
|
51 |
58 Console console=new Console(args[0]); |
52 Console console=new Console(args[0]); |
59 |
|
60 InputStream is=new FileInputStream(args[0]); |
53 InputStream is=new FileInputStream(args[0]); |
61 console.initBrowser(is); |
54 console.initBrowser(is); |
62 is.close(); |
55 is.close(); |
63 |
56 |
64 try { |
57 try { |