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