1 package org.wcb.gui.event;
2
3 import org.wcb.gui.LogbookFrame;
4 import org.wcb.gui.dialog.AirportTableDisplayDialog;
5 import org.wcb.gui.dialog.AircraftTableDisplayDialog;
6
7 import java.awt.event.ActionListener;
8 import java.awt.event.ActionEvent;
9 import java.awt.*;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 public class FrameDialogListener implements ActionListener {
38
39 private LogbookFrame frame;
40 private AirportTableDisplayDialog airportDialog;
41 private AircraftTableDisplayDialog aircraftDialog;
42
43 public FrameDialogListener(LogbookFrame frames) {
44 frame = frames;
45 airportDialog = new AirportTableDisplayDialog();
46 aircraftDialog = new AircraftTableDisplayDialog();
47 }
48
49 public void actionPerformed(ActionEvent evt) {
50 String command = evt.getActionCommand();
51 if (command.equalsIgnoreCase("Airports")) {
52 airportDialog.refresh();
53 airportDialog.setVisible(true);
54 }
55 if (command.equalsIgnoreCase("Aircraft")) {
56 aircraftDialog.refresh();
57 aircraftDialog.setVisible(true);
58 }
59 if (command.equalsIgnoreCase("Logbook")) {
60 CardLayout cl = (CardLayout) frame.getCardPanel().getLayout();
61 cl.show(frame.getCardPanel(), LogbookFrame.LOGBOOK_VIEW);
62 frame.hideSheet();
63 }
64 if (command.equalsIgnoreCase("Summary")) {
65 CardLayout cl = (CardLayout) frame.getCardPanel().getLayout();
66 frame.refreshSummaryReport();
67 cl.show(frame.getCardPanel(), LogbookFrame.SUMMARY_REPORT_VIEW);
68 }
69 }
70 }