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.DatabaseObject; 34 35 41 public class DatabasePopUpMenu extends AbstractPopUpMenu 42 { 43 private DatabaseObject database; 44 private String databaseName; 45 46 52 public DatabasePopUpMenu(CjdbcGui gui, DatabaseObject database) 53 { 54 super(gui); 55 this.database = database; 56 this.databaseName = database.getName(); 57 this.add(new JMenuItem (GuiCommands.COMMAND_DISPLAY_XML_DATABASE)) 58 .addActionListener(this); 59 this.add(new JMenuItem (GuiCommands.COMMAND_ENABLE_ALL)).addActionListener( 60 this); 61 this.add(new JMenuItem (GuiCommands.COMMAND_DISABLE_ALL)).addActionListener( 62 this); 63 this.add(new JMenuItem (GuiCommands.COMMAND_SHUTDOWN_DATABASE)) 64 .addActionListener(this); 65 this.add(new JMenuItem (GuiCommands.COMMAND_VIEW_SQL_STATS)) 66 .addActionListener(this); 67 this.add(new JMenuItem (GuiCommands.COMMAND_VIEW_CACHE_CONTENT)) 68 .addActionListener(this); 69 this.add(new JMenuItem (GuiCommands.COMMAND_VIEW_RECOVERY_LOG)) 70 .addActionListener(this); 71 this.add(new JMenuItem (GuiCommands.COMMAND_MONITOR_DATABASE)) 72 .addActionListener(this); 73 } 74 75 80 public DatabaseObject getDatabaseName() 81 { 82 return database; 83 } 84 85 88 public void actionPerformed(ActionEvent e) 89 { 90 String action = e.getActionCommand(); 91 92 if (action.equals(GuiCommands.COMMAND_ENABLE_ALL)) 93 { 94 gui.publicActionDatabaseEnableAll(databaseName); 95 } 96 else if (action.equals(GuiCommands.COMMAND_DISABLE_ALL)) 97 { 98 gui.publicActionDatabaseDisableAll(databaseName); 99 } 100 else if (action.equals(GuiCommands.COMMAND_SHUTDOWN_DATABASE)) 101 { 102 gui.publicActionDisplayShutdownFrame(database); 103 } 104 else if (action.equals(GuiCommands.COMMAND_DISPLAY_XML_DATABASE)) 105 { 106 gui.publicActionLoadXmlDatabase(databaseName); 107 } 108 else if (action.equals(GuiCommands.COMMAND_VIEW_CACHE_CONTENT)) 109 { 110 gui.publicActionViewCache(databaseName); 111 } 112 else if (action.equals(GuiCommands.COMMAND_VIEW_SQL_STATS)) 113 { 114 gui.publicActionViewSQLStats(databaseName); 115 } 116 else if (action.equals(GuiCommands.COMMAND_VIEW_CACHE_STATS)) 117 { 118 gui.publicActionViewCacheStats(databaseName); 119 } 120 else if (action.equals(GuiCommands.COMMAND_VIEW_RECOVERY_LOG)) 121 { 122 gui.publicActionViewRecoveryLog(databaseName); 123 } 124 else if (action.equals(GuiCommands.COMMAND_MONITOR_DATABASE)) 125 { 126 gui.publicActionStartMonitor(database.getControllerName(), false, true, 127 false); 128 } 129 } 130 } | Popular Tags |