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
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 }