-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconsoleStsCR.java
More file actions
64 lines (54 loc) · 2.28 KB
/
consoleStsCR.java
File metadata and controls
64 lines (54 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package Jvakt;
/*
* 2022-06-23 V.54 Michael Ekdal Added getVersion() to get at consistent version throughout all classes.
*/
import javax.swing.*;
import java.awt.*;
import javax.swing.table.*;
class consoleStsCR extends JLabel implements TableCellRenderer
{
// private String columnName;
static final long serialVersionUID = 50L;
public consoleStsCR()
{
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value,boolean isSelected, boolean hasFocus, int row, int column)
{
Object ValueState = table.getValueAt(row,table.getColumnModel().getColumnIndex("state"));
Object ValuePrio = table.getValueAt(row,table.getColumnModel().getColumnIndex("prio"));
Object ValueType = table.getValueAt(row,table.getColumnModel().getColumnIndex("type"));
Object ValueStatus = table.getValueAt(row,table.getColumnModel().getColumnIndex("status"));
int vPrio;
if (ValuePrio == null) vPrio = 30;
else vPrio = (Integer)ValuePrio;
String vState = (String)ValueState;
String vType = (String)ValueType;
String vStatus = (String)ValueStatus;
if (vType == null) vType = " ";
if (vStatus == null) vStatus = " ";
if (value != null) setText(value.toString());
else setText(" ");
setFont(new javax.swing.plaf.FontUIResource("Dialog", Font.BOLD, table.getRowHeight()-3));
if(isSelected)
{
setBackground(table.getSelectionBackground());
setForeground(table.getSelectionForeground());
}
else
{
setBackground(table.getBackground());
setForeground(table.getForeground());
setBackground(Color.WHITE);
// if (vStatus.startsWith("INFO") ) setBackground(java.awt.Color.yellow);
// if (vStatus.startsWith("T") ) setBackground(java.awt.Color.orange);
// if (vPrio >= 30 ) setBackground(java.awt.Color.yellow);
if (vPrio < 30 && vPrio > 10 ) setBackground(java.awt.Color.pink);
if (vPrio <= 10 ) setBackground(java.awt.Color.magenta);
try{if (!vState.startsWith("A") ) setBackground(java.awt.Color.lightGray); } catch(NullPointerException npe2) {}
try{if (vType.startsWith("D") ) setBackground(java.awt.Color.yellow); } catch(NullPointerException npe2) {}
// if (vStatus.startsWith("OK") ) setBackground(java.awt.Color.green);
}
return this;
}
}