01: /*
02: * Enhydra Java Application Server Project
03: *
04: * The contents of this file are subject to the Enhydra Public License
05: * Version 1.1 (the "License"); you may not use this file except in
06: * compliance with the License. You may obtain a copy of the License on
07: * the Enhydra web site ( http://www.enhydra.org/ ).
08: *
09: * Software distributed under the License is distributed on an "AS IS"
10: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11: * the License for the specific terms governing rights and limitations
12: * under the License.
13: *
14: * The Initial Developer of the Enhydra Application Server is Lutris
15: * Technologies, Inc. The Enhydra Application Server and portions created
16: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17: * All Rights Reserved.
18: *
19: * Contributor(s):
20: * Paul Mahar
21: *
22: */
23: package org.enhydra.kelp.common.dods;
24:
25: // ToolBox imports
26: import org.enhydra.tool.common.ButtonPanel;
27:
28: // Standard imports
29: import java.awt.Window;
30: import java.awt.event.ActionEvent;
31: import java.awt.event.ActionListener;
32: import java.lang.ref.WeakReference;
33:
34: //
35: public class DodsButtonListener implements ActionListener {
36: private WeakReference ref = null;
37:
38: public DodsButtonListener(CoreDodsTool tool) {
39: ref = new WeakReference(tool);
40: }
41:
42: public void actionPerformed(ActionEvent event) {
43: String command = event.getActionCommand();
44: if (command.equals(ButtonPanel.COMMAND_GENERATE)) {
45: getTool().generate();
46: } else if (command.equals(ButtonPanel.COMMAND_CLOSE)) {
47: getTool().closeWindow();
48: } else if (command.equals(ButtonPanel.COMMAND_HELP)) {
49: getTool().notifyHelpListeners(event.getSource());
50: } else if (command.equals(ButtonPanel.COMMAND_ABOUT)) {
51: getTool().showAbout();
52: }
53: }
54:
55: private CoreDodsTool getTool() {
56: return (CoreDodsTool) ref.get();
57: }
58:
59: }
|