1 31 package org.objectweb.proactive.ic2d.gui.menu; 32 33 import org.objectweb.proactive.ic2d.data.MessageMonitoringController; 34 import org.objectweb.proactive.ic2d.event.MessageMonitoringListener; 35 36 public class MessageMonitoringMenu extends javax.swing.JMenu implements MessageMonitoringListener { 37 38 protected MessageMonitoringController controller; 39 40 protected javax.swing.JCheckBoxMenuItem monitorRequestSenderMenuItem; 41 protected javax.swing.JCheckBoxMenuItem monitorRequestReceiverMenuItem; 42 protected javax.swing.JCheckBoxMenuItem monitorReplySenderMenuItem; 43 protected javax.swing.JCheckBoxMenuItem monitorReplyReceiverMenuItem; 44 protected javax.swing.JCheckBoxMenuItem viewInEventListMenuItem; 45 46 50 public MessageMonitoringMenu(String name, MessageMonitoringController aController) { 51 super(name); 52 this.controller = aController; 53 54 javax.swing.JMenuItem monitorAllMenuItem = new javax.swing.JMenuItem ("Monitor All"); 58 monitorAllMenuItem.addActionListener(new java.awt.event.ActionListener () { 59 public void actionPerformed(java.awt.event.ActionEvent event) { 60 controller.monitorAll(true); 61 } 62 }); 63 this.add(monitorAllMenuItem); 64 65 javax.swing.JMenuItem monitorNoneMenuItem = new javax.swing.JMenuItem ("Monitor None"); 66 monitorNoneMenuItem.addActionListener(new java.awt.event.ActionListener () { 67 public void actionPerformed(java.awt.event.ActionEvent event) { 68 controller.monitorAll(false); 69 } 70 }); 71 this.add(monitorNoneMenuItem); 72 73 this.addSeparator(); 74 75 addMenuOptions(); 76 } 77 78 79 83 87 public void monitoringRequestReceiverChanged(boolean b) { 88 monitorRequestReceiverMenuItem.setState(b); 89 } 90 91 public void monitoringRequestSenderChanged(boolean b) { 92 monitorRequestSenderMenuItem.setState(b); 93 } 94 95 public void monitoringReplyReceiverChanged(boolean b) { 96 monitorReplyReceiverMenuItem.setState(b); 97 } 98 99 public void monitoringReplySenderChanged(boolean b) { 100 monitorReplySenderMenuItem.setState(b); 101 } 102 103 public void viewingInEventListChanged(boolean b) { 104 viewInEventListMenuItem.setState(b); 105 } 106 107 108 112 protected void addMenuOptions() { 113 viewInEventListMenuItem = new javax.swing.JCheckBoxMenuItem ("View in textual list", controller.isViewedInEventList()); 117 viewInEventListMenuItem.addActionListener(new java.awt.event.ActionListener () { 118 public void actionPerformed(java.awt.event.ActionEvent event) { 119 controller.viewInEventList(viewInEventListMenuItem.isSelected()); 120 } 121 }); 122 this.add(viewInEventListMenuItem); 123 this.addSeparator(); 124 125 monitorRequestSenderMenuItem = new javax.swing.JCheckBoxMenuItem ("Monitor RequestSender", controller.isMonitoringRequestSender()); 129 monitorRequestSenderMenuItem.addActionListener(new java.awt.event.ActionListener () { 130 public void actionPerformed(java.awt.event.ActionEvent event) { 131 controller.monitorRequestSender(monitorRequestSenderMenuItem.isSelected()); 132 } 133 }); 134 this.add(monitorRequestSenderMenuItem); 135 136 137 monitorRequestReceiverMenuItem = new javax.swing.JCheckBoxMenuItem ("Monitor RequestReceiver", controller.isMonitoringRequestReceiver()); 141 monitorRequestReceiverMenuItem.addActionListener(new java.awt.event.ActionListener () { 142 public void actionPerformed(java.awt.event.ActionEvent event) { 143 controller.monitorRequestReceiver(monitorRequestReceiverMenuItem.isSelected()); 144 } 145 }); 146 this.add(monitorRequestReceiverMenuItem); 147 148 monitorReplySenderMenuItem = new javax.swing.JCheckBoxMenuItem ("Monitor ReplySender", controller.isMonitoringReplySender()); 152 monitorReplySenderMenuItem.addActionListener(new java.awt.event.ActionListener () { 153 public void actionPerformed(java.awt.event.ActionEvent event) { 154 controller.monitorReplySender(monitorReplySenderMenuItem.isSelected()); 155 } 156 }); 157 this.add(monitorReplySenderMenuItem); 158 159 monitorReplyReceiverMenuItem = new javax.swing.JCheckBoxMenuItem ("Monitor ReplyReceiver", controller.isMonitoringReplyReceiver()); 163 monitorReplyReceiverMenuItem.addActionListener(new java.awt.event.ActionListener () { 164 public void actionPerformed(java.awt.event.ActionEvent event) { 165 controller.monitorReplyReceiver(monitorReplyReceiverMenuItem.isSelected()); 166 } 167 }); 168 this.add(monitorReplyReceiverMenuItem); 169 170 } 171 } | Popular Tags |