package fenetres; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.swing.JEditorPane; import MEPTL.commandes; import cXML.node; import calcul.calculIntervalleBaremeABCDE; import calcul.calculNotesProgression; import evaluer.evaluation; import list.descriptionNode; import list.listeAttributsAnalyseWriter; public class afficheText extends JEditorPane { /** * */ private static final long serialVersionUID = 1L; /** * Raffraichie l'affichage de la fenête create lorsque selection d'un node. * @param nod */ public void refreshAffichage(node nod) { if(nod!=null) { setContentType("text/html"); node nodeParent = nod.getParent(); String imageAllContent = ""; String imageTitre = ""; String imageSaut = ""; String imageaddmenu = ""; String imagerechercheIndex = ""; String imagerechercheContenuExact = ""; String imagereanalyseStyle = ""; String imagereEvaleNode = ""; String imagereRechercheAncragePage= ""; String imagereRecherchePlusProcheVoisin= ""; String imagerePremierAuteur= ""; String imagereDernierEditeur= ""; String imageAtraversAnalyseStyle= ""; String imageEntetePasActive= ""; String imagePiedPagePasActive= ""; String imageEvalNameSequence= ""; String imageEvalNamePage= ""; String imagePoids= ""; String imageEvalNumeroPage= ""; String imageEvalNumeroAbsoluePage= ""; String imageEvalTextUserDefined= ""; String imageEnteteActive= ""; String imagePiedPageActive= ""; StringBuilder sb = new StringBuilder(); sb.append(baliseStyle.balise()); descriptionNode textDescription = new descriptionNode(); if(nodeParent!=null) sb.append("

Parent = " + nodeParent.getNomElt() + "


"); sb.append("

Nom du node : " + nod.getNomElt() + "

" + textDescription.descriptionNode(nod.getNomElt())+"

"); //********************************************* //** sous titre pour identifier les éléments ** //********************************************* if(nod.getNomElt().equals("style:style")) { sb.append("

Nom du style : " + nod.getAttributs().get("style:name")+ "


"); } if(nod.getNomElt().equals("draw:frame")) { sb.append("

Nom du frame : " + evaluation.withoutCodeAndPointPourRechercheContenuExact(nod.getAttributs().get("draw:name"))+ "


"); } if(nod.getNomElt().equals("style:master-page")) { if(nod.getAttributs().get("style:display-name")!=null) { sb.append("

Nom du style de page : " + nod.getAttributs().get("style:display-name")+ "


"); }else { sb.append("

Nom du style de page : " + nod.getAttributs().get("style:name")+ "


"); } } if(nod.getNomElt().equals("page")) { sb.append("

Numero absolue de la page : " + evaluation.withoutCodeAndPointPourRechercheContenuExact(nod.getAttributs().get("numeroabsolue")) + " - Numerotation de la page : " + evaluation.withoutCodeAndPointPourRechercheContenuExact(nod.getAttributs().get("numero"))+ "


"); } //******************************************************** //** Le logo d'analyseWriter lorsque le node est évalué ** //******************************************************** if(nod.getAttributs().get("evaluer")!=null) if(nod.getAttributs().get("evaluer").equalsIgnoreCase("true")) { sb.append("

Ce node est évalué.

"); } if(nod.getAttributs().size()>0) { if(nod.getAttributs().size()==1) sb.append("

L'ATTRIBUT DU NODE

"); if(nod.getAttributs().size()>1) sb.append("

LES ATTRIBUTS DU NODE

"); } if(nod.getAttributs().size()<=0) { if(nod.getAttributs().size()==1) sb.append("

PAS D'ATTRIBUT DANS CE NODE

"); } Enumeration key = nod.getAttributs().keys(); List Lesattributsdunode = new ArrayList(); while(key.hasMoreElements()) { String K = key.nextElement(); Lesattributsdunode.add(K); } //permet le tri par ordre alphabétique des clés du dictionnaire Lesattributsdunode = Lesattributsdunode.stream().sorted().collect(Collectors.toList()); if(nod.getAttributs().get("evaluer")!=null) if(nod.getAttributs().get("evaluer").equalsIgnoreCase("true")) { sb.append("
"); sb.append("
    "); sb.append("
  • Les attributs d'analyseWriter
  • "); for(int i=0; i < Lesattributsdunode.size();i++) { if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(Lesattributsdunode.get(i))) { if(Lesattributsdunode.get(i).equals("allContent")) { Pattern p = Pattern.compile("[1-9]$|[0-9]{2,}$"); Matcher m = p.matcher(nod.getAttributs().get(Lesattributsdunode.get(i))); if(m.find()) { sb.append("
  • "+imageAllContent + " " + Lesattributsdunode.get(i) + "=\"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } } if(Lesattributsdunode.get(i).equals("titre")||Lesattributsdunode.get(i).equals("titre1")||Lesattributsdunode.get(i).equals("titre2")||Lesattributsdunode.get(i).equals("titre3")) { if(nod.getAttributs().get(Lesattributsdunode.get(i)).length()>0) { sb.append("
  • "+imageTitre + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } } if(Lesattributsdunode.get(i).equals("saut") && nod.getAttributs().get(Lesattributsdunode.get(i)).equals("true")) { sb.append("
  • "+imageSaut + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("addmenu") && nod.getAttributs().get(Lesattributsdunode.get(i)).equals("true")) { sb.append("
  • "+imageaddmenu + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("recherche_index") && nod.getAttributs().get(Lesattributsdunode.get(i)).equals("true")) { sb.append("
  • "+imagerechercheIndex + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("recherche_contenu_exact") && nod.getAttributs().get(Lesattributsdunode.get(i)).equals("true")) { sb.append("
  • "+imagerechercheContenuExact + " " + Lesattributsdunode.get(i) + "=\"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("analyseStyle") && nod.getAttributs().get(Lesattributsdunode.get(i)).equals("true")) { sb.append("
  • "+imagereanalyseStyle + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalNameNode") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imagereEvaleNode + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("recherche_anchor-page-number") && nod.getAttributs().get(Lesattributsdunode.get(i)).equals("true")) { sb.append("
  • "+imagereRechercheAncragePage + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("recherche_contenu_plus_proche_voisin") && nod.getAttributs().get(Lesattributsdunode.get(i)).equals("true")) { sb.append("
  • "+imagereRecherchePlusProcheVoisin + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalNameInitialCreator") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imagerePremierAuteur + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalNameCreator") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imagereDernierEditeur + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("EvaluerATraversAnalyseStyle") && nod.getAttributs().get(Lesattributsdunode.get(i)).equals("true")) { sb.append("
  • "+imageAtraversAnalyseStyle + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalEntetePasActive") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imageEntetePasActive + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalPiedPagePasActive") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imagePiedPagePasActive + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalNameSequence") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imageEvalNameSequence + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalNamePage") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imageEvalNamePage + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalNumeroPage") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imageEvalNumeroPage + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalNumeroAbsoluePage") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imageEvalNumeroAbsoluePage + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("poids") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imagePoids + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalTextUserDefined") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imageEvalTextUserDefined + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalEnteteActive") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imageEnteteActive + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } if(Lesattributsdunode.get(i).equals("evalPiedPageActive") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imagePiedPageActive + " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } // sb.append("
  • " + Lesattributsdunode.get(i) + "=\"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } } sb.append("
"); sb.append("
"); sb.append("
    "); sb.append("
  • Les attributs de Writer
  • "); for(int i=0; i < Lesattributsdunode.size();i++) { if(!listeAttributsAnalyseWriter.isAttributAnalyseWriter(Lesattributsdunode.get(i))) { sb.append("
  • " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } } sb.append("
"); } if(nod.getAttributs().get("evaluer")!=null) if(!nod.getAttributs().get("evaluer").equalsIgnoreCase("true")) { sb.append("
"); sb.append("
    "); sb.append("
  • Les attributs d'analyseWriter
  • "); for(int i=0; i < Lesattributsdunode.size();i++) { if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(Lesattributsdunode.get(i))) { sb.append("
  • " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } } sb.append("
"); sb.append("
"); sb.append("
    "); sb.append("
  • Les attributs de Writer
  • "); for(int i=0; i < Lesattributsdunode.size();i++) { if(!listeAttributsAnalyseWriter.isAttributAnalyseWriter(Lesattributsdunode.get(i))) { sb.append("
  • " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } } sb.append("
"); } if(nod.getAttributs().size()>0) { if(nod.getAttributs().get("evaluer")==null) { sb.append("
"); sb.append("
    "); sb.append("
  • Les attributs d'analyseWriter
  • "); for(int i=0; i < Lesattributsdunode.size();i++) { if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(Lesattributsdunode.get(i))) { sb.append("
  • " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } } sb.append("
"); sb.append("
"); sb.append("
    "); sb.append("
  • Les attributs de Writer
  • "); for(int i=0; i < Lesattributsdunode.size();i++) { if(!listeAttributsAnalyseWriter.isAttributAnalyseWriter(Lesattributsdunode.get(i))) { sb.append("
  • " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } } sb.append("
"); } } if(!nod.getNomElt().equals("fichier")&&!nod.getNomElt().equals("setting")&&!nod.getNomElt().equals("structurepage")) { if(!nod.retourneLesContenusEnfants("").isEmpty()) { sb.append("

Contenu


" + nod.retourneLesContenusEnfants("") ); } } setText(""+sb.toString()+""); } if(nod==null) { setText(""); } } /** * Affiche le nombre de point d'un node. * @param nod * @param pointTotalNode */ public void AfficheTotalPoint(node nod, int pointTotalNode) { setContentType("text/html"); node nodeParent = nod.getParent(); StringBuilder sb = new StringBuilder(); sb.append(baliseStyle.balise()); if(nodeParent!=null) { sb.append("

Parent = " + nodeParent.getNomElt() + "


"); } sb.append("

Total des points dans le node : " + nod.getNomElt() + "



"); sb.append("

Uniquement les nodes évalués

"); sb.append("

TOTAL POINT = " + String.valueOf(pointTotalNode) + "

"); setText(""+sb.toString()+""); } /** * Affiche le nombre de point et la réppartition dans les node principaux. * @param liste */ public void afficheListeDesPointsDansToutExercice(ArrayList liste) { StringBuilder text = new StringBuilder(); NumberFormat f = new DecimalFormat("##.00"); text.append(baliseStyle.balise()); text.append("

INFORMATIONS



"); Double NbrPointDansExercice = 0.0; for(int i = 0 ; i < liste.size(); i++) { String[] A = liste.get(i).split(" "); double NbrPointApresPonderation = 0.0; int NbrPointBrut = 0; NbrPointBrut = Integer.valueOf(A[1]); NbrPointApresPonderation = NbrPointBrut*Double.valueOf(A[2]); NbrPointDansExercice = NbrPointDansExercice + NbrPointApresPonderation; if(NbrPointBrut>0) { text.append("

Dans le node "+ A[0] + ".
" + "Le nombre de point brut est de " + A[1] + "
" + "Le poids est de " + A[2]+ " soit un total de " + f.format(NbrPointApresPonderation) + "



"); } } text.append("
"); text.append("

Le nombre de point total dans l'exercice est de : " + f.format(NbrPointDansExercice) + "

"); setContentType("text/html"); setText(""+text.toString()+""); } /** * Affiche le chargement du fichier d'analyse */ public void afficheChargementFichierAnalyse(){ System.out.println( "Affichage information du fichier d'analyse" ); String v = commandes.analyse_version; if(v.isEmpty()) v = commandes.version; StringBuilder text = new StringBuilder(); text.append(baliseStyle.balise()); text.append("

INFORMATIONS

Fichier d'analyse créé avec la version : " + v+ "



"); text.append("

Le titre de l'exercice est : " + commandes.analyse_titre+"

"); text.append("

Le sujet (metaSujet) est : " + commandes.analyse_metaSujet+"

"); text.append("

L'auteur de l'exercice est : " + commandes.analyse_auteur+"

"); if(commandes.analyse_baremeABC==true) { text.append("

La notation est sous la forme d'une note alphabétique ABCDE.

"); text.append("

La progression est de " + String.valueOf(commandes.analyse_progression)+ "

"); calcul.calculIntervalleBaremeABCDE C = new calculIntervalleBaremeABCDE(commandes.analyse_progression); text.append("

" + C.getMessageLigne() + "

"); }else { text.append("

La notation est sous la forme d'une note numérique.

"); text.append("

Le barème est sur " + String.valueOf(commandes.analyse_notefrom)+ "

"); text.append("

La progression est de " + String.valueOf(commandes.analyse_progression) + "

"); calculNotesProgression C = new calculNotesProgression(commandes.analyse_progression, commandes.analyse_notefrom); text.append("

" + C.getMessageLigne() + "

"); } text.append("
"); text.append("

Le nom du fichier : " + commandes.analysis_filename + "

"); text.append("

Le hash de l'évaluation est : " + commandes.hash + "

"); text.append("
"); text.append("

Historiques des modifications present : " + commandes.analyse_historiquePresent + "

"); text.append("
"); text.append("

Verification de la presence metaSujet : " + commandes.analyse_presenceMetaSujet + "

"); text.append("
"); text.append("

Contrôle la date de céation : " + commandes.analyse_controleDateCreation+ "

"); text.append("
"); text.append("

Contrôle l'auteur initial du fichier : " + commandes.analyse_controle_Initial_Creator + "

"); text.append("
"); text.append("

Dossier de l'analyse contenant les fichiers des étudiants :

"); text.append("

"+commandes.path+"

"); text.append("
"); text.append("

Fichier d'analyse :

"); text.append("

"+commandes.PathFilenameAnalysis+"

"); setContentType("text/html"); setText(text.toString()); } }