1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org.uk |
4 |
+ |
* Copyright (C) 2000-2002 i-scream |
5 |
+ |
* |
6 |
+ |
* This program is free software; you can redistribute it and/or |
7 |
+ |
* modify it under the terms of the GNU General Public License |
8 |
+ |
* as published by the Free Software Foundation; either version 2 |
9 |
+ |
* of the License, or (at your option) any later version. |
10 |
+ |
* |
11 |
+ |
* This program is distributed in the hope that it will be useful, |
12 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
+ |
* GNU General Public License for more details. |
15 |
+ |
* |
16 |
+ |
* You should have received a copy of the GNU General Public License |
17 |
+ |
* along with this program; if not, write to the Free Software |
18 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
+ |
*/ |
20 |
+ |
|
21 |
|
//---PACKAGE DECLARATION--- |
22 |
< |
package uk.ac.ukc.iscream.conient; |
22 |
> |
package uk.org.iscream.cms.conient; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
< |
import uk.ac.ukc.iscream.util.*; |
25 |
> |
import uk.org.iscream.cms.server.util.*; |
26 |
|
import javax.swing.*; |
27 |
|
import java.awt.BorderLayout; |
28 |
+ |
import java.net.URL; |
29 |
|
import java.awt.event.ActionListener; |
30 |
|
import java.awt.event.ActionEvent; |
31 |
|
|
74 |
|
* to dispatch events to the ConnectionHandler |
75 |
|
*/ |
76 |
|
private JToolBar setupToolBar() { |
56 |
– |
JButton connectButton = new JButton("Connect", new ImageIcon("./uk/ac/ukc/iscream/conient/control16.gif")); |
57 |
– |
connectButton.addActionListener(connectListener); |
58 |
– |
JButton disconnectButton = new JButton("Disconnect", new ImageIcon("./uk/ac/ukc/iscream/conient/stop16.gif")); |
59 |
– |
disconnectButton.addActionListener(disconnectListener); |
77 |
|
|
78 |
< |
JButton startDataButton = new JButton("Start Data", new ImageIcon("./uk/ac/ukc/iscream/conient/data16.gif")); |
79 |
< |
startDataButton.addActionListener(startDataListener); |
80 |
< |
JButton stopDataButton = new JButton("Stop Data", new ImageIcon("./uk/ac/ukc/iscream/conient/stop16.gif")); |
81 |
< |
stopDataButton.addActionListener(stopDataListener); |
78 |
> |
JButton connectButton = new JButton("Connect", new ImageIcon("./resources/control16.gif")); |
79 |
> |
connectButton.addActionListener(new ActionListener() { |
80 |
> |
public void actionPerformed(ActionEvent e) { |
81 |
> |
_actionQueue.add(new Integer(ConnectionHandler.CONNECT)); |
82 |
> |
} |
83 |
> |
}); |
84 |
> |
JButton disconnectButton = new JButton("Disconnect", new ImageIcon("./resources/stop16.gif")); |
85 |
> |
disconnectButton.addActionListener(new ActionListener() { |
86 |
> |
public void actionPerformed(ActionEvent e) { |
87 |
> |
_actionQueue.add(new Integer(ConnectionHandler.DISCONNECT)); |
88 |
> |
} |
89 |
> |
}); |
90 |
|
|
91 |
+ |
JButton startDataButton = new JButton("Start Data", new ImageIcon("./resources/data16.gif")); |
92 |
+ |
startDataButton.addActionListener(new ActionListener() { |
93 |
+ |
public void actionPerformed(ActionEvent e) { |
94 |
+ |
_actionQueue.add(new Integer(ConnectionHandler.STARTDATA)); |
95 |
+ |
} |
96 |
+ |
}); |
97 |
+ |
JButton stopDataButton = new JButton("Stop Data", new ImageIcon("./resources/stop16.gif")); |
98 |
+ |
stopDataButton.addActionListener(new ActionListener() { |
99 |
+ |
public void actionPerformed(ActionEvent e) { |
100 |
+ |
_actionQueue.add(new Integer(ConnectionHandler.STOPDATA)); |
101 |
+ |
} |
102 |
+ |
}); |
103 |
+ |
|
104 |
|
JToolBar bar = new JToolBar(JToolBar.HORIZONTAL); |
105 |
|
bar.add(connectButton); |
106 |
|
bar.add(disconnectButton); |
109 |
|
bar.add(stopDataButton); |
110 |
|
|
111 |
|
bar.add(Box.createGlue()); |
112 |
< |
JLabel image = new JLabel(new ImageIcon("./uk/ac/ukc/iscream/conient/i-scream.gif")); |
112 |
> |
JLabel image = new JLabel(new ImageIcon("./resources/i-scream.gif")); |
113 |
|
bar.add(image); |
114 |
|
return bar; |
115 |
|
} |
172 |
|
bar.add(conientMenu); |
173 |
|
|
174 |
|
JMenu connectionMenu = new JMenu("Connection"); |
175 |
< |
JMenuItem controlConnect = new JMenuItem("Connect", new ImageIcon("./uk/ac/ukc/iscream/conient/control16.gif")); |
176 |
< |
controlConnect.addActionListener(connectListener); |
175 |
> |
JMenuItem controlConnect = new JMenuItem("Connect", new ImageIcon("./resources/control16.gif")); |
176 |
> |
controlConnect.addActionListener(new ActionListener() { |
177 |
> |
public void actionPerformed(ActionEvent e) { |
178 |
> |
_actionQueue.add(new Integer(ConnectionHandler.CONNECT)); |
179 |
> |
} |
180 |
> |
}); |
181 |
|
connectionMenu.add(controlConnect); |
182 |
< |
JMenuItem controlDisconnect = new JMenuItem("Disconnect", new ImageIcon("./uk/ac/ukc/iscream/conient/stop16.gif")); |
183 |
< |
controlDisconnect.addActionListener(disconnectListener); |
182 |
> |
JMenuItem controlDisconnect = new JMenuItem("Disconnect", new ImageIcon("./resources/stop16.gif")); |
183 |
> |
controlDisconnect.addActionListener(new ActionListener() { |
184 |
> |
public void actionPerformed(ActionEvent e) { |
185 |
> |
_actionQueue.add(new Integer(ConnectionHandler.DISCONNECT)); |
186 |
> |
} |
187 |
> |
}); |
188 |
|
connectionMenu.add(controlDisconnect); |
189 |
|
connectionMenu.addSeparator(); |
190 |
< |
JMenuItem dataConnect = new JMenuItem("Start Data", new ImageIcon("./uk/ac/ukc/iscream/conient/data16.gif")); |
191 |
< |
dataConnect.addActionListener(startDataListener); |
190 |
> |
JMenuItem dataConnect = new JMenuItem("Start Data", new ImageIcon("./resources/data16.gif")); |
191 |
> |
dataConnect.addActionListener(new ActionListener() { |
192 |
> |
public void actionPerformed(ActionEvent e) { |
193 |
> |
_actionQueue.add(new Integer(ConnectionHandler.STARTDATA)); |
194 |
> |
} |
195 |
> |
}); |
196 |
|
connectionMenu.add(dataConnect); |
197 |
< |
JMenuItem dataDisconnect = new JMenuItem("Stop Data", new ImageIcon("./uk/ac/ukc/iscream/conient/stop16.gif")); |
198 |
< |
dataDisconnect.addActionListener(stopDataListener); |
197 |
> |
JMenuItem dataDisconnect = new JMenuItem("Stop Data", new ImageIcon("./resources/stop16.gif")); |
198 |
> |
dataDisconnect.addActionListener(new ActionListener() { |
199 |
> |
public void actionPerformed(ActionEvent e) { |
200 |
> |
_actionQueue.add(new Integer(ConnectionHandler.STOPDATA)); |
201 |
> |
} |
202 |
> |
}); |
203 |
|
connectionMenu.add(dataDisconnect); |
204 |
|
bar.add(connectionMenu); |
205 |
< |
|
152 |
< |
JMenu helpMenu = new JMenu("Help"); |
153 |
< |
JMenuItem help = new JMenuItem("Help"); |
154 |
< |
helpMenu.add(help); |
155 |
< |
JMenuItem about = new JMenuItem("About"); |
156 |
< |
helpMenu.add(about); |
157 |
< |
bar.add(helpMenu); |
158 |
< |
|
205 |
> |
|
206 |
|
return bar; |
207 |
|
} |
208 |
|
|
219 |
|
*/ |
220 |
|
JToolBar _toolBar = setupToolBar(); |
221 |
|
|
222 |
+ |
/** |
223 |
+ |
* The menu bar for the Frame |
224 |
+ |
*/ |
225 |
|
JMenuBar _menuBar = setupMenuBar(); |
226 |
|
|
227 |
|
/** |
233 |
|
* The connection handler in use by the system. |
234 |
|
*/ |
235 |
|
ConnectionHandler _handler; |
186 |
– |
|
187 |
– |
ActionListener connectListener = new ActionListener() |
188 |
– |
{ |
189 |
– |
public void actionPerformed(ActionEvent e) { |
190 |
– |
_actionQueue.add(new Integer(ConnectionHandler.CONNECT)); |
191 |
– |
} |
192 |
– |
}; |
193 |
– |
|
194 |
– |
|
195 |
– |
ActionListener startDataListener = new ActionListener() |
196 |
– |
{ |
197 |
– |
public void actionPerformed(ActionEvent e) { |
198 |
– |
_actionQueue.add(new Integer(ConnectionHandler.STARTDATA)); |
199 |
– |
} |
200 |
– |
}; |
201 |
– |
ActionListener stopDataListener = new ActionListener() |
202 |
– |
{ |
203 |
– |
public void actionPerformed(ActionEvent e) { |
204 |
– |
_actionQueue.add(new Integer(ConnectionHandler.STOPDATA)); |
205 |
– |
} |
206 |
– |
}; |
207 |
– |
|
208 |
– |
ActionListener disconnectListener = new ActionListener() |
209 |
– |
{ |
210 |
– |
public void actionPerformed(ActionEvent e) { |
211 |
– |
_actionQueue.add(new Integer(ConnectionHandler.DISCONNECT)); |
212 |
– |
} |
213 |
– |
}; |
236 |
|
|
237 |
|
//---STATIC ATTRIBUTES--- |
238 |
|
|