KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > ant > xmlc > AntXMLCButtonListener


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

11 // ToolBox imports
12
import java.awt.Dialog JavaDoc;
13 import java.awt.event.ActionEvent JavaDoc;
14 import java.awt.event.ActionListener JavaDoc;
15 import java.lang.ref.WeakReference JavaDoc;
16
17 import javax.swing.JButton JavaDoc;
18
19 import org.enhydra.tool.common.ButtonPanel;
20
21
22 public class AntXMLCButtonListener implements ActionListener JavaDoc {
23     private WeakReference JavaDoc ref = null;
24
25     public AntXMLCButtonListener(AntXMLCTool 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_COMPILE)) {
40             getTool().getProject().save();
41             getTool().build();
42         } else if (command.equals(ButtonPanel.COMMAND_CLOSE)) {
43             getTool().getProject().save();
44             getTool().closeWindow();
45         } else if (command.equals(ButtonPanel.COMMAND_CANCEL)) {
46             getTool().closeWindow();
47         } else if (command.equals(ButtonPanel.COMMAND_HELP)) {
48             getTool().showHelp(null);
49         } else if (command.equals(ButtonPanel.COMMAND_ABOUT)) {
50             getTool().showAbout();
51         }
52     }
53
54     private AntXMLCTool getTool() {
55         return (AntXMLCTool) ref.get();
56     }
57
58 }
59
Popular Tags