00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00037
00038
00039
00040
00041 public class ControllerPopUpMenu extends AbstractPopUpMenu
00042 {
00043 private ControllerObject controller;
00044 private String controllerName;
00045
00046
00047
00048
00049
00050
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
00079
00080
00081
00082 public ControllerObject getController()
00083 {
00084 return controller;
00085 }
00086
00087
00088
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 }