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   * <small>
13   * <p/>
14   * Copyright (c)  2006  wbogaardt.
15   * This library is free software; you can redistribute it and/or
16   * modify it under the terms of the GNU Lesser General Public
17   * License as published by the Free Software Foundation; either
18   * version 2.1 of the License, or (at your option) any later version.
19   *
20   * This library is distributed in the hope that it will be useful,
21   * but WITHOUT ANY WARRANTY; without even the implied warranty of
22   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23   * Lesser General Public License for more details.
24   *
25   * You should have received a copy of the GNU Lesser General Public
26   * License along with this library; if not, write to the Free Software
27   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
28   * <p/>
29   * $File:  $ <br>
30   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Sep 19, 2006 1:44:11 PM $ <br>
31   * </small>
32   *
33   * @author wbogaardt
34   *         Listener for logbook frame
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  }