KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > ic2d > gui > menu > MessageMonitoringMenu


1 /*
2 * ################################################################
3 *
4 * ProActive: The Java(TM) library for Parallel, Distributed,
5 * Concurrent computing with Security and Mobility
6 *
7 * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8 * Contact: proactive-support@inria.fr
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * Initial developer(s): The ProActive Team
26 * http://www.inria.fr/oasis/ProActive/contacts.html
27 * Contributor(s):
28 *
29 * ################################################################
30 */

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 JavaDoc implements MessageMonitoringListener {
37
38   protected MessageMonitoringController controller;
39
40   protected javax.swing.JCheckBoxMenuItem JavaDoc monitorRequestSenderMenuItem;
41   protected javax.swing.JCheckBoxMenuItem JavaDoc monitorRequestReceiverMenuItem;
42   protected javax.swing.JCheckBoxMenuItem JavaDoc monitorReplySenderMenuItem;
43   protected javax.swing.JCheckBoxMenuItem JavaDoc monitorReplyReceiverMenuItem;
44   protected javax.swing.JCheckBoxMenuItem JavaDoc viewInEventListMenuItem;
45   
46   //
47
// -- CONSTRUCTORS -----------------------------------------------
48
//
49

50   public MessageMonitoringMenu(String JavaDoc name, MessageMonitoringController aController) {
51     super(name);
52     this.controller = aController;
53
54     //
55
// Monitor All
56
//
57
javax.swing.JMenuItem JavaDoc monitorAllMenuItem = new javax.swing.JMenuItem JavaDoc("Monitor All");
58     monitorAllMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc() {
59         public void actionPerformed(java.awt.event.ActionEvent JavaDoc event) {
60           controller.monitorAll(true);
61         }
62       });
63     this.add(monitorAllMenuItem);
64     
65     javax.swing.JMenuItem JavaDoc monitorNoneMenuItem = new javax.swing.JMenuItem JavaDoc("Monitor None");
66     monitorNoneMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc() {
67         public void actionPerformed(java.awt.event.ActionEvent JavaDoc event) {
68           controller.monitorAll(false);
69         }
70       });
71     this.add(monitorNoneMenuItem);
72     
73     this.addSeparator();
74
75     addMenuOptions();
76   }
77   
78
79   //
80
// -- PUBLIC METHODS -----------------------------------------------
81
//
82

83   //
84
// -- implements MessageMonitoringListener -----------------------------------------------
85
//
86

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   //
109
// -- PROTECTED METHODS -----------------------------------------------
110
//
111

112   protected void addMenuOptions() {
113     //
114
// ViewEventList
115
//
116
viewInEventListMenuItem = new javax.swing.JCheckBoxMenuItem JavaDoc("View in textual list", controller.isViewedInEventList());
117     viewInEventListMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc() {
118         public void actionPerformed(java.awt.event.ActionEvent JavaDoc event) {
119           controller.viewInEventList(viewInEventListMenuItem.isSelected());
120         }
121       });
122     this.add(viewInEventListMenuItem);
123     this.addSeparator();
124     
125     //
126
// MonitoringRequestSender
127
//
128
monitorRequestSenderMenuItem = new javax.swing.JCheckBoxMenuItem JavaDoc("Monitor RequestSender", controller.isMonitoringRequestSender());
129     monitorRequestSenderMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc() {
130         public void actionPerformed(java.awt.event.ActionEvent JavaDoc event) {
131           controller.monitorRequestSender(monitorRequestSenderMenuItem.isSelected());
132         }
133       });
134     this.add(monitorRequestSenderMenuItem);
135     
136
137     //
138
// MonitoringRequestReceiver
139
//
140
monitorRequestReceiverMenuItem = new javax.swing.JCheckBoxMenuItem JavaDoc("Monitor RequestReceiver", controller.isMonitoringRequestReceiver());
141     monitorRequestReceiverMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc() {
142         public void actionPerformed(java.awt.event.ActionEvent JavaDoc event) {
143           controller.monitorRequestReceiver(monitorRequestReceiverMenuItem.isSelected());
144         }
145       });
146     this.add(monitorRequestReceiverMenuItem);
147     
148     //
149
// MonitoringReplySender
150
//
151
monitorReplySenderMenuItem = new javax.swing.JCheckBoxMenuItem JavaDoc("Monitor ReplySender", controller.isMonitoringReplySender());
152     monitorReplySenderMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc() {
153         public void actionPerformed(java.awt.event.ActionEvent JavaDoc event) {
154           controller.monitorReplySender(monitorReplySenderMenuItem.isSelected());
155         }
156       });
157     this.add(monitorReplySenderMenuItem);
158     
159     //
160
// MonitoringReplyReceiver
161
//
162
monitorReplyReceiverMenuItem = new javax.swing.JCheckBoxMenuItem JavaDoc("Monitor ReplyReceiver", controller.isMonitoringReplyReceiver());
163     monitorReplyReceiverMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc() {
164         public void actionPerformed(java.awt.event.ActionEvent JavaDoc event) {
165           controller.monitorReplyReceiver(monitorReplyReceiverMenuItem.isSelected());
166         }
167       });
168     this.add(monitorReplyReceiverMenuItem);
169
170   }
171 }
Popular Tags