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 package org.xmlcv.gui.tables;
28
29 import javax.swing.table.AbstractTableModel;
30
31 import org.xmlcv.model.FormationBean;
32 import org.xmlcv.model.CvDocumentBean.Cv.Formations;
33
34 /***
35 * @version $Revision: 114 $
36 * @author <a href="mailto:drazzib@drazzib.com">Damien Raude-Morvan </a>
37 */
38 public class EducationTableModel extends AbstractTableModel {
39
40 private Formations _formations;
41
42 private static String[] columnNames = new String[] { "Diplome", "Option",
43 "Description", "Ecole", "Ville", "Date"
44
45 };
46
47 private static final int DIPLOME = 0;
48
49 private static final int OPTION = 1;
50
51 private static final int DESC = 2;
52
53 private static final int ECOLE = 3;
54
55 private static final int VILLE = 4;
56
57 private static final int DATE = 5;
58
59 public EducationTableModel(Formations formations) {
60 assert formations != null;
61
62 this._formations = formations;
63 }
64
65
66
67
68
69
70 public int getColumnCount() {
71 return 6;
72 }
73
74
75
76
77
78
79 public String getColumnName(int col) {
80 return EducationTableModel.columnNames[col];
81 }
82
83
84
85
86
87
88 public int getRowCount() {
89 return this._formations.sizeOfFormationArray();
90 }
91
92
93
94
95
96
97 public Object getValueAt(int row, int column) {
98
99 String label = null;
100
101 FormationBean formation = this._formations.getFormationArray(row);
102
103 switch (column) {
104
105 case EducationTableModel.DIPLOME:
106 if (formation.getDiplome() != null) {
107 label = formation.getDiplome().getStringValue() + "("
108 + formation.getDiplome().getAcronyme() + ")";
109 }
110 break;
111
112 case EducationTableModel.OPTION:
113 if (formation.getOption() != null) {
114 label = formation.getOption().getStringValue();
115 }
116 break;
117
118 case EducationTableModel.DESC:
119 if (formation.getDescription() != null) {
120 label = formation.getDescription().getStringValue();
121 }
122 break;
123
124 case EducationTableModel.ECOLE:
125 if (formation.getEcole() != null) {
126 label = formation.getEcole().getStringValue() + "("
127 + formation.getEcole().getAcronyme() + ")";
128 }
129 break;
130
131 case EducationTableModel.VILLE:
132 label = formation.getVille();
133 break;
134
135 case EducationTableModel.DATE:
136 label = String.valueOf(formation.getDate());
137 break;
138
139 }
140
141 return label;
142 }
143
144 }