1 package org.catacomb.dataview;
2
3 import java.io.File;
4
5 import org.catacomb.dataview.gui.DViewController;
6 import org.catacomb.druid.build.Druid;
7 import org.catacomb.druid.load.DruidAppBase;
8 import org.catacomb.druid.load.DruidResourceLoader;
9 import org.catacomb.interlish.service.ResourceAccess;
10 import org.catacomb.interlish.service.ResourceLoader;
11 import org.catacomb.report.E;
12 import org.catacomb.util.FileUtil;
13
14
15 public class DView {
16
17 DViewController controller;
18
19 static boolean doneInit = false;
20
21
22 public static void main(String[] argv) {
23
24 if (argv.length == 1) {
25 File f = new File(argv[0]);
26
27
28
29
30
31
32
33 String s = FileUtil.readStringFromFile(f);
34 E.info("file spec " + s);
35
36 DView dview = new DView(f);
37 dview.makeImages(f.getParentFile());
38 } else {
39 E.info("USAGE: dview file");
40 }
41 }
42
43
44
45
46
47 public DView(File f) {
48 if (!doneInit) {
49 doneInit = true;
50 DruidAppBase.init("dview", new CCVizRoot());
51 }
52
53 ResourceLoader rl = new DruidResourceLoader();
54 ResourceAccess.setResourceLoader(rl);
55
56
57 String configPath = "org.catacomb.dataview.gui.DView";
58
59
60 Druid druid = new Druid(configPath);
61
62 druid.whizzBang();
63
64
65
66 controller = (DViewController)druid.getController();
67 controller.open(f);
68
69 druid.packShow();
70 }
71
72
73 public void makeImages(File fdirin) {
74 File fdir = fdirin;
75 if (!fdir.isDirectory()) {
76 fdir = fdir.getAbsoluteFile().getParentFile();
77 }
78 controller.makeImages(fdir);
79 }
80
81
82 }