KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > ant > deployer > AntDeployButtonListener


1 package org.enhydra.kelp.ant.deployer;
2
3 /**
4  * <p>Title: </p>
5  * <p>Description: </p>
6  * <p>Copyright: Copyright (c) 2003</p>
7  * <p>Company: </p>
8  * @author unascribed
9  * @version 1.0
10  */

11
12 // ToolBox imports
13
import org.enhydra.tool.common.ButtonPanel;
14
15 // Standard imports
16
import java.awt.Window JavaDoc;
17 import java.awt.event.ActionEvent JavaDoc;
18 import java.awt.event.ActionListener JavaDoc;
19 import java.lang.ref.WeakReference JavaDoc;
20
21
22 public class AntDeployButtonListener implements ActionListener JavaDoc {
23     private WeakReference JavaDoc ref = null;
24
25     public AntDeployButtonListener(AntDeployTool tool) {
26         ref = new WeakReference JavaDoc(tool);
27     }
28
29     /**
30      * ActionListener implementation.
31      *
32      * @param event
33      * Event that triggered this listener.
34      *
35      */

36     public void actionPerformed(ActionEvent JavaDoc event) {
37         String JavaDoc command = event.getActionCommand();
38
39         if (command.equals(ButtonPanel.COMMAND_CANCEL)) {
40                 getTool().closeWindow();
41         } else if (command.equals(ButtonPanel.COMMAND_DEPLOY)) {
42                 getTool().getProject().save();
43                 getTool().build();
44         } else if (command.equals(ButtonPanel.COMMAND_CLOSE)) {
45                 getTool().getProject().save();
46                 getTool().closeWindow();
47         } else if (command.equals(ButtonPanel.COMMAND_HELP)) {
48 // getTool().notifyHelpListeners(event.getSource());
49
getTool().showHelp(null);
50         } else if (command.equals(ButtonPanel.COMMAND_ABOUT)) {
51                 getTool().showAbout();
52         }
53     }
54
55     private AntDeployTool getTool() {
56         return (AntDeployTool) ref.get();
57     }
58
59 }
60
61
Popular Tags