KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > tool > common > wizard > TBWizardButtonListener


1
2 /*
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  * Paul Mahar
22  *
23  */

24 package org.enhydra.tool.common.wizard;
25
26 // ToolBoxImports
27
import org.enhydra.tool.common.ButtonPanel;
28
29 // Standard imports
30
import java.awt.Window JavaDoc;
31 import java.awt.event.ActionEvent JavaDoc;
32 import java.awt.event.ActionListener JavaDoc;
33 import java.lang.ref.WeakReference JavaDoc;
34
35 //
36
public class TBWizardButtonListener implements ActionListener JavaDoc {
37     private WeakReference JavaDoc ref = null;
38
39     public TBWizardButtonListener(TBWizard wizard) {
40         ref = new WeakReference JavaDoc(wizard);
41     }
42
43     /**
44      * ActionListener implementation.
45      *
46      * @param event
47      * Event that triggered this listener.
48      *
49      */

50     public void actionPerformed(ActionEvent JavaDoc event) {
51         String JavaDoc command = event.getActionCommand();
52         if (command.equals(ButtonPanel.COMMAND_BACK)) {
53             getWizard().back();
54         } else if (command.equals(ButtonPanel.COMMAND_NEXT)) {
55             getWizard().next();
56         } else if (command.equals(ButtonPanel.COMMAND_FINISH)) {
57             getWizard().finish();
58         } else if (command.equals(ButtonPanel.COMMAND_CANCEL)) {
59             getWizard().cancel();
60         } else if (command.equals(ButtonPanel.COMMAND_HELP)) {
61             getWizard().notifyHelpListeners(event.getSource());
62         }
63     }
64
65
66     private TBWizard getWizard() {
67         return (TBWizard) ref.get();
68     }
69
70 }
71
Popular Tags