| 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.org.iscream.cms.conient; |
| 23 |
|
|
| 24 |
|
//---IMPORTS--- |
| 25 |
|
import javax.swing.*; |
| 26 |
|
import javax.swing.border.*; |
| 6 |
– |
import java.awt.Color; |
| 7 |
– |
|
| 27 |
|
import java.awt.*; |
| 28 |
|
import java.awt.event.*; |
| 10 |
– |
import java.net.*; |
| 11 |
– |
import java.io.*; |
| 12 |
– |
import java.util.Date; |
| 13 |
– |
import java.text.DateFormat; |
| 14 |
– |
import java.util.Locale; |
| 29 |
|
|
| 30 |
|
/** |
| 31 |
< |
* NASTY AND BASIC, PLEASE DON'T COMPLAIN |
| 31 |
> |
* This is the main class of the Conient client. |
| 32 |
|
* |
| 33 |
+ |
* This sets up the control panel, the data panel |
| 34 |
+ |
* and its own display. |
| 35 |
+ |
* |
| 36 |
|
* @author $Author$ |
| 37 |
|
* @version $Id$ |
| 38 |
|
*/ |
| 39 |
< |
public class SwingClient extends JFrame implements Runnable { |
| 39 |
> |
public class Conient extends JFrame { |
| 40 |
|
|
| 41 |
|
//---FINAL ATTRIBUTES--- |
| 42 |
|
|
| 44 |
|
* The current CVS revision of this class |
| 45 |
|
*/ |
| 46 |
|
public final String REVISION = "$Revision$"; |
| 47 |
+ |
|
| 48 |
+ |
/** |
| 49 |
+ |
* The initial width of the window |
| 50 |
+ |
*/ |
| 51 |
+ |
private final int DEFAULT_WIDTH = 700; |
| 52 |
|
|
| 53 |
< |
private final int width = 300; |
| 54 |
< |
private final int height = 700; |
| 53 |
> |
/** |
| 54 |
> |
* The initial height of the window |
| 55 |
> |
*/ |
| 56 |
> |
private final int DEFAULT_HEIGHT = 600; |
| 57 |
|
|
| 58 |
+ |
/** |
| 59 |
+ |
* The default configuration fle |
| 60 |
+ |
* This can be specified on the command line |
| 61 |
+ |
*/ |
| 62 |
+ |
public static final String DEFAULT_CONFIG_FILE = "./etc/default.conf"; |
| 63 |
+ |
|
| 64 |
+ |
/** |
| 65 |
+ |
* The time in seconds to display the splash |
| 66 |
+ |
* screen for |
| 67 |
+ |
*/ |
| 68 |
+ |
public static final int DISPLAY_SPLASH_TIME_SECONDS = 3; |
| 69 |
+ |
|
| 70 |
|
//---STATIC METHODS--- |
| 71 |
|
|
| 72 |
+ |
/** |
| 73 |
+ |
* The first method that is called. |
| 74 |
+ |
* Sets up the various panels |
| 75 |
+ |
* |
| 76 |
+ |
* @param args the command line arguments |
| 77 |
+ |
*/ |
| 78 |
|
public static void main(String[] args) { |
| 79 |
< |
try { |
| 80 |
< |
String host = args[0]; |
| 81 |
< |
int port = 4510; |
| 82 |
< |
Socket socket = new Socket(host, port); |
| 83 |
< |
BufferedReader inBound = new BufferedReader(new InputStreamReader(socket.getInputStream())); |
| 84 |
< |
PrintWriter outBound = new PrintWriter(socket.getOutputStream()); |
| 85 |
< |
DataReader data = new DataReader(inBound); |
| 79 |
> |
// get the host from the command line if they gave it |
| 80 |
> |
String host = null; |
| 81 |
> |
String configFile = DEFAULT_CONFIG_FILE; |
| 82 |
> |
if (args.length == 1) { |
| 83 |
> |
configFile = args[0]; |
| 84 |
> |
} |
| 85 |
> |
|
| 86 |
> |
// start the configuration system |
| 87 |
> |
Configuration.initialise(configFile); |
| 88 |
> |
|
| 89 |
> |
// the data display panel |
| 90 |
> |
DataPanel data = new DataPanel(); |
| 91 |
|
|
| 92 |
< |
SwingClient cli = new SwingClient(data); |
| 93 |
< |
Thread cliThread = new Thread(cli); |
| 94 |
< |
cliThread.start(); |
| 95 |
< |
} catch (Exception e) { |
| 96 |
< |
System.err.println("ERROR: " + e); |
| 97 |
< |
} |
| 92 |
> |
// the control panel |
| 93 |
> |
ControlPanel control = new ControlPanel(data); |
| 94 |
> |
|
| 95 |
> |
// the main frame (passed the two panels) |
| 96 |
> |
Conient client = new Conient(data, control); |
| 97 |
> |
conientFrame = (Frame) client; |
| 98 |
> |
Conient.addMessage("Conient {an i-scream Client} (c) 2001 The i-scream Project (http://www.i-scream.org.uk)"); |
| 99 |
> |
|
| 100 |
> |
Conient.addMessage("Conient ready."); |
| 101 |
> |
|
| 102 |
|
} |
| 103 |
|
|
| 104 |
+ |
/** |
| 105 |
+ |
* A static accessor, allowing components of the system |
| 106 |
+ |
* to get hold of the root frame of the system. |
| 107 |
+ |
* |
| 108 |
+ |
* see conientFrame attribute for details. |
| 109 |
+ |
* |
| 110 |
+ |
* @return the root Conient frame |
| 111 |
+ |
*/ |
| 112 |
+ |
public static Frame getFrame() { |
| 113 |
+ |
return conientFrame; |
| 114 |
+ |
} |
| 115 |
+ |
|
| 116 |
|
//---CONSTRUCTORS--- |
| 117 |
|
|
| 118 |
|
/** |
| 119 |
< |
* Creates a new Swing Client. |
| 119 |
> |
* Creates a new Swing Client Frame |
| 120 |
|
*/ |
| 121 |
< |
public SwingClient(DataReader data) { |
| 59 |
< |
_data = data; |
| 121 |
> |
private Conient(JSplitPane data, ControlPanel control) { |
| 122 |
|
// set up the Frame |
| 123 |
< |
setTitle("I-Scream Client"); |
| 124 |
< |
setSize(width, height); |
| 125 |
< |
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| 64 |
< |
Box box = Box.createVerticalBox(); |
| 65 |
< |
|
| 66 |
< |
// create the i-scream logo at the top |
| 67 |
< |
JLabel iscream = new JLabel(new ImageIcon("i-scream.gif")); |
| 68 |
< |
JLabel comment = new JLabel(" I-Scream Client"); |
| 69 |
< |
comment.setForeground( new Color(0, 0, 102)); |
| 70 |
< |
Box header = Box.createHorizontalBox(); |
| 71 |
< |
header.add(comment); |
| 72 |
< |
header.add(Box.createHorizontalGlue()); |
| 73 |
< |
header.add(iscream); |
| 123 |
> |
super("Conient {an i-scream Client}"); |
| 124 |
> |
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); |
| 125 |
> |
setJMenuBar(control.getMenuBar()); |
| 126 |
|
|
| 127 |
< |
ImageIcon icon = new ImageIcon("server.gif"); |
| 128 |
< |
JTabbedPane tabbedPane = new JTabbedPane(); |
| 129 |
< |
JPanel mainPanel = new JPanel(); |
| 130 |
< |
mainPanel.setLayout(new GridLayout(21, 1)); |
| 127 |
> |
// set what happens when the X in the corner is clicked |
| 128 |
> |
addWindowListener(new WindowAdapter() { |
| 129 |
> |
public void windowClosing(WindowEvent e) {System.exit(0);} |
| 130 |
> |
}); |
| 131 |
|
|
| 132 |
< |
JPanel panel1 = makeTextPanel("Machine Name : ", _machine_name); |
| 133 |
< |
JPanel panel2 = makeTextPanel("IP : ", _ip); |
| 134 |
< |
JPanel panel3 = makeTextPanel("Date : ", _date); |
| 135 |
< |
JPanel panel4 = makeTextPanel("Sequence Number : ", _seq_no); |
| 84 |
< |
JPanel panel5 = makeTextPanel("Host Time : ", _sTime); |
| 85 |
< |
JPanel panel6 = makeTextPanel("Load Average (1 min) : ", _load_load1); |
| 86 |
< |
JPanel panel7 = makeTextPanel("Load Average (5 min) : ", _load_load5); |
| 87 |
< |
JPanel panel8 = makeTextPanel("Load Average (15 min) : ", _load_load15); |
| 88 |
< |
JPanel panel9 = makeTextPanel("Processes Total : ", _processes_total); |
| 89 |
< |
JPanel panel10 = makeTextPanel("Processes Sleeping : ", _processes_sleeping); |
| 90 |
< |
JPanel panel11 = makeTextPanel("Processes Zombie : ", _processes_zombie); |
| 91 |
< |
JPanel panel12 = makeTextPanel("Processes Stopped : ", _processes_stopped); |
| 92 |
< |
JPanel panel13 = makeTextPanel("CPU % idle : ", _cpu_idle); |
| 93 |
< |
JPanel panel14 = makeTextPanel("CPU % user : ", _cpu_user); |
| 94 |
< |
JPanel panel15 = makeTextPanel("CPU % kernel : ", _cpu_kernel); |
| 95 |
< |
JPanel panel16 = makeTextPanel("CPU % i/o wait : ", _cpu_iowait); |
| 96 |
< |
JPanel panel17 = makeTextPanel("CPU % swapping : ", _cpu_swap); |
| 97 |
< |
JPanel panel18 = makeTextPanel("Real Memory : ", _memory_real); |
| 98 |
< |
JPanel panel19 = makeTextPanel("Real Free : ", _memory_free); |
| 99 |
< |
JPanel panel20 = makeTextPanel("Swap in use : ", _memory_swapinuse); |
| 100 |
< |
JPanel panel21 = makeTextPanel("Swap free : ", _memory_swapfree); |
| 101 |
< |
mainPanel.add(panel1); |
| 102 |
< |
mainPanel.add(panel2); |
| 103 |
< |
mainPanel.add(panel3); |
| 104 |
< |
mainPanel.add(panel4); |
| 105 |
< |
mainPanel.add(panel5); |
| 106 |
< |
mainPanel.add(panel6); |
| 107 |
< |
mainPanel.add(panel7); |
| 108 |
< |
mainPanel.add(panel8); |
| 109 |
< |
mainPanel.add(panel9); |
| 110 |
< |
mainPanel.add(panel10); |
| 111 |
< |
mainPanel.add(panel11); |
| 112 |
< |
mainPanel.add(panel12); |
| 113 |
< |
mainPanel.add(panel13); |
| 114 |
< |
mainPanel.add(panel14); |
| 115 |
< |
mainPanel.add(panel15); |
| 116 |
< |
mainPanel.add(panel16); |
| 117 |
< |
mainPanel.add(panel17); |
| 118 |
< |
mainPanel.add(panel18); |
| 119 |
< |
mainPanel.add(panel19); |
| 120 |
< |
mainPanel.add(panel20); |
| 121 |
< |
mainPanel.add(panel21); |
| 122 |
< |
|
| 123 |
< |
tabbedPane.addTab("Raptor", icon, mainPanel, "Monitor raptor.ukc.ac.uk"); |
| 124 |
< |
|
| 125 |
< |
tabbedPane.setSelectedIndex(0); |
| 132 |
> |
// add the control pane to the top border |
| 133 |
> |
getContentPane().add(control, "North"); |
| 134 |
> |
// add the data pane to the centre |
| 135 |
> |
getContentPane().add(data); |
| 136 |
|
|
| 137 |
< |
// build the frame |
| 138 |
< |
box.add(header); |
| 139 |
< |
box.add(tabbedPane); |
| 140 |
< |
getContentPane().add(box); |
| 137 |
> |
// setup the status panel |
| 138 |
> |
JPanel bottom = new JPanel(); |
| 139 |
> |
bottom.setLayout(new BorderLayout()); |
| 140 |
> |
_messages.setEditable(false); |
| 141 |
> |
_messages.setRows(3); |
| 142 |
> |
JScrollPane messagesPane = new JScrollPane(_messages); |
| 143 |
> |
messagesPane.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 102)), " Messages ")); |
| 144 |
> |
bottom.add(messagesPane, "Center"); |
| 145 |
> |
JPanel statusPanel = new JPanel(); |
| 146 |
> |
JPanel linkPanel = new JPanel(); |
| 147 |
> |
linkPanel.setLayout(new GridLayout(1,2)); |
| 148 |
> |
linkPanel.add(_controlStatus); |
| 149 |
> |
linkPanel.add(_dataStatus); |
| 150 |
> |
statusPanel.setLayout(new GridLayout(2,1)); |
| 151 |
> |
statusPanel.add(linkPanel); |
| 152 |
> |
statusPanel.add(_queueStatus); |
| 153 |
> |
bottom.add(statusPanel, "South"); |
| 154 |
|
|
| 155 |
< |
// show the window |
| 155 |
> |
// add the status panel to the bottom border |
| 156 |
> |
getContentPane().add(bottom, "South"); |
| 157 |
> |
|
| 158 |
> |
// a nice icon for the window |
| 159 |
> |
setIconImage((new ImageIcon(getClass().getResource("/resources/server.gif"))).getImage()); |
| 160 |
> |
|
| 161 |
> |
// and just because we can, a silly splash screen |
| 162 |
> |
// of the dudes that did this funky jibble |
| 163 |
> |
Splash splash = new Splash(); |
| 164 |
> |
splash.show(); |
| 165 |
> |
// wait |
| 166 |
> |
try { |
| 167 |
> |
Thread.sleep(DISPLAY_SPLASH_TIME_SECONDS * 1000); |
| 168 |
> |
} catch (InterruptedException e) { |
| 169 |
> |
// don't do anything, we don't care |
| 170 |
> |
} |
| 171 |
> |
//loose the window |
| 172 |
> |
splash.dispose(); |
| 173 |
> |
splash = null; |
| 174 |
> |
// show the main window |
| 175 |
|
show(); |
| 176 |
|
} |
| 177 |
|
|
| 178 |
|
//---PUBLIC METHODS--- |
| 179 |
|
|
| 138 |
– |
public void run() { |
| 139 |
– |
_data.start(); |
| 140 |
– |
while(true) { |
| 141 |
– |
String xml = _data.getXML(); |
| 142 |
– |
if (xml == null) { |
| 143 |
– |
// nothing |
| 144 |
– |
} else { |
| 145 |
– |
|
| 146 |
– |
// Get a string without any null characters in it. |
| 147 |
– |
// -- maybe String.trim() would be better here ? |
| 148 |
– |
if (xml.indexOf(0) != -1) { |
| 149 |
– |
xml = xml.substring(0, xml.indexOf(0)); |
| 150 |
– |
} |
| 151 |
– |
else { |
| 152 |
– |
xml = xml.substring(0, xml.length()); |
| 153 |
– |
} |
| 154 |
– |
|
| 155 |
– |
// Use XMLPacketMaker to make an XMLPacket object. |
| 156 |
– |
XMLPacketMaker xmlPacketMaker = new XMLPacketMaker(xml); |
| 157 |
– |
XMLPacket packet = xmlPacketMaker.createXMLPacket(); |
| 158 |
– |
|
| 159 |
– |
_machine_name.setText(packet.getParam("packet.attributes.machine_name")); |
| 160 |
– |
_ip.setText(packet.getParam("packet.attributes.ip")); |
| 161 |
– |
_date.setText(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date(Long.parseLong(packet.getParam("packet.attributes.date"))))); |
| 162 |
– |
_seq_no.setText(packet.getParam("packet.attributes.seq_no")); |
| 163 |
– |
|
| 164 |
– |
_sTime.setText(packet.getParam("packet.sTime")); |
| 165 |
– |
|
| 166 |
– |
_load_load1.setText(packet.getParam("packet.load.load1")); |
| 167 |
– |
_load_load5.setText(packet.getParam("packet.load.load5")); |
| 168 |
– |
_load_load15.setText(packet.getParam("packet.load.load15")); |
| 169 |
– |
|
| 170 |
– |
_processes_total.setText(packet.getParam("packet.processes.total")); |
| 171 |
– |
_processes_sleeping.setText(packet.getParam("packet.processes.sleeping")); |
| 172 |
– |
_processes_zombie.setText(packet.getParam("packet.processes.zombie")); |
| 173 |
– |
_processes_stopped.setText(packet.getParam("packet.processes.stopped")); |
| 174 |
– |
|
| 175 |
– |
_cpu_idle.setString(packet.getParam("packet.cpu.idle") + "%"); |
| 176 |
– |
_cpu_idle.setValue(new Double(packet.getParam("packet.cpu.idle")).intValue()); |
| 177 |
– |
_cpu_user.setString(packet.getParam("packet.cpu.user") + "%"); |
| 178 |
– |
_cpu_user.setValue(new Double(packet.getParam("packet.cpu.user")).intValue()); |
| 179 |
– |
_cpu_kernel.setString(packet.getParam("packet.cpu.kernel") + "%"); |
| 180 |
– |
_cpu_kernel.setValue(new Double(packet.getParam("packet.cpu.kernel")).intValue()); |
| 181 |
– |
_cpu_iowait.setString(packet.getParam("packet.cpu.iowait") + "%"); |
| 182 |
– |
_cpu_iowait.setValue(new Double(packet.getParam("packet.cpu.iowait")).intValue()); |
| 183 |
– |
_cpu_swap.setString(packet.getParam("packet.cpu.swap") + "%"); |
| 184 |
– |
_cpu_swap.setValue(new Double(packet.getParam("packet.cpu.swap")).intValue()); |
| 185 |
– |
|
| 186 |
– |
_memory_real.setText(packet.getParam("packet.memory.real")); |
| 187 |
– |
_memory_free.setText(packet.getParam("packet.memory.free")); |
| 188 |
– |
_memory_swapinuse.setText(packet.getParam("packet.memory.swapinuse")); |
| 189 |
– |
_memory_swapfree.setText(packet.getParam("packet.memory.swapfree")); |
| 190 |
– |
} |
| 191 |
– |
} |
| 192 |
– |
} |
| 193 |
– |
|
| 180 |
|
//---PRIVATE METHODS--- |
| 181 |
+ |
|
| 182 |
+ |
//---ACCESSOR/MUTATOR METHODS--- |
| 183 |
+ |
|
| 184 |
+ |
/** |
| 185 |
+ |
* Sets the control link status. |
| 186 |
+ |
* |
| 187 |
+ |
* @param status the message |
| 188 |
+ |
*/ |
| 189 |
+ |
public static void setControlStatus(String status) { |
| 190 |
+ |
_controlStatus.setText("Control Link: " + status); |
| 191 |
+ |
_controlStatus.repaint(); |
| 192 |
+ |
} |
| 193 |
|
|
| 194 |
< |
protected JPanel makeTextPanel(String text, Component item) { |
| 195 |
< |
JPanel panel = new JPanel(false); |
| 196 |
< |
JLabel label = new JLabel(text); |
| 197 |
< |
label.setHorizontalAlignment(JLabel.RIGHT); |
| 198 |
< |
//item.setHorizontalAlignment(JLabel.LEFT); |
| 199 |
< |
panel.setLayout(new GridLayout(1, 2)); |
| 200 |
< |
panel.add(label); |
| 201 |
< |
panel.add(item); |
| 204 |
< |
return panel; |
| 194 |
> |
/** |
| 195 |
> |
* Sets the data link status. |
| 196 |
> |
* |
| 197 |
> |
* @param status the message |
| 198 |
> |
*/ |
| 199 |
> |
public static void setDataStatus(String status) { |
| 200 |
> |
_dataStatus.setText("Data Link: " + status); |
| 201 |
> |
_dataStatus.repaint(); |
| 202 |
|
} |
| 203 |
|
|
| 204 |
+ |
/** |
| 205 |
+ |
* Updates the queue status. |
| 206 |
+ |
* |
| 207 |
+ |
* @param currentQueue |
| 208 |
+ |
* @param numElements |
| 209 |
+ |
*/ |
| 210 |
+ |
public static void setQueueStatus(int currentQueue, int numElements) { |
| 211 |
+ |
_queueStatus.setText("Data Queue : " + currentQueue + " Packets Recieved : " + numElements); |
| 212 |
+ |
_queueStatus.repaint(); |
| 213 |
+ |
} |
| 214 |
|
|
| 215 |
< |
//---ACCESSOR/MUTATOR METHODS--- |
| 215 |
> |
/** |
| 216 |
> |
* Adds a system message to the messages list |
| 217 |
> |
* |
| 218 |
> |
* @param message the new message |
| 219 |
> |
*/ |
| 220 |
> |
public static void addMessage(String message) { |
| 221 |
> |
_messages.insert(message + "\n", 0); |
| 222 |
> |
} |
| 223 |
|
|
| 224 |
|
//---ATTRIBUTES--- |
| 211 |
– |
|
| 212 |
– |
JLabel _machine_name = new JLabel(); |
| 213 |
– |
JLabel _ip = new JLabel(); |
| 214 |
– |
JLabel _date = new JLabel(); |
| 215 |
– |
JLabel _seq_no = new JLabel(); |
| 225 |
|
|
| 226 |
< |
JLabel _sTime = new JLabel(); |
| 226 |
> |
//---STATIC ATTRIBUTES--- |
| 227 |
|
|
| 228 |
< |
JLabel _load_load1 = new JLabel(); |
| 229 |
< |
JLabel _load_load5 = new JLabel(); |
| 230 |
< |
JLabel _load_load15 = new JLabel(); |
| 231 |
< |
|
| 223 |
< |
JLabel _processes_total = new JLabel(); |
| 224 |
< |
JLabel _processes_sleeping = new JLabel(); |
| 225 |
< |
JLabel _processes_zombie = new JLabel(); |
| 226 |
< |
JLabel _processes_stopped = new JLabel(); |
| 227 |
< |
|
| 228 |
< |
int min = 0; |
| 229 |
< |
int max = 100; |
| 230 |
< |
JProgressBar _cpu_idle = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
| 228 |
> |
/** |
| 229 |
> |
* Displays information about the data link |
| 230 |
> |
*/ |
| 231 |
> |
static JLabel _controlStatus = new JLabel("Control Link: Disconnected", JLabel.LEFT); |
| 232 |
|
{ |
| 233 |
< |
_cpu_idle.setStringPainted(true); |
| 233 |
> |
_controlStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); |
| 234 |
|
} |
| 235 |
< |
JProgressBar _cpu_user = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
| 235 |
> |
|
| 236 |
> |
/** |
| 237 |
> |
* Displays information about the data link |
| 238 |
> |
*/ |
| 239 |
> |
static JLabel _dataStatus = new JLabel("Data Link: Disconnected", JLabel.LEFT); |
| 240 |
|
{ |
| 241 |
< |
_cpu_user.setStringPainted(true); |
| 241 |
> |
_dataStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); |
| 242 |
|
} |
| 243 |
< |
JProgressBar _cpu_kernel = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
| 243 |
> |
|
| 244 |
> |
/** |
| 245 |
> |
* Displays information about the inbound data queue. |
| 246 |
> |
*/ |
| 247 |
> |
static JLabel _queueStatus = new JLabel(" ", JLabel.LEFT); |
| 248 |
|
{ |
| 249 |
< |
_cpu_kernel.setStringPainted(true); |
| 249 |
> |
_queueStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); |
| 250 |
|
} |
| 251 |
< |
JProgressBar _cpu_iowait = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
| 251 |
> |
|
| 252 |
> |
/** |
| 253 |
> |
* The place where system messages are written. |
| 254 |
> |
*/ |
| 255 |
> |
static JTextArea _messages = new JTextArea(); |
| 256 |
|
{ |
| 257 |
< |
_cpu_iowait.setStringPainted(true); |
| 257 |
> |
_messages.setLineWrap(true); |
| 258 |
|
} |
| 246 |
– |
JProgressBar _cpu_swap = new JProgressBar(JProgressBar.HORIZONTAL, min, max); |
| 247 |
– |
{ |
| 248 |
– |
_cpu_swap.setStringPainted(true); |
| 249 |
– |
} |
| 259 |
|
|
| 260 |
< |
JLabel _memory_real = new JLabel(); |
| 261 |
< |
JLabel _memory_free = new JLabel(); |
| 262 |
< |
JLabel _memory_swapinuse = new JLabel(); |
| 263 |
< |
JLabel _memory_swapfree = new JLabel(); |
| 264 |
< |
DataReader _data; |
| 260 |
> |
/** |
| 261 |
> |
* Holds a reference to the root frame for Conient |
| 262 |
> |
* This is only used by dialogs (specifically the configurationn |
| 263 |
> |
* dialog) so that it can be modal, please use the accessor. |
| 264 |
> |
*/ |
| 265 |
> |
private static Frame conientFrame; |
| 266 |
|
|
| 267 |
< |
//---STATIC ATTRIBUTES--- |
| 268 |
< |
|
| 269 |
< |
} |
| 267 |
> |
//---INNER CLASSES---- |
| 268 |
> |
|
| 269 |
> |
/** |
| 270 |
> |
* An inner class to display a splash screen |
| 271 |
> |
*/ |
| 272 |
> |
private class Splash extends JWindow { |
| 273 |
> |
|
| 274 |
> |
/** |
| 275 |
> |
* Constructs a new splash screen |
| 276 |
> |
*/ |
| 277 |
> |
public Splash() { |
| 278 |
> |
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
| 279 |
> |
JPanel splash = new JPanel(); |
| 280 |
> |
splash.setBackground(Color.black); |
| 281 |
> |
JLabel image = new JLabel((new ImageIcon(getClass().getResource("/resources/i-scream-splash.gif")))); |
| 282 |
> |
splash.add(image); |
| 283 |
> |
setContentPane(splash); |
| 284 |
> |
Dimension screen = getToolkit().getScreenSize(); |
| 285 |
> |
pack(); |
| 286 |
> |
setLocation((screen.width - getSize().width) / 2, |
| 287 |
> |
(screen.height - getSize().height) / 2); |
| 288 |
> |
|
| 289 |
> |
|
| 290 |
> |
} |
| 291 |
> |
} |
| 292 |
> |
} |