analyseWriter/src/fenetres/chargeEvaluations.java

639 lines
26 KiB
Java

package fenetres;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.Box;
import javax.swing.FocusManager;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.border.EmptyBorder;
import javax.swing.filechooser.FileSystemView;
import MEPTL.commandes;
import MEPTL.meptl;
import MEPTL.verificationFichierAnalyse;
import action.actSaveHistoriqueEvaluation;
import cXML.Run;
import cXML.node;
import net.miginfocom.swing.MigLayout;
public class chargeEvaluations extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private static chargeEvaluations instance;
private JPanel contentPane = new JPanel();
JPanel panelCentre = new JPanel();
ArrayList<JLabel> LeslabelsTitre = new ArrayList<JLabel>();
ArrayList<JLabel> LeslabelsMeta = new ArrayList<JLabel>();
ArrayList<JLabel> LeslabelsDate = new ArrayList<JLabel>();
ArrayList<JLabel> LeslabelsFileNameAnalysis = new ArrayList<JLabel>();
ArrayList<JRadioButton> LesRadioButtons = new ArrayList<JRadioButton>();
JLabel lblInformationBaseEvluation = new JLabel("");
public static boolean isDispose = true;
int indexSelect=0;
/**
* Create the frame.
*/
public static chargeEvaluations getInstance() {
if(chargeEvaluations.isDispose) instance = null;
if (instance == null) {
instance = new chargeEvaluations();
}
instance.setVisible(true);
isDispose=false;
return instance;
}
public chargeEvaluations() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 1300, 600);
int screenWidth = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth();
int screenHeight = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight();
setLocation(( (screenWidth) - getWidth()) / 2, (screenHeight - getHeight()) / 2);
ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") );
setIconImage(img.getImage());
setTitle(commandes.Titre + " - La base de données des évaluations");
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(2, 2));
JPanel panelGauche = new JPanel();
contentPane.add(panelGauche, BorderLayout.WEST);
panelGauche.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2));
JPanel panelHaut = new JPanel();
contentPane.add(panelHaut, BorderLayout.NORTH);
lblInformationBaseEvluation.setFont(new Font("Tahoma", Font.BOLD, 14));
panelHaut.add(lblInformationBaseEvluation);
JPanel panelBas = new JPanel();
contentPane.add(panelBas, BorderLayout.SOUTH);
panelBas.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 10));
JButton btnSupprimeEvaluation = new JButton("Supprimer une évaluation");
btnSupprimeEvaluation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnSupprimeEvaluation.setForeground(new Color(255, 0, 0));
btnSupprimeEvaluation.setFont(new Font("Tahoma", Font.BOLD, 12));
panelBas.add(btnSupprimeEvaluation);
Component horizontalGlue = Box.createHorizontalGlue();
panelBas.add(horizontalGlue);
Component horizontalGlue_1 = Box.createHorizontalGlue();
panelBas.add(horizontalGlue_1);
JButton btnSaveEvaluation = new JButton("Enregistre l'évaluation actuelle");
btnSaveEvaluation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new actSaveHistoriqueEvaluation();
}
});
btnSaveEvaluation.setForeground(new Color(0, 64, 128));
btnSaveEvaluation.setFont(new Font("Tahoma", Font.BOLD, 12));
panelBas.add(btnSaveEvaluation);
JButton btnValide = new JButton("Charger l'évaluation");
btnValide.setFont(new Font("Tahoma", Font.BOLD, 12));
btnValide.setForeground(new Color(0, 128, 0));
panelBas.add(btnValide);
JScrollPane scrollPaneCentre = new JScrollPane();
contentPane.add(scrollPaneCentre, BorderLayout.CENTER);
scrollPaneCentre.setViewportView(panelCentre);
panelCentre.setLayout(new MigLayout("gap rel 4", "[100px:n,grow][50px:n,grow][150px:n,grow 150][150px:n,grow 150][150px:n,grow 150]", "[20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0]"));
JLabel lblNewLabel = new JLabel("Nom de l'évaluation");
lblNewLabel.setForeground(new Color(0, 0, 255));
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel, "cell 0 0");
JLabel lblNewLabel_1 = new JLabel("Date d'enregistrement");
lblNewLabel_1.setForeground(new Color(0, 0, 255));
lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel_1, "cell 1 0");
JLabel lblNewLabel_2 = new JLabel("Nom du fichier d'analyse");
lblNewLabel_2.setForeground(new Color(0, 0, 255));
lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel_2, "cell 2 0");
JLabel lblNewLabel_3 = new JLabel("Titre de l'exercice");
lblNewLabel_3.setForeground(new Color(0, 0, 255));
lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel_3, "cell 3 0");
JLabel lblNewLabel_4 = new JLabel("Propriété personnalisé Sujet");
lblNewLabel_4.setForeground(new Color(0, 0, 255));
lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel_4, "cell 4 0");
// String dateDernierEnregistrement = commandes.evaluationsBase.getAttributs().get("date");
String nombreEvluation = String.valueOf(commandes.evaluationsBase.getNodes().size());
lblInformationBaseEvluation.setText("<html>Date dernière modification : " +calcul.formatDateWriter.DateEnClairFR( calcul.formatDateWriter.DateLibreOffice(commandes.evaluationsBase.getAttributs().get("date"))) + " -- Nombre d'évaluation : " + nombreEvluation);
for(int i = 0 ; i<commandes.evaluationsBase.getNodes().size(); i++ ) {
LesRadioButtons.add(new JRadioButton(commandes.evaluationsBase.getNodes().get(i).getAttributs().get("name")));
LeslabelsDate.add(new JLabel( calcul.formatDateWriter.DateEnClairFR( calcul.formatDateWriter.DateLibreOffice(commandes.evaluationsBase.getNodes().get(i).getAttributs().get("date") ) )));
node fichier = commandes.evaluationsBase.getNodes().get(i).retourneFirstEnfantsByName("fichier");
String Titre = fichier.getAttributs().get("titre");
String MetatSujet = fichier.getAttributs().get("metaSujet");
String nameFileAnalysis = fichier.getAttributs().get("filenameAnalyse");
LeslabelsTitre.add(new JLabel(Titre));
LeslabelsMeta.add(new JLabel(MetatSujet));
LeslabelsFileNameAnalysis.add(new JLabel(nameFileAnalysis));
}
int j = 0;
for(int i = 0 ; i<LesRadioButtons.size(); i++ ) {
j=i+1;
panelCentre.add(LesRadioButtons.get(i), "cell 0 "+j);
panelCentre.add(LeslabelsDate.get(i), "cell 1 "+j);
panelCentre.add(LeslabelsFileNameAnalysis.get(i), "cell 2 "+j);
panelCentre.add(LeslabelsTitre.get(i), "cell 3 "+j);
panelCentre.add(LeslabelsMeta.get(i), "cell 4 "+j);
LesRadioButtons.get(i).addMouseListener(new MyMouseListener());
}
btnValide.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int compteur = 0;
for(int i = 0; i < LesRadioButtons.size();i++) {
if(LesRadioButtons.get(i).isSelected()) compteur++;
}
if(compteur>1) {
for(int i = 0; i < LesRadioButtons.size();i++) {
LesRadioButtons.get(i).setSelected(false);
}
}else {
for(int i = 0; i < LesRadioButtons.size();i++) {
if(LesRadioButtons.get(i).isSelected()) {
chargeEvaluationSelected(commandes.evaluationsBase.getNodes().get(i));
isDispose=true;
dispose();
}
}
}
}
});
btnSupprimeEvaluation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int compteur = 0;
for(int i = 0; i < LesRadioButtons.size();i++) {
if(LesRadioButtons.get(i).isSelected()) compteur++;
}
if(compteur>1) {
for(int i = 0; i < LesRadioButtons.size();i++) {
LesRadioButtons.get(i).setSelected(false);
}
}else {
for(int i = 0; i < LesRadioButtons.size();i++) {
if(LesRadioButtons.get(i).isSelected()) {
commandes.evaluationsBase.getNodes().remove(i);
try {
ecritureBaseEvaluation(commandes.evaluationsBase);
} catch (IOException e1) {
e1.printStackTrace();
}
actualise();
}
}
}
}
});
/**
* Bouton Sauvegarde de l'évaluation.</br>
*/
btnSaveEvaluation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(commandes.fichierAnalyseValide) {
int compteur = 0;
String name ="Nom de l'évaluation";
for(int i = 0; i < LesRadioButtons.size();i++) {
if(LesRadioButtons.get(i).isSelected()) compteur++;
}
if(compteur>1) {
for(int i = 0; i < LesRadioButtons.size();i++) {
LesRadioButtons.get(i).setSelected(false);
}
}else {
for(int i = 0; i < LesRadioButtons.size();i++) {
if(LesRadioButtons.get(i).isSelected()) {
name = LesRadioButtons.get(i).getText();
}
}
}
name = JOptionPane.showInputDialog(null,"Donner un nom à cette évaluation ?",name);
if(!name.isBlank()) {
if(!isEvaluationExist(name)) {
commandes.evaluationsBase.getNodes().add(0, creationNodeEvaluation(new node(), name));;
}else {
creationNodeEvaluation(commandes.evaluationsBase.retourneFirstNodeByNameAndAttributValueExactStrict("evaluation", "name", name), name);
}
//Mise à jour de la base de données
Date aujourdhui = new Date();
commandes.evaluationsBase.getAttributs().put("version", commandes.version);
try {
commandes.evaluationsBase.getAttributs().put("date", calcul.formatDateWriter.DateLibreOffice(aujourdhui));
ecritureBaseEvaluation(commandes.evaluationsBase);
actualise();
} catch (ParseException | IOException e1) {
e1.printStackTrace();
}
}
}
}
});
ListenerAction();
}
//Quitte la fenêtre.</br>
private void ListenerAction() {
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
isDispose=true;
dispose();
}
});
}
class MyMouseListener extends MouseAdapter {
public void mouseClicked(MouseEvent evt) {
Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
indexSelect = LesRadioButtons.indexOf(focusOwner);
if (evt.getClickCount() == 3) {
System.out.println("triple-click");
LesRadioButtons.get(indexSelect).setSelected(true);
} else if (evt.getClickCount() == 2) {
System.out.println("double-click");
LesRadioButtons.get(indexSelect).setSelected(true);
}
else if (evt.getClickCount() == 1) {
System.out.println("click");
LesRadioButtons.get(indexSelect).setSelected(true);
}
System.out.println("indexSelect = " + indexSelect);
for(int i = 0; i < LesRadioButtons.size();i++) {
if(i!=indexSelect) LesRadioButtons.get(i).setSelected(false);
}
}
}
/**
* charge en mémoire l'évaluation sélectionnée.<br>
* @param evaluation
*/
private void chargeEvaluationSelected(node evaluation) {
//* Charge le node sujet provisoirement
commandes.path = evaluation.getAttributs().get("path"); //Dossier des fichiers des étudiants
commandes.sujet = evaluation.retourneFirstEnfantsByName("fichier"); // Chargement provisoire du node sujet depuis la base
commandes.nameSujet = evaluation.getAttributs().get("analysis_filename");
commandes.PathFilenameAnalysis = evaluation.getAttributs().get("PathFilenameAnalysis");
//** Les paramètres
commandes.version = evaluation.getAttributs().get("version");
commandes.fichierStudentMoodle = Boolean.valueOf(evaluation.getAttributs().get("fichierStudentMoodle"));
commandes.sansFeeback = Boolean.valueOf(evaluation.getAttributs().get("sansFeeback"));
commandes.noDetail = Boolean.valueOf(evaluation.getAttributs().get("noDetail"));
commandes.noNote = Boolean.valueOf(evaluation.getAttributs().get("noNote"));
commandes.zipfeedback = Boolean.valueOf(evaluation.getAttributs().get("zipfeedback"));
commandes.verifHisto2 = Boolean.valueOf(evaluation.getAttributs().get("verifHisto2"));
commandes.ecritNoteCSV = Boolean.valueOf(evaluation.getAttributs().get("ecritNoteCSV"));
commandes.newLogo = Boolean.valueOf(evaluation.getAttributs().get("newLogo"));
commandes.noLogo = Boolean.valueOf(evaluation.getAttributs().get("noLogo"));
commandes.fourniCSV = Boolean.valueOf(evaluation.getAttributs().get("fourniCSV"));
commandes.nameCSV = evaluation.getAttributs().get("nameCSV");
commandes.fourniCSV = Boolean.valueOf(evaluation.getAttributs().get("fourniCSV"));
commandes.nameSVG = evaluation.getAttributs().get("nameSVG");
commandes.nodeCSV = evaluation.retourneFirstEnfantsByName("fileCSV");
commandes.contenuFichierSVG = evaluation.retourneFirstEnfantsByName("nodSVG").retourneLesContenusEnfants("");
commandes.fichierAnalyseValide = true;
//* Rechercher la source
String CheminVersFileXML = "";
if(commandes.os.contains("Win")) {
commandes.PathFilenameAnalysis.replaceAll("/", "\\"); // Sur Windows
CheminVersFileXML = commandes.PathFilenameAnalysis + "\\" + commandes.nameSujet;
}else {
commandes.PathFilenameAnalysis.replaceAll("\\", "/"); // Sur Windows // Sur mac & Linux
CheminVersFileXML = commandes.PathFilenameAnalysis + "/" + commandes.nameSujet;
}
File file = new File(CheminVersFileXML);
if(file.exists()) {
chargeLeNodeSujet(file);
commandes.path = evaluation.getAttributs().get("path"); //Recharge le chemin vers le dossier contenant les fichiers des étudiants
}else {
JFrame frame = new JFrame();
JLabel texte = new JLabel("<html><p>Le fichier d'analyse de l'évaluation, " + commandes.nameSujet + ", <b>a été renommé ou supprimé</b>.</p><br>"
+ "<p>Le fichier d'analyse de l'évaluation <b><u>est récupéré</u></b> depuis la base de données des évaluations.</p></html>");
JOptionPane.showMessageDialog(frame, texte);
}
//** Remise à zéro de la base dans la mémoire de l'application
commandes.evaluationsBase = null;
//** Affichage de la fenêtre
if(!evaluate.isDispose) {
evaluate.getInstance();
};
if(!create.isDispose) {
create.getInstance();
};
isDispose=true;
}
/**
* Charge le fichier d'analyse de l'évaluation.<br>
* @param file
*/
private void chargeLeNodeSujet(File file) {
BufferedReader br;
try {
br = new BufferedReader(
new InputStreamReader(
new FileInputStream(file.getAbsoluteFile()), "UTF-8"));
String line;
StringBuilder targetString = new StringBuilder();
while ((line = br.readLine()) != null) {
targetString.append(line);
}
//node.node2(targetString);
node sujetLoad = new node(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
// Vérification de la conformité du fichier d'analyse
if(!ChargeFichierXML.fichierSujetValide(sujetLoad)) {
JOptionPane.showMessageDialog(null, "Le fichier d'analyse n'est pas valide.");
}else {
commandes.initialiseParametresSettingProprietes();
commandes.sujet = sujetLoad;
commandes.sujetSauvegarde = commandes.sujet.clone();
//Chargement des paramètres du fichier d'analyse
System.out.println( "Chargement des paramètres du fichier d'analyse");
meptl.chargementParametresFichierAnalyse();
// Rechercher des erreurs dans le fichier d'analyse
System.out.println( "Vérification du fichier d'analyse" );
new verificationFichierAnalyse();
}
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (Exception e) {
}
}
private void ecritureBaseEvaluation(node evaluations) throws IOException {
File directory = new File(FileSystemView.getFileSystemView().getDefaultDirectory().getPath());
Run.ecritureNodeEnXML(evaluations, "base_evaluations_analyseWriter.xml", directory.getAbsolutePath(), Run.TypeFile.Evaluation);
}
private boolean isEvaluationExist(String nameEvaluation) {
if(commandes.evaluationsBase.retourneFirstNodeByNameAndAttributValueExactStrict("evaluation", "name", nameEvaluation)!=null) return true;
return false;
}
private node creationNodeEvaluation(node evaluation, String name) {
evaluation.setNomElt("evaluation");
Date aujourdhui = new Date();
evaluation.getAttributs().put("version", commandes.version);
evaluation.getAttributs().put("name", name);
evaluation.getAttributs().put("PathFilenameAnalysis", commandes.PathFilenameAnalysis);
evaluation.getAttributs().put("path", commandes.path);
evaluation.getAttributs().put("fichierStudentMoodle", String.valueOf(commandes.fichierStudentMoodle));
evaluation.getAttributs().put("sansFeeback", String.valueOf(commandes.sansFeeback) );
evaluation.getAttributs().put("noDetail", String.valueOf(commandes.noDetail) );
evaluation.getAttributs().put("noNote", String.valueOf(commandes.noNote) );
evaluation.getAttributs().put("zipfeedback", String.valueOf(commandes.zipfeedback) );
evaluation.getAttributs().put("verifHisto2", String.valueOf(commandes.verifHisto2) );
evaluation.getAttributs().put("ecritNoteCSV", String.valueOf(commandes.ecritNoteCSV) );
evaluation.getAttributs().put("newLogo", String.valueOf(commandes.newLogo) );
evaluation.getAttributs().put("noLogo", String.valueOf(commandes.noLogo) );
//Supprime le node fichier s'il existe.
node nodremove = evaluation.retourneFirstEnfantsByName("fichier");
if(!nodremove.isVide()) evaluation.getNodes().remove(nodremove);
evaluation.getNodes().add(commandes.sujet);
if(commandes.sujet.getAttributs().get("analysis_filename").contains(".xml")) {
evaluation.getAttributs().put("analysis_filename",commandes.sujet.getAttributs().get("analysis_filename"));
}else {
evaluation.getAttributs().put("analysis_filename",commandes.nameSujet);
}
evaluation.getAttributs().put("fourniCSV", String.valueOf(commandes.fourniCSV) );
if(commandes.nameCSV!=null) {
evaluation.getAttributs().put("nameCSV", commandes.nameCSV );
}else {
evaluation.getAttributs().put("nameCSV", "");
}
evaluation.getAttributs().put("fourniCSV", String.valueOf(commandes.fourniCSV) );
if(commandes.nameSVG!=null) {
evaluation.getAttributs().put("nameSVG", commandes.nameSVG );
}else {
evaluation.getAttributs().put("nameSVG", "" );
}
//Supprime le node fichier s'il existe.
nodremove = evaluation.retourneFirstEnfantsByName("fileCSV");
if(!nodremove.isVide()) evaluation.getNodes().remove(nodremove);
evaluation.getNodes().add(commandes.nodeCSV);
try {
evaluation.getAttributs().put("date", calcul.formatDateWriter.DateLibreOffice(aujourdhui));
} catch (ParseException e) {
e.printStackTrace();
}
if(commandes.nameSVG!=null) {
if(!commandes.nameSVG.isBlank() && !commandes.contenuFichierSVG.isBlank()) {
node SVG = new node();
SVG.setNomElt("nodSVG");
SVG.setContenu(commandes.contenuFichierSVG);
evaluation.getNodes().add(SVG);
}
}
return evaluation;
}
private void actualise() {
LesRadioButtons.clear();
LeslabelsDate.clear();
LeslabelsTitre.clear();
LeslabelsFileNameAnalysis.clear();
LeslabelsMeta.clear();
panelCentre.removeAll();
panelCentre.setLayout(new MigLayout("gap rel 4", "[100px:n,grow][50px:n,grow][150px:n,grow 150][150px:n,grow 150][150px:n,grow 150]", "[20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0][20px:20px:20px,shrinkprio 0,shrink 0]"));
JLabel lblNewLabel = new JLabel("Nom de l'évaluation");
lblNewLabel.setForeground(new Color(0, 0, 255));
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel, "cell 0 0");
JLabel lblNewLabel_1 = new JLabel("Date d'enregistrement");
lblNewLabel_1.setForeground(new Color(0, 0, 255));
lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel_1, "cell 1 0");
JLabel lblNewLabel_2 = new JLabel("Nom du fichier d'analyse");
lblNewLabel_2.setForeground(new Color(0, 0, 255));
lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel_2, "cell 2 0");
JLabel lblNewLabel_3 = new JLabel("Titre de l'exercice");
lblNewLabel_3.setForeground(new Color(0, 0, 255));
lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel_3, "cell 3 0");
JLabel lblNewLabel_4 = new JLabel("Propriété personnalisé Sujet");
lblNewLabel_4.setForeground(new Color(0, 0, 255));
lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 14));
panelCentre.add(lblNewLabel_4, "cell 4 0");
String dateDernierEnregistrement = commandes.evaluationsBase.getAttributs().get("date");
String nombreEvluation = String.valueOf(commandes.evaluationsBase.getNodes().size());
lblInformationBaseEvluation.setText("<html>Date dernière modification : " + dateDernierEnregistrement + " -- Nombre d'évaluation : " + nombreEvluation);
for(int i = 0 ; i<commandes.evaluationsBase.getNodes().size(); i++ ) {
LesRadioButtons.add(new JRadioButton(commandes.evaluationsBase.getNodes().get(i).getAttributs().get("name")));
LeslabelsDate.add(new JLabel(commandes.evaluationsBase.getNodes().get(i).getAttributs().get("date")));
node fichier = commandes.evaluationsBase.getNodes().get(i).retourneFirstEnfantsByName("fichier");
String Titre = fichier.getAttributs().get("titre");
String MetatSujet = fichier.getAttributs().get("metaSujet");
String nameFileAnalysis = fichier.getAttributs().get("filenameAnalyse");
LeslabelsTitre.add(new JLabel(Titre));
LeslabelsMeta.add(new JLabel(MetatSujet));
LeslabelsFileNameAnalysis.add(new JLabel(nameFileAnalysis));
}
int j = 0;
for(int i = 0 ; i<LesRadioButtons.size(); i++ ) {
j=i+1;
panelCentre.add(LesRadioButtons.get(i), "cell 0 "+j);
panelCentre.add(LeslabelsDate.get(i), "cell 1 "+j);
panelCentre.add(LeslabelsFileNameAnalysis.get(i), "cell 2 "+j);
panelCentre.add(LeslabelsTitre.get(i), "cell 3 "+j);
panelCentre.add(LeslabelsMeta.get(i), "cell 4 "+j);
LesRadioButtons.get(i).addMouseListener(new MyMouseListener());
}
}
}