KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2004 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 import javax.swing.JTextPane JavaDoc;
31
32 import org.objectweb.cjdbc.console.gui.CjdbcGui;
33 import org.objectweb.cjdbc.console.gui.constants.GuiCommands;
34
35 /**
36  * This class defines a LogEditPopUpMenu
37  *
38  * @author <a HREF="mailto:Nicolas.Modrzyk@inria.fr">Nicolas Modrzyk </a>
39  * @version 1.0
40  */

41 public class LogEditPopUpMenu extends AbstractPopUpMenu
42 {
43   private JTextPane JavaDoc logConfigTextPane;
44   private String JavaDoc controllerName;
45
46   /**
47    * Creates a new <code>LogEditPopUpMenu</code> object
48    *
49    * @param gui link to the main gui
50    * @param logConfigTextPane the reference to the edit panel
51    * @param controllerName the name of the controller that sent those logs
52    */

53   public LogEditPopUpMenu(CjdbcGui gui, String JavaDoc controllerName,
54       JTextPane JavaDoc logConfigTextPane)
55   {
56     super(gui);
57     this.logConfigTextPane = logConfigTextPane;
58     this.controllerName = controllerName;
59
60     this.add(
61         new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_UPDATE_LOG_CONFIGURATION))
62         .addActionListener(this);
63     this.add(
64         new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION_DEBUG))
65         .addActionListener(this);
66     this.add(
67         new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION_INFO))
68         .addActionListener(this);
69     this.add(
70         new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION_ADD_SERVER))
71         .addActionListener(this);
72     this.add(
73         new JMenuItem JavaDoc(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION_REMOVE_SERVER))
74         .addActionListener(this);
75     
76   }
77
78   /**
79    * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
80    */

81   public void actionPerformed(ActionEvent JavaDoc e)
82   {
83     String JavaDoc action = e.getActionCommand();
84     if (action.equals(GuiCommands.COMMAND_CONTROLLER_UPDATE_LOG_CONFIGURATION))
85       gui.publicActionUpdateControllerLogConfiguration(controllerName,
86           logConfigTextPane.getText());
87     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION_DEBUG))
88       gui.publicActionSetLogConfigurationDebug(controllerName,
89           logConfigTextPane.getText());
90     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION_INFO))
91       gui.publicActionSetLogConfigurationInfo(controllerName,
92           logConfigTextPane.getText());
93     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION_ADD_SERVER))
94       gui.publicActionSetLogConfigurationServer(true,controllerName,
95           logConfigTextPane.getText());
96     else if (action.equals(GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION_REMOVE_SERVER))
97       gui.publicActionSetLogConfigurationServer(false,controllerName,
98           logConfigTextPane.getText());
99   }
100 }
101
Popular Tags