1 package org.wcb.gui.event;
2
3 import org.wcb.gui.LogbookFrame;
4 import org.wcb.gui.dialog.Faa8710Dialog;
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 import java.awt.*;
12
13 /**
14 * <small>
15 * <p/>
16 * Copyright (c) 2006 wbogaardt.
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 * <p/>
31 * </small>
32 * <p/>
33 * $File: $ <br>
34 * $Change: $ submitted by $Author: wbogaardt $ at $DateTime: Aug 31, 2006 4:19:38 PM $ <br>
35 * </small>
36 *
37 * @author wbogaardt
38 * Listener to display dialog in a box on the form.
39 */
40
41 public class Faa8710DialogListener implements ActionListener {
42 private LogbookFrame frame;
43 private Faa8710Dialog dialog;
44
45 public Faa8710DialogListener(LogbookFrame frame) {
46 this.frame = frame;
47 dialog = new Faa8710Dialog();
48 dialog.addActionListener(this);
49 dialog.setMinimumSize(new Dimension(800,400));
50 }
51
52 public void actionPerformed(ActionEvent evt) {
53 Object src = evt.getSource();
54 if (src instanceof JMenuItem) {
55 dialog.refresh();
56 frame.showJDialogAsSheet(dialog);
57 }
58 if (evt.getActionCommand().equalsIgnoreCase(MessageResourceRegister.getInstance().getValue(MessageKey.BUTTON_CLOSE))) {
59 frame.hideSheet();
60 }
61 }
62 }