tie UI Student table to database student table
[se-panther.git] / gui-playground / src / panther / ui / SessionTableModel.java
blobf0684747e24c69ba14e06dac19fb4b6b65f1a509
1 package panther.ui;
3 import java.util.Date;
4 import javax.swing.*;
5 import javax.swing.table.AbstractTableModel;
7 import panther.db.*;
9 public class SessionTableModel
10 extends AbstractTableModel
12 private int n_rows;
14 private RepetoireList l_repetoire;
15 // private final static int N_DATES = 5;
16 // private Date[] dates;
18 public SessionTableModel()
20 l_repetoire = null;
22 n_rows = 0;
23 // dates = new Date[N_DATES];
24 // for (int i=0; i<N_DATES; i++) {
25 // dates[i] = new Date();
26 // }
29 public String getColumnName(int col)
31 if (col == 0) {
32 return "Session";
35 return null;
38 public int getColumnCount()
40 return 1;
43 public int getRowCount()
45 return n_rows;
48 public Object getValueAt(int row, int col)
50 if (col == 0 && n_rows > 0) {
51 if (l_repetoire != null) {
52 return l_repetoire.get(row);
54 // return dates[row];
57 return null;
60 private void update_n_rows()
62 n_rows = l_repetoire.size();
65 public void update_student_sessions(int sid)
67 l_repetoire = MySQLManager.get_student_repetoire(sid);
69 update_n_rows();
71 fireTableDataChanged();