2 * Copyright © 2010 Anthony Towns
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 import java.util.ArrayList;
25 import java.awt.event.*;
27 import org.altusmetrum.altoslib_13.*;
28 import org.altusmetrum.altosuilib_13.*;
30 import org.jfree.chart.ChartPanel;
31 import org.jfree.chart.JFreeChart;
32 import org.jfree.ui.RefineryUtilities;
34 public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, AltosUnitsListener, AltosFilterListener
40 TestStatsTable statsTable;
42 public void font_size_changed(int font_size) {
43 if (statsTable != null)
44 statsTable.font_size_changed(font_size);
47 public void units_changed(boolean imperial_units) {
49 enable.units_changed(imperial_units);
52 AltosUIFlightSeries flight_series;
54 public void filter_changed(double speed_filter, double accel_filter) {
55 flight_series.set_filter(speed_filter, accel_filter);
56 graph.filter_changed();
57 stats = new TestStats(flight_series);
58 statsTable.filter_changed(stats);
61 public double speed_filter() {
62 return flight_series.speed_filter_width;
65 public double accel_filter() {
66 return flight_series.accel_filter_width;
69 AltosGraphUI(AltosRecordSet set, File file) throws InterruptedException, IOException {
70 super(file.getName());
71 AltosCalData cal_data = set.cal_data();
74 pane = new JTabbedPane();
76 flight_series = new AltosUIFlightSeries(cal_data);
78 enable = new AltosUIEnable(this);
80 set.capture_series(flight_series);
82 flight_series.finish();
84 stats = new TestStats(flight_series);
86 graph = new TestStandGraph(enable, stats, flight_series);
88 statsTable = new TestStatsTable(stats);
90 pane.add("Test Graph", graph.panel);
91 pane.add("Configure Graph", enable);
92 pane.add("Test Statistics", statsTable);
94 setContentPane (pane);
96 AltosUIPreferences.register_font_listener(this);
97 AltosPreferences.register_units_listener(this);
99 addWindowListener(new WindowAdapter() {
101 public void windowClosing(WindowEvent e) {
102 AltosUIPreferences.unregister_font_listener(AltosGraphUI.this);
103 AltosPreferences.unregister_units_listener(AltosGraphUI.this);