3 import java.awt.event.WindowAdapter;
4 import java.awt.event.WindowEvent;
5 import java.util.Locale;
7 import javax.swing.JFrame;
8 import javax.swing.JSplitPane;
9 import javax.swing.WindowConstants;
11 import tim.prune.gui.DetailsDisplay;
12 import tim.prune.gui.MapChart;
13 import tim.prune.gui.MenuManager;
14 import tim.prune.gui.ProfileChart;
17 * Tool to visualize, edit and prune GPS data
19 public class GpsPruner
21 public static final String VERSION_NUMBER = "1";
22 public static final String BUILD_NUMBER = "041";
23 private static App APP = null;
28 * @param args command line arguments
30 public static void main(String[] args)
35 if (args[0].startsWith("--locale="))
37 if (args[0].length() == 11)
38 locale = new Locale(args[0].substring(9));
39 else if (args[0].length() == 14)
40 locale = new Locale(args[0].substring(9, 11), args[0].substring(12));
42 System.out.println("Unrecognised locale '" + args[0].substring(9)
43 + "' - locale should be eg 'DE' or 'DE_ch'");
46 System.out.println("Unknown parameter '" + args[0] +
47 "'. Possible parameters:\n --locale= used for overriding locale settings\n");
49 I18nManager.init(locale);
55 * Launch the main application
57 private static void launch()
59 JFrame frame = new JFrame("Prune");
60 UpdateMessageBroker broker = new UpdateMessageBroker();
61 APP = new App(frame, broker);
64 MenuManager menuManager = new MenuManager(frame, APP, APP.getTrackInfo());
65 frame.setJMenuBar(menuManager.createMenuBar());
66 APP.setMenuManager(menuManager);
67 broker.addSubscriber(menuManager);
69 // Make three GUI components and add as listeners
70 DetailsDisplay leftPanel = new DetailsDisplay(APP, APP.getTrackInfo());
71 broker.addSubscriber(leftPanel);
72 MapChart mapDisp = new MapChart(APP, APP.getTrackInfo());
73 broker.addSubscriber(mapDisp);
74 ProfileChart profileDisp = new ProfileChart(APP.getTrackInfo());
75 broker.addSubscriber(profileDisp);
77 JSplitPane rightPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mapDisp, profileDisp);
78 rightPane.setResizeWeight(1.0); // allocate as much space as poss to map
79 frame.getContentPane().add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel,
81 // add closing listener
82 frame.addWindowListener(new WindowAdapter() {
83 public void windowClosing(WindowEvent e) {
87 // Avoid automatically shutting down if window closed
88 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
90 // finish off and display frame
92 frame.setSize(600, 450);