1
2
3
4
5 package hoplugins.trainingExperience.ui;
6
7 import hoplugins.Commons;
8 import hoplugins.TrainingExperience;
9
10 import hoplugins.commons.ui.DebugWindow;
11
12 import javax.swing.JTable;
13 import javax.swing.event.ListSelectionEvent;
14 import javax.swing.event.ListSelectionListener;
15
16
17 /***
18 * DOCUMENT ME!
19 *
20 * @author <a href="mailto:kenmooda@users.sourceforge.net">Tommi Rautava</a>
21 */
22 public class PlayerSelectionListener implements ListSelectionListener {
23
24
25 /*** TODO Missing Parameter Documentation */
26 JTable table;
27
28 /*** TODO Missing Parameter Documentation */
29 int playerIdColumn = 0;
30
31
32
33 /***
34 * DOCUMENT ME!
35 *
36 * @param table Table
37 * @param col player ID column
38 */
39 public PlayerSelectionListener(JTable table, int col) {
40 super();
41 this.table = table;
42 playerIdColumn = col;
43 }
44
45
46
47
48
49
50 public void valueChanged(ListSelectionEvent e) {
51 try {
52 if (e.getValueIsAdjusting()) {
53 return;
54 }
55
56 int index = table.getSelectedRow();
57
58 if (index >= 0) {
59 String playerId = (String) table.getValueAt(index, playerIdColumn);
60 TrainingExperience.selectPlayer(Commons.getModel().getSpieler(Integer.parseInt(playerId)));
61 }
62 } catch (Exception e2) {
63 DebugWindow.debug(e2);
64 }
65 }
66 }