76 lines
2.6 KiB
Java
76 lines
2.6 KiB
Java
package baseEvaluations;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
import javax.swing.table.AbstractTableModel;
|
|
|
|
import MEPTL.commandes;
|
|
import cXML.node;
|
|
|
|
public class myTableBaseEvaluation extends AbstractTableModel{
|
|
private String[][] evaluation = new String[0][6];
|
|
private List<String> columNames = new ArrayList<>(Arrays.asList(new String[] {"Nom de l'évaluation","Date de création","Date de modification","Titre de l'exercice","Propriété personnalisé Sujet","Nom du fichier d'analyse"}));
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Override
|
|
public int getRowCount() {
|
|
return evaluation.length;
|
|
}
|
|
|
|
@Override
|
|
public int getColumnCount() {
|
|
return columNames.size();
|
|
}
|
|
|
|
@Override
|
|
public String getValueAt(int rowIndex, int columnIndex) {
|
|
return evaluation[rowIndex][columnIndex];
|
|
}
|
|
|
|
|
|
@Override
|
|
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
|
evaluation[rowIndex][columnIndex] = (String) aValue;
|
|
fireTableCellUpdated(rowIndex, columnIndex);
|
|
}
|
|
|
|
public String getColumnName(int column) {
|
|
return columNames.get(column);
|
|
}
|
|
|
|
public String getNameEvaluation(int rowIndex){
|
|
return evaluation[rowIndex][0];
|
|
}
|
|
|
|
|
|
public void addOrUpdate() {
|
|
evaluation = new String[commandes.evaluationsBase.getNodes().size()][columNames.size()];
|
|
for(int i = 0 ; i<commandes.evaluationsBase.getNodes().size();i++) {
|
|
String dateCreation ="";
|
|
evaluation[i][0] = commandes.evaluationsBase.getNodes().get(i).getAttributs().get("name");
|
|
if(commandes.evaluationsBase.getNodes().get(i).getAttributs().get("date")!=null) {
|
|
dateCreation = calcul.formatDateWriter.DateEnClairFR( calcul.formatDateWriter.DateLibreOffice(commandes.evaluationsBase.getNodes().get(i).getAttributs().get("date") ));
|
|
}
|
|
evaluation[i][1] = dateCreation;
|
|
if(commandes.evaluationsBase.getNodes().get(i).getAttributs().get("dateModification")!=null) {
|
|
evaluation[i][2] = calcul.formatDateWriter.DateEnClairFR( calcul.formatDateWriter.DateLibreOffice(commandes.evaluationsBase.getNodes().get(i).getAttributs().get("dateModification") ));
|
|
}else {
|
|
evaluation[i][2] = dateCreation;
|
|
}
|
|
node fichier = commandes.evaluationsBase.getNodes().get(i).retourneFirstEnfantsByName("fichier");
|
|
evaluation[i][3] = fichier.getAttributs().get("titre");
|
|
evaluation[i][4] = fichier.getAttributs().get("metaSujet");
|
|
evaluation[i][5] = fichier.getAttributs().get("analysis_filename");
|
|
}
|
|
fireTableRowsInserted(0, commandes.evaluationsBase.getNodes().size()-1);
|
|
}
|
|
|
|
|
|
|
|
}
|