1 24 25 package org.objectweb.cjdbc.console.gui.popups; 26 27 import java.awt.event.ActionEvent ; 28 29 import javax.swing.JMenuItem ; 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 41 public class ControllerPopUpMenu extends AbstractPopUpMenu 42 { 43 private ControllerObject controller; 44 private String controllerName; 45 46 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 (GuiCommands.COMMAND_ADD_DRIVER)).addActionListener( 58 this); 59 this.add(new JMenuItem (GuiCommands.COMMAND_REFRESH_LOGS)) 60 .addActionListener(this); 61 this.add(new JMenuItem (GuiCommands.COMMAND_DISPLAY_XML_CONTROLLER)) 62 .addActionListener(this); 63 this.add(new JMenuItem (GuiCommands.COMMAND_GET_CONTROLLER_INFO)) 64 .addActionListener(this); 65 this.add(new JMenuItem (GuiCommands.COMMAND_SHUTDOWN_CONTROLLER)) 66 .addActionListener(this); 67 this.add(new JMenuItem (GuiCommands.COMMAND_CONTROLLER_REPORT)) 68 .addActionListener(this); 69 this.add(new JMenuItem (GuiCommands.COMMAND_CONTROLLER_LOG_CONFIGURATION)) 70 .addActionListener(this); 71 this.add(new JMenuItem (GuiCommands.COMMAND_CONTROLLER_REMOVE)) 72 .addActionListener(this); 73 this.add(new JMenuItem (GuiCommands.COMMAND_CONTROLLER_MONITOR)) 74 .addActionListener(this); 75 } 76 77 82 public ControllerObject getController() 83 { 84 return controller; 85 } 86 87 90 public void actionPerformed(ActionEvent e) 91 { 92 String 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 |