Public Member Functions | |
MonitoringConsole (String jmxUrl, ControllerMBean controllerMBean, VirtualDatabaseMBean virtualDatabaseMBean, boolean backends) throws IOException | |
void | mouseClicked (MouseEvent e) |
void | mouseEntered (MouseEvent e) |
void | mouseExited (MouseEvent e) |
void | mousePressed (MouseEvent e) |
void | mouseReleased (MouseEvent e) |
void | actionPerformed (ActionEvent e) |
void | windowActivated (WindowEvent e) |
void | windowClosed (WindowEvent e) |
void | windowClosing (WindowEvent e) |
void | windowDeactivated (WindowEvent e) |
void | windowDeiconified (WindowEvent e) |
void | windowIconified (WindowEvent e) |
void | windowOpened (WindowEvent e) |
Static Public Member Functions | |
String | getBackendActionCommand (String typeName, String vdbName, String backendName) |
final JFrame | graph (String command, DataCollectorMBean dataCollectorMBean, int graphRepeat, int graphTimeframe, int graphFrequency, int graphDisplayFrequency, WindowListener listener) throws DataCollectorException |
Definition at line 86 of file MonitoringConsole.java.
|
Creates a new
Definition at line 185 of file MonitoringConsole.java. References org.objectweb.cjdbc.console.jmx.RmiJmxClient.controllerMBean, and org.objectweb.cjdbc.console.jmx.RmiJmxClient.getDataCollectorProxy(). 00188 { 00189 super(MonitorTranslate.get("monitor.frame.title", jmxUrl)); 00190 00191 this.displayController = controllerMBean == null; 00192 this.displayVirtualDatabase = virtualDatabaseMBean == null; 00193 this.displayBackends = backends; 00194 00195 // Get MBeans reference 00196 RmiJmxClient jmxClient = new RmiJmxClient(jmxUrl, null); 00197 dataCollectorMBean = jmxClient.getDataCollectorProxy(); 00198 this.controllerMBean = controllerMBean; 00199 this.virtualDatabaseMBean = virtualDatabaseMBean; 00200 00201 // Get options for combo boxes 00202 comboBoxesItems.add(COMBO_HIDE); 00203 comboBoxesItems.add(COMBO_FLOATING); 00204 00205 Toolkit toolkit; 00206 Dimension dim; 00207 int screenHeight, screenWidth; 00208 00209 // Initialize basic layout properties 00210 setForeground(Color.white); 00211 getContentPane().setLayout(new BorderLayout()); 00212 00213 // Set the frame's display to be WIDTH x HEIGHT in the middle of the screen 00214 toolkit = Toolkit.getDefaultToolkit(); 00215 dim = toolkit.getScreenSize(); 00216 screenHeight = dim.height; 00217 screenWidth = dim.width; 00218 00219 // Reduce height by two if display only controller 00220 if (displayController && (!displayVirtualDatabase) && (!displayBackends)) 00221 frameHeight = 270; 00222 00223 setBounds((screenWidth - frameWidth) / 2, (screenHeight - frameHeight) / 2, 00224 frameWidth, frameHeight); 00225 00226 try 00227 { 00228 // Init Frame with dynamic content 00229 initConsole(); 00230 } 00231 catch (Exception e) 00232 { 00233 throw new IOException(e.getMessage()); 00234 } 00235 00236 // Status Bar 00237 label = new JLabel("Select Graphs ..."); 00238 label.setFont(labelFont); 00239 getContentPane().add(label, BorderLayout.SOUTH); 00240 getContentPane().setBackground(toolBarColor); 00241 getContentPane().setForeground(toolBarColor); 00242 00243 // Menu Bar 00244 JMenuBar menuBar = new JMenuBar(); 00245 JMenu menu = new JMenu(MonitorTranslate.get("monitor.menu.bar")); 00246 JMenuItem item1 = new JMenuItem(COMMAND_SAVE); 00247 JMenuItem item2 = new JMenuItem(COMMAND_LOAD); 00248 JMenuItem item3 = new JMenuItem(COMMAND_CLOSE); 00249 JMenuItem item4 = new JMenuItem(COMMAND_CLOSE_GRAPHS); 00250 JMenuItem item5 = new JMenuItem(COMMAND_OPTIONS); 00251 JMenuItem item6 = new JMenuItem(COMMAND_REFRESH); 00252 item1.setBackground(toolBarColor); 00253 item2.setBackground(toolBarColor); 00254 item3.setBackground(toolBarColor); 00255 item4.setBackground(toolBarColor); 00256 item5.setBackground(toolBarColor); 00257 item6.setBackground(toolBarColor); 00258 menu.add(item1).addActionListener(this); 00259 menu.add(item2).addActionListener(this); 00260 menu.add(item4).addActionListener(this); 00261 menu.add(item5).addActionListener(this); 00262 menu.add(item6).addActionListener(this); 00263 menu.addSeparator(); 00264 menu.add(item3).addActionListener(this); 00265 menu.setVisible(true); 00266 menu.setBackground(toolBarColor); 00267 menuBar.add(menu); 00268 menuBar.setBackground(toolBarColor); 00269 this.setJMenuBar(menuBar); 00270 00271 // Prepare options window 00272 options = new JFrame(MonitorTranslate.get("options.frame.title")); 00273 options.setSize(200, 200); 00274 JPanel optionsPanel = new JPanel(); 00275 optionsPanel.setLayout(new GridLayout(5, 2)); 00276 optionsPanel.add(new JLabel(MonitorTranslate.get("options.repeat"))); 00277 frepeat = new JTextField(0); 00278 frepeat.setAlignmentX(RIGHT_ALIGNMENT); 00279 frepeat.setText(graphRepeat + ""); 00280 frepeat.addActionListener(this); 00281 optionsPanel.add(frepeat); 00282 00283 optionsPanel 00284 .add(new JLabel(MonitorTranslate.get("options.display.buffer"))); 00285 displayBuffer = new JTextField(0); 00286 displayBuffer.setText("" + graphDisplayFrequency); 00287 displayBuffer.addActionListener(this); 00288 displayBuffer.setAlignmentX(RIGHT_ALIGNMENT); 00289 optionsPanel.add(displayBuffer); 00290 00291 optionsPanel.add(new JLabel(MonitorTranslate.get("options.frequency"))); 00292 ffrequency = new JTextField(0); 00293 ffrequency.setText("" + graphFrequency); 00294 ffrequency.addActionListener(this); 00295 ffrequency.setAlignmentX(RIGHT_ALIGNMENT); 00296 optionsPanel.add(ffrequency); 00297 00298 optionsPanel.add(new JLabel(MonitorTranslate.get("options.timeframe"))); 00299 ftimeframe = new JTextField(0); 00300 ftimeframe.setText(graphTimeframe + ""); 00301 ftimeframe.addActionListener(this); 00302 ftimeframe.setAlignmentX(RIGHT_ALIGNMENT); 00303 optionsPanel.add(ftimeframe); 00304 00305 JButton optionConfirm = new JButton(MonitorTranslate.get("options.ok")); 00306 optionConfirm.setActionCommand(OPTIONS_APPLY); 00307 optionConfirm.addActionListener(this); 00308 optionsPanel.add(optionConfirm); 00309 00310 JButton optionCancel = new JButton(MonitorTranslate.get("options.cancel")); 00311 optionCancel.setActionCommand(OPTIONS_CANCEL); 00312 optionCancel.addActionListener(this); 00313 optionsPanel.add(optionCancel); 00314 00315 options.getContentPane().add(optionsPanel); 00316 options.setVisible(false); 00317 options.setDefaultCloseOperation(HIDE_ON_CLOSE); 00318 options.validate(); 00319 00320 //Put the final touches to the JFrame object 00321 validate(); 00322 setVisible(true); 00323 this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); 00324 }
|
|
Definition at line 680 of file MonitoringConsole.java. References org.objectweb.cjdbc.console.monitoring.MonitoringConsole.graph(). 00681 { 00682 if (isLoading) 00683 return; 00684 String actionCommand = e.getActionCommand(); 00685 status("Action:" + actionCommand); 00686 if (actionCommand.equals(COMMAND_SAVE)) 00687 { 00688 try 00689 { 00690 doSaveConfiguration(); 00691 } 00692 catch (IOException e1) 00693 { 00694 // TODO: display dialog box 00695 // Dialog d = new Dialog(this, "Saving Failed"); 00696 // d.add(new JLabel("Saving Failed because of:" + e1.getMessage())); 00697 // d.setVisible(true); 00698 // d.setSize(100,50); 00699 // d.setModal(true); 00700 //d.setDefaultCloseOperation(DISPOSE_ON_CLOSE); 00701 e1.printStackTrace(); 00702 } 00703 } 00704 else if (actionCommand.equals(COMMAND_LOAD)) 00705 { 00706 try 00707 { 00708 doLoadConfiguration(); 00709 } 00710 catch (IOException e1) 00711 { 00712 // TODO: display dialog box 00713 e1.printStackTrace(); 00714 } 00715 } 00716 else if (actionCommand.equals(OPTIONS_APPLY)) 00717 { 00718 00719 try 00720 { 00721 graphRepeat = Integer.parseInt(frepeat.getText()); 00722 graphTimeframe = Integer.parseInt(ftimeframe.getText()); 00723 graphFrequency = Integer.parseInt(ffrequency.getText()); 00724 graphDisplayFrequency = Integer.parseInt(displayBuffer.getText()); 00725 options.setVisible(false); 00726 } 00727 catch (Exception failed) 00728 { 00729 error(failed.getMessage()); 00730 } 00731 } 00732 else if (actionCommand.equals(OPTIONS_CANCEL)) 00733 { 00734 options.setVisible(false); 00735 frepeat.setText(graphRepeat + ""); 00736 ftimeframe.setText(graphTimeframe + ""); 00737 ffrequency.setText(graphFrequency + ""); 00738 } 00739 else if (actionCommand.equals(COMMAND_REFRESH)) 00740 { 00741 try 00742 { 00743 initConsole(); 00744 } 00745 catch (Exception error) 00746 { 00747 error(error.getMessage()); 00748 } 00749 } 00750 else if (actionCommand.equals(COMMAND_OPTIONS)) 00751 { 00752 options.setVisible(true); 00753 } 00754 else if (actionCommand.equals(COMMAND_CLOSE)) 00755 { 00756 closeAllWindows(); 00757 this.dispose(); 00758 } 00759 else if (actionCommand.equals(COMMAND_CLOSE_GRAPHS)) 00760 { 00761 closeAllWindows(); 00762 } 00763 Object o = e.getSource(); 00764 if (o instanceof JComboBox) 00765 { 00766 JComboBox box = (JComboBox) o; 00767 String selected = (String) box.getSelectedItem(); 00768 status(selected.toString()); 00769 try 00770 { 00771 Window win = (Window) windows.get(e.getActionCommand().trim()); 00772 if (!selected.equals(COMBO_HIDE)) 00773 { 00774 if (win == null) 00775 { 00776 graph(e.getActionCommand()); 00777 } 00778 } 00779 else 00780 { 00781 windows.remove(win.getName()); 00782 win.setVisible(false); 00783 win.dispose(); 00784 } 00785 } 00786 catch (Exception f) 00787 { 00788 error(f.getMessage()); 00789 } 00790 } 00791 00792 }
|
|
Get the backend action command for displaying monitoring window
Definition at line 504 of file MonitoringConsole.java. 00506 { 00507 return "graph " + typeName.toLowerCase().replace(' ', '_') + " " + vdbName 00508 + " " + backendName; 00509 }
|
|
Starts a graph !
Definition at line 856 of file MonitoringConsole.java. References org.objectweb.cjdbc.console.monitoring.MonitoringGraph.getFrame(), org.objectweb.cjdbc.console.monitoring.MonitoringGraph.setDisplayFrequency(), org.objectweb.cjdbc.console.monitoring.MonitoringGraph.setFrequency(), org.objectweb.cjdbc.console.monitoring.MonitoringGraph.setRepeat(), org.objectweb.cjdbc.console.monitoring.MonitoringGraph.setText(), and org.objectweb.cjdbc.console.monitoring.MonitoringGraph.setTimeFrame(). Referenced by org.objectweb.cjdbc.console.monitoring.MonitoringConsole.actionPerformed(). 00860 { 00861 // Used for saving configuration 00862 command = command.replace('.', ' '); 00863 00864 StringTokenizer tokenizer = new StringTokenizer(command, " "); 00865 String token0 = tokenizer.nextToken(); 00866 if (token0.equals("graph")) 00867 { 00868 String token1 = tokenizer.nextToken(); 00869 int type = DataCollectionNames.getTypeFromCommand(token1); 00870 String token2 = (tokenizer.hasMoreTokens()) ? tokenizer.nextToken() : ""; 00871 String token3 = (tokenizer.hasMoreTokens()) ? tokenizer.nextToken() : ""; 00872 AbstractDataCollector collector = dataCollectorMBean 00873 .retrieveDataCollectorInstance(type, token3, token2); 00874 MonitoringGraph graph = new MonitoringGraph(collector, dataCollectorMBean); 00875 graph.setRepeat(graphRepeat); 00876 graph.setTimeFrame(graphTimeframe); 00877 graph.setFrequency(graphFrequency); 00878 graph.setDisplayFrequency(graphDisplayFrequency); 00879 graph.start(); 00880 graph.setText(command); 00881 // Do not do before, as frame is null before starts of thread! 00882 if (listener != null) 00883 graph.getFrame().addWindowListener(listener); 00884 graph.getFrame().setName(command.trim()); 00885 return graph.getFrame(); 00886 } 00887 else 00888 { 00889 return null; 00890 } 00891 }
|
|
Definition at line 514 of file MonitoringConsole.java. 00515 {
00516 status(e.getComponent().getName() + " was clicked");
00517 }
|
|
Definition at line 522 of file MonitoringConsole.java. 00523 { 00524 00525 }
|
|
Definition at line 530 of file MonitoringConsole.java. 00531 { 00532 00533 }
|
|
Definition at line 538 of file MonitoringConsole.java. 00539 { 00540 00541 }
|
|
Definition at line 546 of file MonitoringConsole.java. 00547 { 00548 00549 }
|
|
Definition at line 896 of file MonitoringConsole.java. 00897 { 00898 00899 }
|
|
Definition at line 904 of file MonitoringConsole.java. 00905 { 00906 00907 }
|
|
Definition at line 912 of file MonitoringConsole.java. 00913 { 00914 Window win = e.getWindow(); 00915 JComboBox box = (JComboBox) comboBoxes.get(win.getName()); 00916 windows.remove(win.getName()); 00917 if (box != null) 00918 box.setSelectedIndex(0); 00919 status(win.getName() + " is closing"); 00920 }
|
|
Definition at line 925 of file MonitoringConsole.java. 00926 { 00927 00928 }
|
|
Definition at line 933 of file MonitoringConsole.java. 00934 { 00935 00936 }
|
|
Definition at line 941 of file MonitoringConsole.java. 00942 { 00943 00944 }
|
|
Definition at line 949 of file MonitoringConsole.java. 00950 {
00951 Window win = e.getWindow();
00952 status(win.getName() + " has opened");
00953 windows.put(win.getName(), e.getWindow());
00954 }
|