MAJ V4.4.3

This commit is contained in:
pablo rodriguez 2023-02-18 18:05:42 +01:00
parent e89e51b8e6
commit 542559a987
59 changed files with 612 additions and 238 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -28,6 +28,7 @@ public class actEvaluer extends AbstractAction{
public void actionPerformed(ActionEvent e) {
evaluate.getInstance();
create.getInstance().dispose();
create.isDispose=true;
}
}

View File

@ -31,6 +31,7 @@ public class actExit extends AbstractAction {
@Override
public void actionPerformed(ActionEvent e) {
if(JOptionPane.showConfirmDialog(null,"Voulez-vous quitter analyseWriter?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
create.isDispose=true;
create.getInstance().dispose();
}
}

View File

@ -9,6 +9,9 @@ import java.io.InputStreamReader;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileSystemView;
import MEPTL.commandes;
@ -29,9 +32,16 @@ public class actOpenHistoriqueEvaluation extends AbstractAction{
nodeEvaluations();
if(commandes.evaluationsBase!=null) {
chargeEvaluations.getInstance();
}else {
commandes.evaluationsBase = new node();
commandes.evaluationsBase.setNomElt("evaluations");
chargeEvaluations.getInstance();
}
}
/**
* Récupération du node base_evaluations_analyseWriter.xml.</br>
*/
private void nodeEvaluations() {
File directory = new File(FileSystemView.getFileSystemView().getDefaultDirectory().getPath());
@ -42,6 +52,7 @@ public class actOpenHistoriqueEvaluation extends AbstractAction{
}else {
file = new File(directory.getAbsolutePath() + "/" + "base_evaluations_analyseWriter.xml");
}
if(file!=null) {
BufferedReader br;
try {
@ -56,13 +67,17 @@ public class actOpenHistoriqueEvaluation extends AbstractAction{
node evaluations = new node(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
if(evaluations!=null) {
if(evaluations.getNodes().size()>0) {
if(evaluations.getNodes().get(0).getNomElt().equals("evaluation")) {
if(evaluations.getNomElt().equals("evaluations")) {
commandes.evaluationsBase = evaluations;
}
}
}
}catch (Exception e) {
JFrame frame = new JFrame();
JLabel texte = new JLabel("<html><p>Il y a une erreur avec le fichier <b>base_evaluations_analyseWriter.xml</b></p>"
+ "<p>Probablement, il a été renommé ou supprimé.</p>"
+ "Ou bien encore, il ne contient aucune évaluation.</html>");
JOptionPane.showMessageDialog(frame, texte);
}
}
}

View File

@ -40,7 +40,8 @@ public class actSaveHistoriqueEvaluation extends AbstractAction{
if(!name.isBlank()) {
node evaluations = nodeEvaluations();
if(!isEvaluationExist(evaluations, name)) {
evaluations.getNodes().add(creationNodeEvaluation(new node(), name));
evaluations.getNodes().add(0, creationNodeEvaluation(new node(), name));
// evaluations.getNodes().add(creationNodeEvaluation(new node(), name));
}else {
evaluations.getNodes().add(creationNodeEvaluation(evaluations.retourneFirstNodeByNameAndAttributValueExactStrict("evaluation", "name", name), name));
}
@ -118,13 +119,30 @@ public class actSaveHistoriqueEvaluation extends AbstractAction{
evaluation.getAttributs().put("newLogo", String.valueOf(commandes.newLogo) );
evaluation.getAttributs().put("noLogo", String.valueOf(commandes.noLogo) );
evaluation.getAttributs().put("fourniCSV", String.valueOf(commandes.fourniCSV) );
evaluation.getAttributs().put("nameCSV", commandes.nameCSV );
evaluation.getAttributs().put("fourniCSV", String.valueOf(commandes.fourniCSV) );
evaluation.getAttributs().put("nameSVG", commandes.nameSVG );
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", "" );
}
evaluation.getNodes().add(commandes.nodeCSV);
try {
@ -133,12 +151,13 @@ public class actSaveHistoriqueEvaluation extends AbstractAction{
e.printStackTrace();
}
if(!commandes.nameSVG.isBlank() && !commandes.contenuFichierSVG.isBlank()) {
node SVG = new node();
SVG.setNomElt("nodSVG");
SVG.setContenu(commandes.contenuFichierSVG);
evaluation.getNodes().add(SVG);
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;

View File

@ -50,7 +50,6 @@ public class ChargeFichierXML extends JFileChooser {
File file = new File(getSelectedFile().getAbsolutePath());
System.out.println(file.getPath() + "\n" + file.getName());
String ext = file.getName().substring(file.getName().lastIndexOf("."));
if(ext.equals(".xml")){

View File

@ -9,20 +9,35 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
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;
@ -37,7 +52,9 @@ public class chargeEvaluations extends JFrame {
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>();
public static boolean isDispose = true;
int indexSelect=0;
@ -46,21 +63,20 @@ public class chargeEvaluations extends JFrame {
* Create the frame.
*/
public static chargeEvaluations getInstance() {
if(chargeEvaluations.isDispose) instance = null;
if (instance == null) {
instance = new chargeEvaluations();
}
// instance.actualise();
// instance.setVisible(true);
instance.setVisible(true);
isDispose=false;
return instance;
}
public chargeEvaluations() {
setBounds(100, 100, 870, 600);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 806, 669);
setBounds(100, 100, 1200, 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);
@ -89,9 +105,34 @@ public class chargeEvaluations extends JFrame {
contentPane.add(panelBas, BorderLayout.SOUTH);
panelBas.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
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(Color.RED);
btnValide.setForeground(new Color(0, 128, 0));
panelBas.add(btnValide);
JScrollPane scrollPaneCentre = new JScrollPane();
@ -99,8 +140,27 @@ public class chargeEvaluations extends JFrame {
JPanel panelCentre = new JPanel();
scrollPaneCentre.setViewportView(panelCentre);
panelCentre.setLayout(new MigLayout("gap rel 0", "[100px:n,grow][50px:n,grow][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]"));
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.setFont(new Font("Tahoma", Font.BOLD, 12));
panelCentre.add(lblNewLabel, "cell 0 0");
JLabel lblNewLabel_1 = new JLabel("Date d'enregistrement");
lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 12));
panelCentre.add(lblNewLabel_1, "cell 1 0");
JLabel lblNewLabel_2 = new JLabel("Nom du fichier d'analyse");
lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 12));
panelCentre.add(lblNewLabel_2, "cell 2 0");
JLabel lblNewLabel_3 = new JLabel("Titre de l'exercice");
lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 12));
panelCentre.add(lblNewLabel_3, "cell 3 0");
JLabel lblNewLabel_4 = new JLabel("Propriété personnalisé Sujet");
lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 12));
panelCentre.add(lblNewLabel_4, "cell 4 0");
String dateDernierEnregistrement = commandes.evaluationsBase.getAttributs().get("date");
@ -113,95 +173,174 @@ public class chargeEvaluations extends JFrame {
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");
String Titre = commandes.evaluationsBase.getNodes().get(i).retourneFirstEnfantsByName("fichier").getAttributs().get("titre");
String MetatSujet = commandes.evaluationsBase.getNodes().get(i).retourneFirstEnfantsByName("fichier").getAttributs().get("metaSujet");
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++ ) {
panelCentre.add(LesRadioButtons.get(i), "cell 0 "+i);
panelCentre.add(LeslabelsDate.get(i), "cell 1 "+i);
panelCentre.add(LeslabelsTitre.get(i), "cell 2 "+i);
panelCentre.add(LeslabelsMeta.get(i), "cell 3 "+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());
}
addMouseListener((MouseListener) new MouseAdapter() {
public void mousePressed(MouseEvent me) {
System.out.println(me);
Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
System.out.println(focusOwner.getName());
}
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 3) {
System.out.println("triple-click");
} else if (evt.getClickCount() == 2) {
System.out.println("double-click");
}
else if (evt.getClickCount() == 1) {
System.out.println("click");
}
Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
indexSelect = LesRadioButtons.indexOf(focusOwner);
System.out.println("indexSelect = " + indexSelect);
for(int i = 0; i < LesRadioButtons.size();i++) {
if(i!=indexSelect)LesRadioButtons.get(i).setSelected(false);
}
}
});
btnValide.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
for(int i = 0 ; i < LesRadioButtons.size();i++) {
if(LesRadioButtons.get(i).isSelected()) {
chargeEvaluationSelected(commandes.evaluationsBase.getNodes().get(i));
dispose();
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();
}
isDispose=true;
dispose();
getInstance();
}
}
}
}
});
btnSaveEvaluation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(commandes.fichierAnalyseValide) {
String name = JOptionPane.showInputDialog(null,"Donner un nom à cette évaluation ?","Nom de l'évaluation");
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);
isDispose=true;
dispose();
getInstance();
} catch (ParseException | IOException e1) {
e1.printStackTrace();
}
}
}
}
});
setVisible(true);
ListenerAction();
}
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);
}
Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
indexSelect = LesRadioButtons.indexOf(focusOwner);
System.out.println("indexSelect = " + indexSelect);
for(int i = 0; i < LesRadioButtons.size();i++) {
if(i!=indexSelect)LesRadioButtons.get(i).setSelected(false);
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) {
commandes.version = evaluation.getAttributs().get("version");
//* 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");
commandes.path = evaluation.getAttributs().get("path");
//** 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"));
@ -218,16 +357,175 @@ public class chargeEvaluations extends JFrame {
commandes.fourniCSV = Boolean.valueOf(evaluation.getAttributs().get("fourniCSV"));
commandes.nameSVG = evaluation.getAttributs().get("nameSVG");
commandes.sujet = evaluation.retourneFirstEnfantsByName("fichier");
commandes.nodeCSV = evaluation.retourneFirstEnfantsByName("fileCSV");
commandes.contenuFichierSVG = evaluation.retourneFirstEnfantsByName("nodSVG").retourneLesContenusEnfants("");
commandes.fichierAnalyseValide = true;
evaluate.getInstance();
//* 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) );
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", "" );
}
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;
}
}

View File

@ -59,6 +59,7 @@ import action.actLicence;
import action.actNewFichierAnalyse;
import action.actNodeFichier;
import action.actOpen;
import action.actOpenHistoriqueEvaluation;
import action.actPaste;
import action.actSave;
import action.actSaveAs;
@ -92,7 +93,7 @@ public final class create extends JFrame {
private static JToggleButton tglbtnTousLesNodes;
private JPanel panelPrincipal;
private static create instance;
public static boolean isDispose = true;
/**
* Création de la fenêtre.</br>
*/
@ -116,6 +117,7 @@ public final class create extends JFrame {
}
instance.setVisible(true);
lectureFichierDejaCharger();
isDispose=false;
return instance;
}
@ -254,9 +256,9 @@ public final class create extends JFrame {
/*JMenuItem mnuNewFile =*/
mnuFile.add( new actOpen() );
mnuFile.add( new actNewFichierAnalyse() );
// mnuFile.addSeparator();
mnuFile.addSeparator();
// mnuFile.add( new actSaveHistoriqueEvaluation() );
// mnuFile.add( new actOpenHistoriqueEvaluation() );
mnuFile.add( new actOpenHistoriqueEvaluation() );
mnuFile.addSeparator();
mnuFile.add( new actSave() );
mnuFile.add( new actSaveAs() );
@ -344,17 +346,21 @@ public final class create extends JFrame {
toolBarPrincipal.setName("outils principaux");
// JButton btnChargeEvaluation = toolBarPrincipal.add( new actOpenHistoriqueEvaluation() );
// btnChargeEvaluation.setIcon(new ImageIcon(create.class.getResource("/resources/chargehistoriqueevaluation.png")));
// btnChargeEvaluation.setHideActionText(true);
// toolBarPrincipal.add(btnChargeEvaluation);
//
JButton btnChargeEvaluation = toolBarPrincipal.add( new actOpenHistoriqueEvaluation() );
btnChargeEvaluation.setIcon(new ImageIcon(create.class.getResource("/resources/chargehistoriqueevaluation.png")));
btnChargeEvaluation.setHideActionText(true);
toolBarPrincipal.add(btnChargeEvaluation);
// JButton btnSaveEvluation = toolBarPrincipal.add( new actSaveHistoriqueEvaluation() );
// btnSaveEvluation.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// }
// });
// btnSaveEvluation.setIcon(new ImageIcon(create.class.getResource("/resources/sauvegardehistoriqueevaluation.png")));
// btnSaveEvluation.setHideActionText(true);
// toolBarPrincipal.add(btnSaveEvluation);
//
// toolBarPrincipal.addSeparator();
toolBarPrincipal.addSeparator();
JButton buttonLoadFile = toolBarPrincipal.add( new actOpen() );
buttonLoadFile.setIcon(new ImageIcon(create.class.getResource("/resources/fichierAnalyse.png")));
@ -499,8 +505,11 @@ public final class create extends JFrame {
toolBarPrincipal.addSeparator();
JButton buttonExit = toolBarPrincipal.add( new actExit() );
buttonExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
buttonExit.setHideActionText( true );
}
@ -573,11 +582,13 @@ public final class create extends JFrame {
*/
public void closeWindows() {
if(JOptionPane.showConfirmDialog(null,"Voulez-vous quitter analyseWriter?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
dispose();
isDispose=true;
dispose();
}
}
public void closeDirectlyWindows() {
isDispose=true;
this.dispose();
}

View File

@ -41,7 +41,6 @@ import action.actAbout;
import action.actDocumentation;
import action.actLicence;
import action.actOpenHistoriqueEvaluation;
import action.actSaveHistoriqueEvaluation;
import action.actTutoriels;
import cXML.Run;
import cXML.node;
@ -91,6 +90,7 @@ public class evaluate extends JFrame {
private static afficheText txtpnmessages;
private static evaluate instance;
public static boolean isDispose = true;
/**
* Create the frame.
@ -219,8 +219,6 @@ public class evaluate extends JFrame {
}
});
lblnozip = new JLabel("");
lblnozip.setIcon(new ImageIcon(evaluate.class.getResource("/resources/zipstudent.png")));
@ -382,8 +380,6 @@ public class evaluate extends JFrame {
private void ListenerAction() {
/*Some piece of code*/
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
@ -394,19 +390,23 @@ public class evaluate extends JFrame {
});
}
/**
* Affichage de la fenêtre.
* @return
*/
public static evaluate getInstance() {
if (instance == null) {
instance = new evaluate();
}else {
instance.setVisible(true);
instance.setVisible(true);
}
if(commandes.fichierAnalyseValide) {
// txtpnmessages.afficheChargementFichierAnalyse();
refreshLabel();
}else {
txtpnmessages.setText(baliseStyle.balise() + "<hr class=\"city\"><h1>*** Veuillez charger un fichier d'analyse ***</h1><hr>");
}
isDispose=false;
return instance;
}
@ -424,6 +424,9 @@ public class evaluate extends JFrame {
}
/**
* Création du menu principal de la fenêtre.</br>
*/
private void createMenu() {
JMenuBar menuBar = new JMenuBar();
menuBar.setFont(new Font("Segoe UI", Font.BOLD, 14));
@ -432,7 +435,7 @@ public class evaluate extends JFrame {
JMenu mnNewMenu = new JMenu("Fichier");
mnNewMenu.setMnemonic( 'F' );
menuBar.add(mnNewMenu);
mnNewMenu.add( new actSaveHistoriqueEvaluation() );
// mnNewMenu.add( new actSaveHistoriqueEvaluation() );
mnNewMenu.add( new actOpenHistoriqueEvaluation() );
mnNewMenu.addSeparator();
mnNewMenu.add( actSave );
@ -481,7 +484,9 @@ public class evaluate extends JFrame {
}
/**
* Création de la barre d'outil de la fenêtre.</br>
*/
private void createToolBar() {
toolBar = new JToolBar();
@ -490,10 +495,14 @@ public class evaluate extends JFrame {
btnChargeEvaluation.setHideActionText(true);
toolBar.add(btnChargeEvaluation);
JButton btnSaveEvluation = toolBar.add( new actSaveHistoriqueEvaluation() );
btnSaveEvluation.setIcon(new ImageIcon(create.class.getResource("/resources/sauvegardehistoriqueevaluation.png")));
btnSaveEvluation.setHideActionText(true);
toolBar.add(btnSaveEvluation);
// JButton btnSaveEvluation = toolBar.add( new actSaveHistoriqueEvaluation() );
// btnSaveEvluation.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// }
// });
// btnSaveEvluation.setIcon(new ImageIcon(create.class.getResource("/resources/sauvegardehistoriqueevaluation.png")));
// btnSaveEvluation.setHideActionText(true);
// toolBar.add(btnSaveEvluation);
toolBar.addSeparator();
@ -632,6 +641,16 @@ public class evaluate extends JFrame {
chckbxVerif.setEnabled(false);
chckbxNoDetail.setEnabled(false);
}else {
chckbxfichiersEtudiants.setSelected(commandes.fichierStudentMoodle);
chckbxZipfeedback.setSelected(commandes.zipfeedback);
chckbxnoFeedback.setSelected(commandes.sansFeeback);
chckbxnoFeedback.setSelected(commandes.noNote);
chckCSVNotes.setSelected(commandes.ecritNoteCSV);
chckbxNewLogo.setSelected(commandes.newLogo);
chckbxNoLogo.setSelected(commandes.noLogo);
chckbxVerif.setSelected(commandes.verifHisto2);
chckbxNoDetail.setSelected(commandes.noDetail);
chckbxfichiersEtudiants.setEnabled(true);
chckbxZipfeedback.setEnabled(true);
chckbxnoFeedback.setEnabled(true);
@ -641,6 +660,7 @@ public class evaluate extends JFrame {
chckbxNoLogo.setEnabled(true);
chckbxVerif.setEnabled(true);
chckbxNoDetail.setEnabled(true);
txtpnmessages.afficheChargementFichierAnalyse();
}
@ -686,7 +706,7 @@ public class evaluate extends JFrame {
putValue( Action.SHORT_DESCRIPTION, "Evaluer les fichiers (CTRL+E)" );
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK) );
}
@Override
public void actionPerformed(ActionEvent e) {
if(commandes.fichierAnalyseValide) {
@ -698,73 +718,73 @@ public class evaluate extends JFrame {
/**
* Ouvre et affiche un fichier d'analyse au format XML.</br>
*/
private AbstractAction actOpen = new AbstractAction() {
* Ouvre et affiche un fichier d'analyse au format XML.</br>
*/
private AbstractAction actOpen = new AbstractAction() {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
{
putValue(LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierAnalyse.png")));
putValue( Action.NAME, "Ouvrir un nouveau fichier d'analyse" );
putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/fichierAnalysemini.png")) );
putValue( Action.MNEMONIC_KEY, KeyEvent.VK_O );
putValue( Action.SHORT_DESCRIPTION, "Ouvrir un nouveau fichier d'analyse (CTRL+O)" );
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK) );
}
@Override
public void actionPerformed( ActionEvent e ) {
new ChargeFichierXML();
refreshLabel();
}
};
{
putValue(LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierAnalyse.png")));
putValue( Action.NAME, "Ouvrir un nouveau fichier d'analyse" );
putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/fichierAnalysemini.png")) );
putValue( Action.MNEMONIC_KEY, KeyEvent.VK_O );
putValue( Action.SHORT_DESCRIPTION, "Ouvrir un nouveau fichier d'analyse (CTRL+O)" );
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK) );
}
@Override
public void actionPerformed( ActionEvent e ) {
new ChargeFichierXML();
refreshLabel();
}
};
/**
* Chargement d'un logo SVG.</br>
*/
private AbstractAction actChargeLogo = new AbstractAction() {
/**
* Chargement d'un logo SVG.</br>
*/
private AbstractAction actChargeLogo = new AbstractAction() {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
{
putValue(Action.LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierSVG.png")));
putValue( Action.NAME, "Charge un logo SVG" );
putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichierSVGmini.png")));
putValue( Action.MNEMONIC_KEY, KeyEvent.VK_G );
putValue( Action.SHORT_DESCRIPTION, "Charge un logo SVG (CTRL+G)" );
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_DOWN_MASK) );
}
@Override
public void actionPerformed( ActionEvent e ) {
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Choisir un fichier SVG");
chooser.setCurrentDirectory(new java.io.File(commandes.path));
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
FileNameExtensionFilter filter = new FileNameExtensionFilter("Format SVG", "svg");
chooser.setFileFilter(filter);
chooser.setAcceptAllFileFilterUsed(true);
{
putValue(Action.LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierSVG.png")));
putValue( Action.NAME, "Charge un logo SVG" );
putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichierSVGmini.png")));
putValue( Action.MNEMONIC_KEY, KeyEvent.VK_G );
putValue( Action.SHORT_DESCRIPTION, "Charge un logo SVG (CTRL+G)" );
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_DOWN_MASK) );
}
@Override
public void actionPerformed( ActionEvent e ) {
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Choisir un fichier SVG");
chooser.setCurrentDirectory(new java.io.File(commandes.path));
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
FileNameExtensionFilter filter = new FileNameExtensionFilter("Format SVG", "svg");
chooser.setFileFilter(filter);
chooser.setAcceptAllFileFilterUsed(true);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : " + chooser.getSelectedFile().getAbsolutePath());
commandes.nameSVG = chooser.getSelectedFile().getAbsolutePath();
commandes.contenuFichierSVG= meptl.chargementFichierSVG();
txtpnmessages.setContentType("text/plain");
txtpnmessages.setText(commandes.contenuFichierSVG);
} else {
commandes.nameSVG = "";
commandes.contenuFichierSVG="";
System.out.println("No Selection ");
}
refreshLabel();
}
};
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : " + chooser.getSelectedFile().getAbsolutePath());
commandes.nameSVG = chooser.getSelectedFile().getAbsolutePath();
commandes.contenuFichierSVG= meptl.chargementFichierSVG();
txtpnmessages.setContentType("text/plain");
txtpnmessages.setText(commandes.contenuFichierSVG);
} else {
commandes.nameSVG = "";
commandes.contenuFichierSVG="";
System.out.println("No Selection ");
}
refreshLabel();
}
};
/**
* Sélectionne le dossier courant contenant les fichiers des étudiants
*/
@ -800,7 +820,6 @@ public class evaluate extends JFrame {
}
};
/**
/**
* Verification de l'historique.</br>
@ -833,7 +852,6 @@ public class evaluate extends JFrame {
} catch (InterruptedException e1) {
e1.printStackTrace();
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}else {
@ -842,77 +860,82 @@ public class evaluate extends JFrame {
commandes.verifHisto = false;
}
};
private AbstractAction actVerifCSV = new AbstractAction() {
private static final long serialVersionUID = 1L;
{
putValue(Action.LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierCSVInfoXML.png")));
putValue( Action.NAME, "Vérification des champs du CSV" );
putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichierCSVInfoXMLmini.png")) );
putValue( Action.MNEMONIC_KEY, KeyEvent.VK_U );
putValue( Action.SHORT_DESCRIPTION, "Vérification des champs du CSV (CTRL+B)" );
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK) );
}
@Override
public void actionPerformed( ActionEvent e ) {
if(commandes.fichierAnalyseValide) {
if(commandes.fourniCSV) {
node settingCSV = commandes.sujet.retourneFirstEnfantsByName("import_moodle");
if(settingCSV.isHasAttributs()) {
String email ="inconnu";
String name = "inconnu";
String firstname = "inconnu";
String id = "inconnu";
txtpnmessages.setContentType("text/plain");
boolean avertissement = false;
if(settingCSV.getAttributs().get("email")!=null) {
email = settingCSV.getAttributs().get("email");
}
if(settingCSV.getAttributs().get("name")!=null) {
name = settingCSV.getAttributs().get("name");
}
if(settingCSV.getAttributs().get("firstname")!=null) {
firstname = settingCSV.getAttributs().get("firstname");
}
if(settingCSV.getAttributs().get("id")!=null) {
id = settingCSV.getAttributs().get("id");
}
if(commandes.nodeCSV.getNodes().get(0).getAttributs().get(firstname)==null) {
txtpnmessages.setText("*** AVERTISSEMENT - Il n'y a pas le champ " + firstname + " dans le fichier CSV. ***");
avertissement=true;
}
if(commandes.nodeCSV.getNodes().get(0).getAttributs().get(name)==null) {
txtpnmessages.setText("*** AVERTISSEMENT - Il n'y a pas le champ " + name + " dans le fichier CSV. ***");
avertissement=true;
}
if(commandes.nodeCSV.getNodes().get(0).getAttributs().get(id)==null) {
txtpnmessages.setText("*** AVERTISSEMENT - Il n'y a pas le champ " + id + " dans le fichier CSV. ***");
avertissement=true;
}
if(commandes.nodeCSV.getNodes().get(0).getAttributs().get(email)==null) {
txtpnmessages.setText("*** AVERTISSEMENT - Il n'y a pas le champ " + email + " dans le fichier CSV. ***");
avertissement=true;
}
if(!avertissement) {
txtpnmessages.setText("*** Le fichier CSV contenant la liste des étudiants peut être utilisé avec les paramètres du fichier d'analyse ***");
}
}else {
txtpnmessages.setText("*** Le fichier CSV contenant la liste des étudiants est vide ***");
}
}else {
txtpnmessages.setText("*** Veuillez charger un fichier CSV contenant la liste des étudiants ***");
new msgBox("Le fichier CSV contenant la liste des étudiants n'est pas chargé.",true,false,"Avertissement");
}
}else {
txtpnmessages.setText("*** Veuillez charger un fichier d'analyse ***");
new msgBox("Le fichier d'analyse n'est pas valide.",true,false,"Avertissement");
}
}
};
/**
*
*/
private AbstractAction actVerifCSV = new AbstractAction() {
private static final long serialVersionUID = 1L;
{
putValue(Action.LARGE_ICON_KEY, new ImageIcon(evaluate.class.getResource("/resources/fichierCSVInfoXML.png")));
putValue( Action.NAME, "Vérification des champs du CSV" );
putValue( Action.SMALL_ICON, new ImageIcon(evaluate.class.getResource("/resources/fichierCSVInfoXMLmini.png")) );
putValue( Action.MNEMONIC_KEY, KeyEvent.VK_U );
putValue( Action.SHORT_DESCRIPTION, "Vérification des champs du CSV (CTRL+B)" );
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK) );
}
@Override
public void actionPerformed( ActionEvent e ) {
if(commandes.fichierAnalyseValide) {
if(commandes.fourniCSV) {
node settingCSV = commandes.sujet.retourneFirstEnfantsByName("import_moodle");
if(settingCSV.isHasAttributs()) {
String email ="inconnu";
String name = "inconnu";
String firstname = "inconnu";
String id = "inconnu";
txtpnmessages.setContentType("text/plain");
boolean avertissement = false;
if(settingCSV.getAttributs().get("email")!=null) {
email = settingCSV.getAttributs().get("email");
}
if(settingCSV.getAttributs().get("name")!=null) {
name = settingCSV.getAttributs().get("name");
}
if(settingCSV.getAttributs().get("firstname")!=null) {
firstname = settingCSV.getAttributs().get("firstname");
}
if(settingCSV.getAttributs().get("id")!=null) {
id = settingCSV.getAttributs().get("id");
}
if(commandes.nodeCSV.getNodes().get(0).getAttributs().get(firstname)==null) {
txtpnmessages.setText("*** AVERTISSEMENT - Il n'y a pas le champ " + firstname + " dans le fichier CSV. ***");
avertissement=true;
}
if(commandes.nodeCSV.getNodes().get(0).getAttributs().get(name)==null) {
txtpnmessages.setText("*** AVERTISSEMENT - Il n'y a pas le champ " + name + " dans le fichier CSV. ***");
avertissement=true;
}
if(commandes.nodeCSV.getNodes().get(0).getAttributs().get(id)==null) {
txtpnmessages.setText("*** AVERTISSEMENT - Il n'y a pas le champ " + id + " dans le fichier CSV. ***");
avertissement=true;
}
if(commandes.nodeCSV.getNodes().get(0).getAttributs().get(email)==null) {
txtpnmessages.setText("*** AVERTISSEMENT - Il n'y a pas le champ " + email + " dans le fichier CSV. ***");
avertissement=true;
}
if(!avertissement) {
txtpnmessages.setText("*** Le fichier CSV contenant la liste des étudiants peut être utilisé avec les paramètres du fichier d'analyse ***");
}
}else {
txtpnmessages.setText("*** Le fichier CSV contenant la liste des étudiants est vide ***");
}
}else {
txtpnmessages.setText("*** Veuillez charger un fichier CSV contenant la liste des étudiants ***");
new msgBox("Le fichier CSV contenant la liste des étudiants n'est pas chargé.",true,false,"Avertissement");
}
}else {
txtpnmessages.setText("*** Veuillez charger un fichier d'analyse ***");
new msgBox("Le fichier d'analyse n'est pas valide.",true,false,"Avertissement");
}
}
};
/**
* Information sur le fichier d'analyse.</br>
*/
@ -956,13 +979,15 @@ public class evaluate extends JFrame {
@Override public void actionPerformed( ActionEvent e ) {
if(JOptionPane.showConfirmDialog(null,"Voulez-vous quitter analyseWriter?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
dispose();
}
dispose();
evaluate.isDispose=true;
}
}
};
/**
* Enregistre l'évaluation.</br>
* Enregistre la zone de texte.</br>
*/
private AbstractAction actSave = new AbstractAction() {
@ -981,7 +1006,7 @@ public class evaluate extends JFrame {
};
/**
* Enregistre sous l'évaluation.</br>
* Enregistre sous la zone de texte.</br>
*/
private AbstractAction actSaveas = new AbstractAction() {
@ -1004,7 +1029,8 @@ public class evaluate extends JFrame {
/**
*
*/
@SuppressWarnings("unused")
@SuppressWarnings("unused")
private AbstractAction actSavePreference = new AbstractAction() {
private static final long serialVersionUID = 1L;
@ -1034,6 +1060,7 @@ public class evaluate extends JFrame {
/**
* Affiche le code XMl du fichier d'analyse
*/
private AbstractAction actCodeFichierAnalyse = new AbstractAction() {
@ -1080,10 +1107,10 @@ public class evaluate extends JFrame {
@Override public void actionPerformed( ActionEvent e ) {
create.getInstance();
evaluate.getInstance().dispose();
evaluate.isDispose=true;
}
};
/**
* Charge la liste des étudiants sous la forme d'un fichier XML.
@ -1159,6 +1186,7 @@ public class evaluate extends JFrame {
/**
* Affiche le code XMl du fichier d'analyse
*/
private AbstractAction actAfficheListeEtudiant = new AbstractAction() {
@ -1185,6 +1213,8 @@ public class evaluate extends JFrame {
};
}