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