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

DatabasePopUpMenu.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 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.DatabaseObject;
00034 
00035 /**
00036  * This class defines a DatabasePopUpMenu
00037  * 
00038  * @author <a href="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
00039  * @version 1.0
00040  */
00041 public class DatabasePopUpMenu extends AbstractPopUpMenu
00042 {
00043   private DatabaseObject database;
00044   private String         databaseName;
00045 
00046   /**
00047    * Creates a new <code>DatabasePopUpMenu.java</code> object
00048    * 
00049    * @param gui link to the main gui
00050    * @param database referenced db
00051    */
00052   public DatabasePopUpMenu(CjdbcGui gui, DatabaseObject database)
00053   {
00054     super(gui);
00055     this.database = database;
00056     this.databaseName = database.getName();
00057     this.add(new JMenuItem(GuiCommands.COMMAND_DISPLAY_XML_DATABASE))
00058         .addActionListener(this);
00059     this.add(new JMenuItem(GuiCommands.COMMAND_ENABLE_ALL)).addActionListener(
00060         this);
00061     this.add(new JMenuItem(GuiCommands.COMMAND_DISABLE_ALL)).addActionListener(
00062         this);
00063     this.add(new JMenuItem(GuiCommands.COMMAND_SHUTDOWN_DATABASE))
00064         .addActionListener(this);
00065     this.add(new JMenuItem(GuiCommands.COMMAND_VIEW_SQL_STATS))
00066         .addActionListener(this);
00067     this.add(new JMenuItem(GuiCommands.COMMAND_VIEW_CACHE_CONTENT))
00068         .addActionListener(this);
00069     this.add(new JMenuItem(GuiCommands.COMMAND_VIEW_RECOVERY_LOG))
00070         .addActionListener(this);
00071     this.add(new JMenuItem(GuiCommands.COMMAND_MONITOR_DATABASE))
00072         .addActionListener(this);
00073   }
00074 
00075   /**
00076    * Returns the database value.
00077    * 
00078    * @return Returns the database.
00079    */
00080   public DatabaseObject getDatabaseName()
00081   {
00082     return database;
00083   }
00084 
00085   /**
00086    * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
00087    */
00088   public void actionPerformed(ActionEvent e)
00089   {
00090     String action = e.getActionCommand();
00091 
00092     if (action.equals(GuiCommands.COMMAND_ENABLE_ALL))
00093     {
00094       gui.publicActionDatabaseEnableAll(databaseName);
00095     }
00096     else if (action.equals(GuiCommands.COMMAND_DISABLE_ALL))
00097     {
00098       gui.publicActionDatabaseDisableAll(databaseName);
00099     }
00100     else if (action.equals(GuiCommands.COMMAND_SHUTDOWN_DATABASE))
00101     {
00102       gui.publicActionDisplayShutdownFrame(database);
00103     }
00104     else if (action.equals(GuiCommands.COMMAND_DISPLAY_XML_DATABASE))
00105     {
00106       gui.publicActionLoadXmlDatabase(databaseName);
00107     }
00108     else if (action.equals(GuiCommands.COMMAND_VIEW_CACHE_CONTENT))
00109     {
00110       gui.publicActionViewCache(databaseName);
00111     }
00112     else if (action.equals(GuiCommands.COMMAND_VIEW_SQL_STATS))
00113     {
00114       gui.publicActionViewSQLStats(databaseName);
00115     }
00116     else if (action.equals(GuiCommands.COMMAND_VIEW_CACHE_STATS))
00117     {
00118       gui.publicActionViewCacheStats(databaseName);
00119     }
00120     else if (action.equals(GuiCommands.COMMAND_VIEW_RECOVERY_LOG))
00121     {
00122       gui.publicActionViewRecoveryLog(databaseName);
00123     }
00124     else if (action.equals(GuiCommands.COMMAND_MONITOR_DATABASE))
00125     {
00126       gui.publicActionStartMonitor(database.getControllerName(), false, true,
00127           false);
00128     }
00129   }
00130 }

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