MAJ V4.4.0 (bascule d'une partie des message d'erreur dans le textField)

This commit is contained in:
pablo rodriguez 2022-12-14 17:24:36 +01:00
parent 4543dcb243
commit cb570af758
15 changed files with 86 additions and 32 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.

View File

@ -17,6 +17,8 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.regex.Pattern;
import javax.swing.JEditorPane;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import cXML.node;
@ -52,8 +54,7 @@ public class meptl {
* @throws InterruptedException
*/
public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, CloneNotSupportedException, InterruptedException {
System.getProperty("file.encoding","UTF-8");
System.getProperty("file.encoding","UTF-8");
commandes.path = System.getProperty("user.dir");
// patch = "C:/Users/pabr6/OneDrive/Desktop/Nouveau dossier";
@ -244,11 +245,12 @@ public class meptl {
//**********************************
//** Analyse des fichiers student **
//**********************************
JEditorPane txt = new JEditorPane();
if(commandes.analyse||commandes.ecritNodeAnalyse) {
if(!verificationFichierAnalyse.erreur) {
// Run.ecritureNodeEnXML(nodStudent, "fichier student","",false,""); //écriture du node nodStudent de l'étudiant
node ana = analyseFichier.analyse(nodStudent, commandes.sujet, i, a);
node ana = analyseFichier.analyse(nodStudent, commandes.sujet, i, a,txt,"0");
//**************************************************
//** Ecriture des fichiers d'analyse des students **
@ -1461,7 +1463,7 @@ public class meptl {
* @throws SAXException
* @throws CloneNotSupportedException
*/
public static void analyseVerifieHistoriqueLesFichiersEtudiantsEtExportNoteCSV() throws IOException, ParserConfigurationException, SAXException, CloneNotSupportedException {
public static void analyseVerifieHistoriqueLesFichiersEtudiantsEtExportNoteCSV(JEditorPane txt) throws IOException, ParserConfigurationException, SAXException, CloneNotSupportedException {
commandes.message = new StringBuilder();
commandes.message.append("\n *** LES FICHIERS ANALYSES & EVALUES ***\n");
@ -1548,9 +1550,8 @@ public class meptl {
//** Analyse des fichiers student **
//**********************************
if(commandes.analyse||commandes.ecritNodeAnalyse) {
// Run.ecritureNodeEnXML(nodStudent, "fichier student","",false,""); //écriture du node nodStudent de l'étudiant
node ana = analyseFichier.analyse(nodStudent, commandes.sujet, i, a);
node ana = analyseFichier.analyse(nodStudent, commandes.sujet, i, a, txt, String.valueOf(nbFichierWriter));
//**************************************************
//** Ecriture des fichiers d'analyse des students **

View File

@ -2,6 +2,9 @@ package evaluer;
import java.text.DecimalFormat;
import javax.swing.JEditorPane;
import MEPTL.commandes;
import MEPTL.meptl;
import cXML.Run;
import cXML.node;
@ -16,7 +19,7 @@ public class analyseFichier {
* @param a, objet Run de la class cXML
* @return retourne le node "ana" analyse contenant toute l'analyse.
*/
public static node analyse(node nodStudent, node nodSujet, Integer indexStudent, Run a) {
public static node analyse(node nodStudent, node nodSujet, Integer indexStudent, Run a,JEditorPane txt, String texteAfficher) {
// initialisation des nodes d'analyse
node erreurs = new node();
@ -52,6 +55,14 @@ public class analyseFichier {
if(nodSujet.getAttributs().get("baremeABC")!=null) nodouverture.getAttributs().put("baremeABC", nodSujet.getAttributs().get("baremeABC"));
nodouverture.setClose(true);
texteAfficher = texteAfficher + "\n" + nodouverture.getAttributs().get("dossier");
txt.setText(texteAfficher);
// txt.setText("\nEvaluation du fichier n° " + String.valueOf(indexStudent) +"/ " + nbFichierWriter + " fichier(s)"+
// "\n" + nodouverture.getAttributs().get("dossier"));
//Body et note (par défaut valeur nulle)
node nodbodyetnotation = new node();
nodbodyetnotation.setNomElt("bodyetnotation");
@ -206,7 +217,7 @@ public class analyseFichier {
}else {
return clotureNodeAnalyse(nodouverture, nodbodyetnotation, nodmenu, erreurs, nodmeta, nodpage, nodparagraph, nodsequence, nodnumerochapitre, nodframes, nodsections, nodtableaux, nodbiblio, nodtablematieres, nodtableillustrations, nodstructurepage,"");
}
}
@ -246,6 +257,8 @@ public class analyseFichier {
try {
notefrom = Math.abs(Double.valueOf(nodouverture.getAttributs().get("notefrom")));
}catch (Exception e) {
commandes.message.append("<p>** La variable notefrom ne peut être convertie en double. **</p>");
commandes.message.append("<p>La valeur de notefrom est alors automatique de 20.</p>");
System.out.println("The \"noteFrom\" attribute of the analyze file cannot be converted to a \"double\".");
System.out.println("Value of notefrom = 20.");
}
@ -254,6 +267,8 @@ public class analyseFichier {
try {
progression = Math.abs(Double.valueOf(nodouverture.getAttributs().get("progression")));
}catch (Exception e) {
commandes.message.append("<p>** La variable progression ne peut être convertie en double. **</p>");
commandes.message.append("<p>La valeur du coef. de progression est alors automatique de 1.</p>");
System.out.println("The \"progression\" attribute of the analyze file cannot be converted to \"double\".");
System.out.println("Value of progression = 1.");
}
@ -262,6 +277,8 @@ public class analyseFichier {
try {
baremeABC = Boolean.valueOf(nodouverture.getAttributs().get("baremeABC"));
}catch (Exception e) {
commandes.message.append("<p>** La variable baremeABC ne peut être convertie en boolean. **</p>");
commandes.message.append("<p>La valeur de baremeABC est alors automatique de false.</p>");
System.out.println("The \"baremeABC\" attribute of the analyze file cannot be converted to \"boolean\".");
System.out.println("Value of baremeABC = false.");
}

View File

@ -197,7 +197,7 @@ public class evaluation {
// couleur simple pas de bordure ou pas d'autres fonctions
if(Sujet.contains("#") && !Sujet.contains("pt") && Sujet.contains(" ") && !Sujet.contains("¦") && !Sujet.contains("") && !Sujet.contains("") && !Sujet.contains("¢") ) {
if(Sujet.contains("#") && !Sujet.contains("pt") && !Sujet.contains(" ") && !Sujet.contains("¦") && !Sujet.contains("") && !Sujet.contains("") && !Sujet.contains("¢") ) {
if(TraitementCouleur(Sujet,A).equals("Correct : ")) {
IncrementPointClass(pointEnJeu);
return "Correct : +" + pointString;
@ -313,6 +313,7 @@ public class evaluation {
try {
point = Integer.valueOf(B.substring(B.indexOf("")+1,B.length()));
}catch (Exception e) {
commandes.message.append("<p>** ERREUR sur la ventillation des points : " + B + " **</p>");
System.out.println("ERREUR sur la ventillation des points : " +B);
e.getMessage();
}
@ -342,16 +343,30 @@ public class evaluation {
String Text[] = B.split("");
if(Text.length<2) {
commandes.message.append("<p>** ERREUR sur l'intervalle : " + B + " **</p>");
System.out.println("** ERREUR de l'intervalle "+ B + " **");
}
// rechercher un digite une ou plusieur fois en fin.
Pattern p = Pattern.compile("[^0-9\\.]");
// remplacement de toutes les occurrences par ""
Text[0]= p.matcher(Text[0]).replaceAll("");
Text[1] = p.matcher(Text[1]).replaceAll("");
if(Text[0]!=null) Text[0]= p.matcher(Text[0]).replaceAll("");
if(Text[1]!=null) Text[1] = p.matcher(Text[1]).replaceAll("");
A = p.matcher(A).replaceAll("");
double b0 = Double.valueOf(Text[0]);
double b1 = Double.valueOf(Text[1]);
double b0=0.0;
double b1=0.0;
try{
b0 = Double.valueOf(Text[0]);
b1 = Double.valueOf(Text[1]);
}catch (Exception e) {
commandes.message.append("<p>** ERREUR de conversion en double de : " + String.valueOf(Text[0]) + " ou " + String.valueOf(Text[1]) +" **</p>");
System.out.println(e.toString());
}
if(A.isEmpty()) return "Erreur : ";
double v = Double.valueOf(A);
@ -372,12 +387,19 @@ public class evaluation {
// rechercher un digite une ou plusieur fois en fin.
Pattern p = Pattern.compile("[^0-9\\.]");
if(Text.length<2) {
commandes.message.append("<p>** ERREUR sur l'intervalle : " + Intervale + " **</p>");
System.out.println("** ERREUR de l'intervalle "+ Intervale + " **");
}
// remplacement de toutes les occurrences par ""
Text[0]= p.matcher(Text[0]).replaceAll("");
double b0 = Double.valueOf(Text[0]);
if(Text[0]!=null) Text[0]= p.matcher(Text[0]).replaceAll("");
double b0=0.0;
try {
b0 = Double.valueOf(Text[0]);
}catch (Exception e) {
commandes.message.append("<p>** ERREUR de conversion en double de : " + String.valueOf(Text[0]) + " **</p>");
System.out.println(e.toString());
}
return b0;
}
@ -387,17 +409,24 @@ public class evaluation {
* @return
*/
public static double TraitementIntervaleRetourneValeurMaximale(String Intervale) {
String Text[] = Intervale.split("");
String Text[] = Intervale.split("");
// rechercher un digite une ou plusieur fois en fin.
Pattern p = Pattern.compile("[^0-9\\.]");
if(Text.length<2) {
commandes.message.append("<p>** ERREUR sur l'intervalle : " + Intervale + " **</p>");
System.out.println("** ERREUR de l'intervalle "+ Intervale + " **");
}
// remplacement de toutes les occurrences par ""
Text[0]= p.matcher(Text[0]).replaceAll("");
Text[1] = p.matcher(Text[1]).replaceAll("");
double b1 = Double.valueOf(Text[1]);
if(Text[0]!=null)Text[0]= p.matcher(Text[0]).replaceAll("");
if(Text[1]!=null) Text[1]= p.matcher(Text[1]).replaceAll("");
double b1 = 0.0;
try {
b1 = Double.valueOf(Text[1]);
}catch (Exception e) {
commandes.message.append("<p>** ERREUR de conversion en double de : " + String.valueOf(Text[1]) + " **</p>");
System.out.println(e.toString());
}
return b1;
}
@ -434,7 +463,6 @@ public class evaluation {
if((tailleA<tailleB+IT) && (tailleA>tailleB-IT))taille = true;
}
// traitement du type de trait
String typeA = TextA[1];
String typeB = TextB[1];
@ -493,6 +521,14 @@ public class evaluation {
if(B==null) return "Erreur : ";
if(B.isEmpty()) return "Erreur : ";
Pattern p = Pattern.compile("#.{6}");
Matcher m = p.matcher(Sujet.trim());
if(!m.find()) {
commandes.message.append("<p>** ERREUR la couleur du sujet n'est pas correct " + Sujet + " **</p>");
commandes.message.append("<p>** La couleur sera automatiquement mis à noir #000000**</p>");
Sujet="000000";
}
// traitement de la couleur du trait
String couleurS = Sujet.replace("#", "");
String couleurB = B.replace("#", "");

View File

@ -526,8 +526,6 @@ public final class create extends JFrame {
System.out.println( "Redo" );
}
};
/**
*

View File

@ -753,7 +753,7 @@ public class evaluate extends JFrame {
try {
msgBox V = new msgBox("Je travaille dure.",false,false,"Attendez");
Thread.sleep(100);
meptl.analyseVerifieHistoriqueLesFichiersEtudiantsEtExportNoteCSV();
meptl.analyseVerifieHistoriqueLesFichiersEtudiantsEtExportNoteCSV(fenetres.evaluate.getTxtpnmessages());
txtpnmessages.setContentType("text/plain");
txtpnmessages.setText(commandes.message.toString());
V.close();

View File

@ -81,9 +81,10 @@ public class evaluerLesFichiersEtudiants implements Runnable{
//** Nombre de fichier writer à analyser **
//*****************************************
int nbFichierWriter = a.getLectDossiers().getEC().getListeContentWriter().size();
String NbFichiers = String.valueOf(nbFichierWriter);
commandes.analyse_Nbre_Fichier_Student = nbFichierWriter;
commandes.message.append("<br>");
commandes.message.append("<p>Nombre de fichier à analyser et évaluer : " + Integer.valueOf(nbFichierWriter) + "</p>");
commandes.message.append("<p>Nombre de fichier à analyser et évaluer : " + NbFichiers + "</p>");
commandes.message.append("<br>");
commandes.message.append("<hr>");
@ -133,7 +134,8 @@ public class evaluerLesFichiersEtudiants implements Runnable{
//** Parcours l'ensemble des fichiers des étudiants ***
//*****************************************************
for(int i = 0 ; i < nbFichierWriter ; i++) {
txt.setText("\nEvaluation du fichier n° " + String.valueOf(i+1) +"/"+ String.valueOf(nbFichierWriter) + " fichier(s)");
String texteAfficher = "\nEvaluation du fichier n° " + String.valueOf(i+1) + "/" + String.valueOf(nbFichierWriter) + " fichier(s)";
txt.setText(texteAfficher);
//index de l'étudiant
commandes.analyse_index_Fichier_Student = i;
@ -171,7 +173,7 @@ public class evaluerLesFichiersEtudiants implements Runnable{
if(commandes.analyse||commandes.ecritNodeAnalyse) {
// Run.ecritureNodeEnXML(nodStudent, "fichier student","",false,""); //écriture du node nodStudent de l'étudiant
node ana = analyseFichier.analyse(nodStudent, commandes.sujet, i, a);
node ana = analyseFichier.analyse(nodStudent, commandes.sujet, i, a, txt,texteAfficher);
// try {
// Run.ecritureNodeEnXML(ana, "analyse", commandes.path, "");
// } catch (IOException e1) {