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 // Version 2, released 29 March 2007, 1 April 2007
22 public static final String VERSION_NUMBER = "2";
23 public static final String BUILD_NUMBER = "056";
24 private static App APP = null;
29 * @param args command line arguments
31 public static void main(String[] args)
36 if (args[0].startsWith("--locale="))
38 if (args[0].length() == 11)
39 locale = new Locale(args[0].substring(9));
40 else if (args[0].length() == 14)
41 locale = new Locale(args[0].substring(9, 11), args[0].substring(12));
43 System.out.println("Unrecognised locale '" + args[0].substring(9)
44 + "' - locale should be eg 'DE' or 'DE_ch'");
47 System.out.println("Unknown parameter '" + args[0] +
48 "'. Possible parameters:\n --locale= used for overriding locale settings\n");
50 I18nManager.init(locale);
56 * Launch the main application
58 private static void launch()
60 JFrame frame = new JFrame("Prune");
61 UpdateMessageBroker broker = new UpdateMessageBroker();
62 APP = new App(frame, broker);
65 MenuManager menuManager = new MenuManager(frame, APP, APP.getTrackInfo());
66 frame.setJMenuBar(menuManager.createMenuBar());
67 APP.setMenuManager(menuManager);
68 broker.addSubscriber(menuManager);
70 // Make three GUI components and add as listeners
71 DetailsDisplay leftPanel = new DetailsDisplay(APP, APP.getTrackInfo());
72 broker.addSubscriber(leftPanel);
73 MapChart mapDisp = new MapChart(APP, APP.getTrackInfo());
74 broker.addSubscriber(mapDisp);
75 ProfileChart profileDisp = new ProfileChart(APP.getTrackInfo());
76 broker.addSubscriber(profileDisp);
78 JSplitPane rightPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mapDisp, profileDisp);
79 rightPane.setResizeWeight(1.0); // allocate as much space as poss to map
80 frame.getContentPane().add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel,
82 // add closing listener
83 frame.addWindowListener(new WindowAdapter() {
84 public void windowClosing(WindowEvent e) {
88 // Avoid automatically shutting down if window closed
89 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
91 // finish off and display frame
93 frame.setSize(600, 450);