01: /*
02: ** $Id: FrameView.java,v 1.5 2000/10/26 08:34:15 mrw Exp $
03: **
04: ** Mike Wilson, July 2000, mrw@whisperingwind.co.uk
05: **
06: ** (C) Copyright 2000, Mike Wilson, Reading, Berkshire, UK
07: **
08: ** This program is free software; you can redistribute it and/or modify
09: ** it under the terms of the GNU General Public License as published by
10: ** the Free Software Foundation; either version 2 of the License, or
11: ** (at your option) any later version.
12: **
13: ** This program is distributed in the hope that it will be useful,
14: ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15: ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: ** GNU General Public License for more details.
17: **
18: ** You should have received a copy of the GNU Library General
19: ** Public License along with this library; if not, write to the
20: ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21: ** Boston, MA 02111-1307 USA.
22: */
23:
24: package uk.co.whisperingwind.framework;
25:
26: import java.awt.event.ActionListener;
27: import java.awt.event.ActionEvent;
28: import javax.swing.JDialog;
29: import javax.swing.JFrame;
30:
31: /**
32: ** View which has a JFrame.
33: */
34:
35: public abstract class FrameView extends View {
36: protected JFrame content = null;
37: protected AllActionListener actionListener = null;
38:
39: public FrameView() {
40: content = new JFrame();
41: content.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
42: actionListener = new AllActionListener();
43: }
44:
45: public JFrame getContent() {
46: return content;
47: }
48:
49: public void closeDialog() {
50: content.setVisible(false);
51: cleanUp();
52: ((JFrame) content).dispose();
53: }
54:
55: /**
56: ** FrameView has one instance of this. It listens to all button and
57: ** menu action events and passes these on to the controller.
58: */
59:
60: private class AllActionListener implements ActionListener {
61: public void actionPerformed(ActionEvent event) {
62: fireEvent(event.getActionCommand());
63: }
64: }
65: }
|