1
2 package hoplugins.teamAnalyzer.ui;
3
4 import hoplugins.Commons;
5
6 import hoplugins.teamAnalyzer.SystemManager;
7 import hoplugins.teamAnalyzer.manager.PlayerDataManager;
8 import hoplugins.teamAnalyzer.vo.PlayerInfo;
9
10 import java.awt.Color;
11 import java.awt.Component;
12
13 import javax.swing.ImageIcon;
14 import javax.swing.JLabel;
15 import javax.swing.JTable;
16 import javax.swing.table.DefaultTableCellRenderer;
17
18
19 /***
20 * TODO Missing Class Documentation
21 *
22 * @author TODO Author Name
23 */
24 public class RosterTableRenderer extends DefaultTableCellRenderer {
25
26
27
28
29
30
31
32
33 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
34 boolean hasFocus, int row, int column) {
35 super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
36
37 try {
38
39 setOpaque(true);
40 setToolTipText(null);
41 setIcon(null);
42
43 if (isSelected) {
44
45 }
46
47 if (column > 3) {
48 setHorizontalAlignment(JLabel.CENTER);
49 } else {
50 setHorizontalAlignment(JLabel.LEFT);
51 }
52
53 if (column == 9) {
54 int v = Integer.parseInt((String) value);
55 ImageIcon icon = Commons.getModel().getHelper().getImageIcon4Spezialitaet(v);
56 setIcon(icon);
57 setText("");
58 return this;
59 }
60
61 int status = Integer.parseInt("" + table.getModel().getValueAt(row, 13));
62
63 switch (status) {
64 case PlayerDataManager.INJURED:
65 setForeground(Color.RED);
66 break;
67
68 case PlayerDataManager.SUSPENDED:
69 setForeground(Color.RED);
70 break;
71
72 case PlayerDataManager.SOLD:
73 setForeground(Color.BLUE);
74 break;
75
76 default:
77 setForeground(Color.BLACK);
78 break;
79 }
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105 int playerId = Integer.parseInt("" + table.getModel().getValueAt(row, 14));
106 PlayerInfo oldInfo = SystemManager.getPlugin().getMainPanel().getRosterPanel()
107 .getPrevious(playerId);
108
109 if (oldInfo.getPlayerId() == 0) {
110 return this;
111 }
112
113 switch (column) {
114 case 6: {
115 int v = Integer.parseInt("" + value);
116 int diff = v - oldInfo.getForm();
117
118 if (Commons.getModel().getHelper().isDevVersion()) {
119 setIcon(Commons.getModel().getHelper().getImageIcon4Veraenderung(diff));
120 }
121
122 break;
123 }
124
125 case 7: {
126 int v = Integer.parseInt("" + value);
127 int diff = v - oldInfo.getExperience();
128
129 if (Commons.getModel().getHelper().isDevVersion()) {
130 setIcon(Commons.getModel().getHelper().getImageIcon4Veraenderung(diff));
131 }
132
133 break;
134 }
135
136 case 8: {
137 int v = Integer.parseInt("" + value);
138 int diff = v - oldInfo.getTSI();
139 String desc = "";
140
141 if (Commons.getModel().getHelper().isDevVersion()) {
142 if (diff > 0) {
143 desc = "+";
144 }
145
146 desc = desc + diff;
147 }
148
149 setText(getText() + " " + desc);
150 break;
151 }
152 }
153 } catch (Exception e) {
154 setText("!!!");
155 setToolTipText(e.toString());
156 }
157
158 return this;
159 }
160 }