Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ControllerPopUpMenu.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2005 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Nicolas Modrzyk
00022  * Contributor(s): ______________________.
00023  */
00024 
00025 package org.objectweb.cjdbc.console.gui.popups;
00026 
00027 import java.awt.event.ActionEvent;
00028 
00029 import javax.swing.JMenuItem;
00030 
00031 import org.objectweb.cjdbc.console.gui.CjdbcGui;
00032 import org.objectweb.cjdbc.console.gui.constants.GuiCommands;
00033 import org.objectweb.cjdbc.console.gui.objects.ControllerObject;
00034 
00035 /**
00036  * This class defines a ControllerPopUpMenu that listens to mouse events
00037  * 
00038  * @author <a href="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
00039  * @version 1.0
00040  */
00041 public class ControllerPopUpMenu extends AbstractPopUpMenu
00042 {
00043   private ControllerObject controller;
00044   private String           controllerName;
00045 
00046   /**
00047    * Creates a new <code>ControllerPopUpMenu</code> object
00048    * 
00049    * @param gui link to the main gui
00050    * @param controller name of referenced controller
00051    */
00052   public ControllerPopUpMenu(CjdbcGui gui, ControllerObject controller)
00053   {
00054     super(gui);
00055     this.controller = controller;
00056     this.controllerName = controller.getName();
00057     this.add(new JMenuItem(GuiCommands.COMMAND_ADD_DRIVER)).addActionListener(
00058         this);
00059     this.add(new JMenuItem(GuiCommands.COMMAND_REFRESH_LOGS))
00060         .addActionListener(this);
00061     this.add(new JMenuItem(GuiCommands.COMMAND_DISPLAY_XML_CONTROLLER))
00062         .addActionListener(this);
00063     this.add(new JMenuItem(GuiCommands.COMMAND_GET_CONTROLLER_INFO))
00064         .addActionListener(this);
00065     this.add(new JMenuItem(GuiCommands.COMMAND_SHUTDOWN_CONTROLLER))
00066         .addActionListener(this);
00067     this.add(new JMenuItem(GuiCommands.COMMAND_CONTROLLER_REPORT))
00068         .addActionListener(this);
00069     this.add(new JMenuItem(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION))
00070         .addActionListener(this);
00071     this.add(new JMenuItem(GuiCommands.COMMAND_CONTROLLER_REMOVE))
00072         .addActionListener(this);
00073     this.add(new JMenuItem(GuiCommands.COMMAND_CONTROLLER_MONITOR))
00074         .addActionListener(this);
00075   }
00076 
00077   /**
00078    * Returns the controller value.
00079    * 
00080    * @return Returns the controller.
00081    */
00082   public ControllerObject getController()
00083   {
00084     return controller;
00085   }
00086 
00087   /**
00088    * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
00089    */
00090   public void actionPerformed(ActionEvent e)
00091   {
00092     String action = e.getActionCommand();
00093     if (action.equals(GuiCommands.COMMAND_ADD_DRIVER))
00094     {
00095       gui.publicActionLoadDriver(controllerName);
00096     }
00097     else if (action.equals(GuiCommands.COMMAND_REFRESH_LOGS))
00098     {
00099       gui.publicActionRefreshLogs(controllerName);
00100     }
00101     else if (action.equals(GuiCommands.COMMAND_DISPLAY_XML_CONTROLLER))
00102     {
00103       gui.publicActionLoadXmlController(controllerName);
00104     }
00105     else if (action.equals(GuiCommands.COMMAND_GET_CONTROLLER_INFO))
00106     {
00107       gui.publicActionGetControllerInfo(controllerName);
00108     }
00109     else if (action.equals(GuiCommands.COMMAND_SHUTDOWN_CONTROLLER))
00110     {
00111       gui.publicActionShutdownController(controllerName);
00112     }
00113     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_REPORT))
00114     {
00115       gui.publicActionControllerReport(controllerName);
00116     }
00117     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION))
00118     {
00119       gui.publicActionControllerLogConfiguration(controllerName);
00120     }
00121     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_REMOVE))
00122     {
00123       gui.publicActionControllerRemove(controllerName);
00124     }
00125     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_MONITOR))
00126     {
00127       gui.publicActionStartMonitor(controllerName, true, false, false);
00128     }
00129 
00130   }
00131 }

Generated on Mon Apr 11 22:01:30 2005 for C-JDBC by  doxygen 1.3.9.1