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.org.iscream.conient.datacomponents; |
21 |
> |
package uk.org.iscream.cms.conient.datacomponents; |
22 |
|
|
23 |
|
//---IMPORTS--- |
24 |
|
import javax.swing.JLabel; |
26 |
|
import java.awt.Color; |
27 |
|
import java.awt.GridLayout; |
28 |
|
import javax.swing.SwingUtilities; |
29 |
< |
import uk.org.iscream.util.XMLPacket; |
29 |
> |
import uk.org.iscream.cms.server.util.XMLPacket; |
30 |
|
|
31 |
|
/** |
32 |
|
* This is the most basic of DataComponents. |
66 |
|
_name = name; |
67 |
|
_statusAttribute = statusAttribute; |
68 |
|
_attribute = attribute; |
69 |
< |
setLayout(new GridLayout(1,1)); |
69 |
> |
setLayout(new GridLayout(1,2)); |
70 |
> |
_label = new JLabel(_name + ": "); |
71 |
> |
_label.setHorizontalAlignment(JLabel.RIGHT); |
72 |
|
_item = new JTextField("", DEFAULT_TEXT_LENGTH); |
73 |
< |
_item.setHorizontalAlignment(JTextField.CENTER); |
73 |
> |
_item.setHorizontalAlignment(JTextField.LEFT); |
74 |
|
_item.setEditable(false); |
75 |
|
_item.setText("-uninitialised-"); |
76 |
+ |
add(_label); |
77 |
|
add(_item); |
78 |
+ |
setVisible(false); |
79 |
|
} |
80 |
|
|
81 |
|
//---PUBLIC METHODS--- |
87 |
|
* run this method. |
88 |
|
*/ |
89 |
|
public void run() { |
90 |
+ |
if(!isVisible()) { |
91 |
+ |
setVisible(true); |
92 |
+ |
} |
93 |
|
if (_statusCache.equals("0")) { |
94 |
< |
_item.setBackground(Color.green); |
95 |
< |
_item.setText(_name + "[OK] : " + _cache); |
94 |
> |
_item.setForeground(Color.black); |
95 |
> |
_item.setText("[OK] : " + _cache); |
96 |
|
} else { |
97 |
< |
_item.setBackground(Color.red); |
98 |
< |
_item.setText(_name + "[FAILED] : " + _cache); |
97 |
> |
_item.setForeground(Color.red); |
98 |
> |
_item.setText("[FAILED] : " + _cache); |
99 |
|
} |
100 |
+ |
_item.setCaretPosition(0); |
101 |
|
} |
102 |
|
|
103 |
|
/** |