1   package org.wcb.gui.event;
2   
3   import org.wcb.gui.dialog.RecencyExperienceDialog;
4   import org.wcb.gui.LogbookFrame;
5   import org.wcb.resources.MessageResourceRegister;
6   import org.wcb.resources.MessageKey;
7   
8   import javax.swing.*;
9   import java.awt.event.ActionListener;
10  import java.awt.event.ActionEvent;
11  
12  /**
13  * <small>
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: Mar 30, 2006 10:35:19 AM $ <br>
31   * </small>
32   */
33  
34  public class FlightExperienceListener implements ActionListener {
35  
36      private LogbookFrame frame;
37      private RecencyExperienceDialog dialog;
38  
39      public FlightExperienceListener(LogbookFrame frame) {
40          this.frame = frame;
41          dialog = new RecencyExperienceDialog();
42          dialog.addActionListener(this);
43      }
44  
45      public void actionPerformed(ActionEvent evt) {
46          Object src = evt.getSource();
47          if (src instanceof JMenuItem) {
48              dialog.refresh();
49              frame.showJDialogAsSheet(dialog);
50          }
51          if (evt.getActionCommand().equalsIgnoreCase(MessageResourceRegister.getInstance().getValue(MessageKey.BUTTON_CLOSE))) {
52              frame.hideSheet();
53          }
54      }
55  }