KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > console > gui > popups > ControllerPopUpMenu


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2005 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Nicolas Modrzyk
22  * Contributor(s): ______________________.
23  */

24
25 package org.objectweb.cjdbc.console.gui.popups;
26
27 import java.awt.event.ActionEvent JavaDoc;
28
29 import javax.swing.JMenuItem JavaDoc;
30
31 import org.objectweb.cjdbc.console.gui.CjdbcGui;
32 import org.objectweb.cjdbc.console.gui.constants.GuiCommands;
33 import org.objectweb.cjdbc.console.gui.objects.ControllerObject;
34
35 /**
36  * This class defines a ControllerPopUpMenu that listens to mouse events
37  *
38  * @author <a HREF="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
39  * @version 1.0
40  */

41 public class ControllerPopUpMenu extends AbstractPopUpMenu
42 {
43   private ControllerObject controller;
44   private String JavaDoc controllerName;
45
46   /**
47    * Creates a new <code>ControllerPopUpMenu</code> object
48    *
49    * @param gui link to the main gui
50    * @param controller name of referenced controller
51    */

52   public ControllerPopUpMenu(CjdbcGui gui, ControllerObject controller)
53   {
54     super(gui);
55     this.controller = controller;
56     this.controllerName = controller.getName();
57     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_ADD_DRIVER)).addActionListener(
58         this);
59     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_REFRESH_LOGS))
60         .addActionListener(this);
61     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_DISPLAY_XML_CONTROLLER))
62         .addActionListener(this);
63     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_GET_CONTROLLER_INFO))
64         .addActionListener(this);
65     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_SHUTDOWN_CONTROLLER))
66         .addActionListener(this);
67     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_REPORT))
68         .addActionListener(this);
69     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION))
70         .addActionListener(this);
71     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_REMOVE))
72         .addActionListener(this);
73     this.add(new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_MONITOR))
74         .addActionListener(this);
75   }
76
77   /**
78    * Returns the controller value.
79    *
80    * @return Returns the controller.
81    */

82   public ControllerObject getController()
83   {
84     return controller;
85   }
86
87   /**
88    * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
89    */

90   public void actionPerformed(ActionEvent JavaDoc e)
91   {
92     String JavaDoc action = e.getActionCommand();
93     if (action.equals(GuiCommands.COMMAND_ADD_DRIVER))
94     {
95       gui.publicActionLoadDriver(controllerName);
96     }
97     else if (action.equals(GuiCommands.COMMAND_REFRESH_LOGS))
98     {
99       gui.publicActionRefreshLogs(controllerName);
100     }
101     else if (action.equals(GuiCommands.COMMAND_DISPLAY_XML_CONTROLLER))
102     {
103       gui.publicActionLoadXmlController(controllerName);
104     }
105     else if (action.equals(GuiCommands.COMMAND_GET_CONTROLLER_INFO))
106     {
107       gui.publicActionGetControllerInfo(controllerName);
108     }
109     else if (action.equals(GuiCommands.COMMAND_SHUTDOWN_CONTROLLER))
110     {
111       gui.publicActionShutdownController(controllerName);
112     }
113     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_REPORT))
114     {
115       gui.publicActionControllerReport(controllerName);
116     }
117     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION))
118     {
119       gui.publicActionControllerLogConfiguration(controllerName);
120     }
121     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_REMOVE))
122     {
123       gui.publicActionControllerRemove(controllerName);
124     }
125     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_MONITOR))
126     {
127       gui.publicActionStartMonitor(controllerName, true, false, false);
128     }
129
130   }
131 }
Popular Tags