1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 package ca.uhn.hl7v2.testpanel;
27
28
29 import java.awt.EventQueue;
30 import java.lang.reflect.Method;
31
32 import javax.swing.UIManager;
33
34 import org.apache.log4j.xml.DOMConfigurator;
35
36 import ca.uhn.hl7v2.testpanel.controller.Controller;
37 import ca.uhn.hl7v2.testpanel.controller.Prefs;
38 import ca.uhn.hl7v2.util.MessageIDGenerator;
39
40 public class App {
41
42
43 private static Controller myController;
44
45
46
47
48 public static void main(String[] args) {
49 System.setProperty("apple.laf.useScreenMenuBar", "true");
50 System.setProperty("com.apple.mrj.application.apple.menu.about.name", "HAPI TestPanel");
51 System.setProperty(MessageIDGenerator.NEVER_FAIL_PROPERTY, Boolean.TRUE.toString());
52
53 try {
54
55 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
56 } catch (Exception e) {
57 e.printStackTrace();
58 }
59
60 System.setProperty("tespanel.log.dir", Prefs.getTestpanelHomeDirectory().getAbsolutePath());
61 DOMConfigurator.configure(App.class.getClassLoader().getResource("log4j_testpanel.xml"));
62
63 myController = new Controller();
64
65
66 String osName = System.getProperty("os.name");
67 if (osName.startsWith("Mac OS X")) {
68 try {
69 Class<?> clazz = Class.forName("ca.uhn.hl7v2.testpanel.OSXInitializer");
70 Method runMethod = clazz.getMethod("run", Controller.class);
71 runMethod.invoke(clazz.newInstance(), myController);
72 } catch (Exception e) {
73 e.printStackTrace();
74 }
75 }
76
77
78 if (osName.toLowerCase().contains("win")) {
79 try {
80 Class<?> clazz = Class.forName("ca.uhn.hl7v2.testpanel.WindowsInitializer");
81 Method runMethod = clazz.getMethod("run", Controller.class);
82 runMethod.invoke(clazz.newInstance(), myController);
83 } catch (Exception e) {
84 e.printStackTrace();
85 }
86 }
87
88
89 if (osName.startsWith("Linux")) {
90 try {
91 Class<?> clazz = Class.forName("ca.uhn.hl7v2.testpanel.LinuxInitializer");
92 Method runMethod = clazz.getMethod("run", Controller.class);
93 runMethod.invoke(clazz.newInstance(), myController);
94 } catch (Exception e) {
95 e.printStackTrace();
96 }
97 }
98
99 EventQueue.invokeLater(new Runnable() {
100
101 public void run() {
102 try {
103 myController.start();
104
105 } catch (Exception e) {
106 e.printStackTrace();
107 }
108 }
109 });
110
111 }
112
113 }