diff --git a/.classpath b/.classpath index 4b5675b..148593c 100644 --- a/.classpath +++ b/.classpath @@ -12,6 +12,6 @@ - + diff --git a/analyseWriter.exe b/analyseWriter.exe index c54e4ef..abf3e94 100644 Binary files a/analyseWriter.exe and b/analyseWriter.exe differ diff --git a/analyseWriter.jar b/analyseWriter.jar index 622a51f..3beadc8 100644 Binary files a/analyseWriter.jar and b/analyseWriter.jar differ diff --git a/bin/.gitignore b/bin/.gitignore index eebe85a..0952eba 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -128,3 +128,4 @@ /sautpageColonne.svg /sautpagecolonne.png /sautpagecolonnemini.png +/resources/ diff --git a/bin/calcul/calculNombrePointEvaluation.class b/bin/calcul/calculNombrePointEvaluation.class index 8c5a47e..77d8744 100644 Binary files a/bin/calcul/calculNombrePointEvaluation.class and b/bin/calcul/calculNombrePointEvaluation.class differ diff --git a/bin/evaluer/evaluationAttribut.class b/bin/evaluer/evaluationAttribut.class index fc46f01..a8e7be4 100644 Binary files a/bin/evaluer/evaluationAttribut.class and b/bin/evaluer/evaluationAttribut.class differ diff --git a/bin/fenetres/afficheText.class b/bin/fenetres/afficheText.class index 1f3ff73..c15b110 100644 Binary files a/bin/fenetres/afficheText.class and b/bin/fenetres/afficheText.class differ diff --git a/bin/fenetres/createPopupMenu.class b/bin/fenetres/createPopupMenu.class index 5f85297..dbab855 100644 Binary files a/bin/fenetres/createPopupMenu.class and b/bin/fenetres/createPopupMenu.class differ diff --git a/bin/list/listeAttributsAnalyseWriter.class b/bin/list/listeAttributsAnalyseWriter.class index 4006c62..2dd6343 100644 Binary files a/bin/list/listeAttributsAnalyseWriter.class and b/bin/list/listeAttributsAnalyseWriter.class differ diff --git a/icons/evalpasparagraphevide.png b/icons/evalpasparagraphevide.png new file mode 100644 index 0000000..5fe4d45 Binary files /dev/null and b/icons/evalpasparagraphevide.png differ diff --git a/icons/evalpasparagraphevide.svg b/icons/evalpasparagraphevide.svg new file mode 100644 index 0000000..3cd0a5c --- /dev/null +++ b/icons/evalpasparagraphevide.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + diff --git a/icons/evalpasparagraphevidemini.png b/icons/evalpasparagraphevidemini.png new file mode 100644 index 0000000..601a35e Binary files /dev/null and b/icons/evalpasparagraphevidemini.png differ diff --git a/src/calcul/calculNombrePointEvaluation.java b/src/calcul/calculNombrePointEvaluation.java index f4ed96f..4287be0 100644 --- a/src/calcul/calculNombrePointEvaluation.java +++ b/src/calcul/calculNombrePointEvaluation.java @@ -166,6 +166,14 @@ public class calculNombrePointEvaluation { } } + if(nod.getAttributs().get("evalPasParagrapheVide")!=null) { + try { + point = point + Integer.valueOf(nod.getAttributs().get("evalPasParagrapheVide")); + } catch (Exception e) { + JOptionPane.showInternalMessageDialog(null, "Erreur dans la valeur de l'attribut evalPasParagrapheVide"); + } + } + //*********************************************** //** Les points par la méthode analyseStyle ***** //*********************************************** diff --git a/src/evaluer/evaluationAttribut.java b/src/evaluer/evaluationAttribut.java index c1f6f17..6a7c057 100644 --- a/src/evaluer/evaluationAttribut.java +++ b/src/evaluer/evaluationAttribut.java @@ -1,5 +1,6 @@ package evaluer; +import java.util.ArrayList; import java.util.Enumeration; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -9,6 +10,7 @@ import cXML.node; import list.listeDesNodesAncrable; import list.listeDesNodesEvalPlacement; import list.listeDesNodesFormatageDirect; +import list.listeDesNodesPourEvaluerPage; public class evaluationAttribut { @@ -340,7 +342,10 @@ public class evaluationAttribut { retour = evalSautPageColonne(sujet,nodeStudent,retour,nameElt); } - + //evaluation de l'absence de paragraphe vide dans la page + if(k.equals("evalPasParagrapheVide") && listeDesNodesPourEvaluerPage.isPage(sujet)) { + retour = evalPasParagrapheVide(sujet,nodeStudent,retour,nameElt); + } } } @@ -729,7 +734,92 @@ public class evaluationAttribut { return retour; } - + /** + * Méthode evalPasParagrapheVide.
+ * Evaluer l'absence de paragraphe vide dans la page.
+ * @param sujet + * @param nodeStudent + * @param retour + * @param nameElt + * @return + */ + private static node evalPasParagrapheVide(node sujet,node nodeStudent, node retour, String nameElt) { + if(nodeStudent!=null) { + boolean pasParagrapheVideSujet = true; + boolean pasParagrapheVideStudent = true; + + ArrayList LesParagraphes = nodeStudent.retourneEnfantsByName("text:p", new ArrayList()); + LesParagraphes = nodeStudent.retourneEnfantsByName("text:h", LesParagraphes); + LesParagraphes = nodeStudent.retourneEnfantsByName("text:list", LesParagraphes); + LesParagraphes = nodeStudent.retourneEnfantsByName("text:list-item", LesParagraphes); + for(int i = 0 ; i < LesParagraphes.size();i++) { + if(pasParagrapheVideStudent) { + String Texte = LesParagraphes.get(i).retourneLesContenusEnfants(""); + Texte = Texte.replace(" ", ""); + Texte = Texte.replace("[tab]", ""); + Texte = Texte.replace("[text:line-break]", ""); + Texte = Texte.replace("[text:s]", ""); + if(Texte.isEmpty()) pasParagrapheVideStudent=false; + } + } + + LesParagraphes = sujet.retourneEnfantsByName("text:p", new ArrayList()); + LesParagraphes = sujet.retourneEnfantsByName("text:h", LesParagraphes); + LesParagraphes = sujet.retourneEnfantsByName("text:list", LesParagraphes); + LesParagraphes = sujet.retourneEnfantsByName("text:list-item", LesParagraphes); + for(int i = 0 ; i < LesParagraphes.size();i++) { + if(pasParagrapheVideSujet) { + String Texte = LesParagraphes.get(i).retourneLesContenusEnfants(""); + Texte = Texte.replace(" ", ""); + Texte = Texte.replace("[tab]", ""); + Texte = Texte.replace("[text:line-break]", ""); + Texte = Texte.replace("[text:s]", ""); + if(Texte.isEmpty()) pasParagrapheVideSujet=false; + } + } + + String reponsepasVide= "Il n'y a pas de paragraphe vide dans la page."; + String reponseVide= "Il y a au moins un paragraphe vide dans la page."; + + String reponseStudent = ""; + String reponseSujet = ""; + if(pasParagrapheVideStudent) reponseStudent = reponsepasVide; else reponseStudent = reponseVide; + if(pasParagrapheVideSujet) reponseSujet = reponsepasVide; else reponseSujet = reponseVide; + + + retour = evaluationPasParagrapheVide(retour,reponseStudent, reponseSujet, sujet.getAttributs().get("evalPasParagrapheVide"),"Absence paragraphe vide"); + + }else { + + boolean pasParagrapheVideSujet = true; + + ArrayList LesParagraphes = sujet.retourneEnfantsByName("text:p", new ArrayList()); + LesParagraphes = sujet.retourneEnfantsByName("text:h", LesParagraphes); + LesParagraphes = sujet.retourneEnfantsByName("text:list", LesParagraphes); + LesParagraphes = sujet.retourneEnfantsByName("text:list-item", LesParagraphes); + for(int i = 0 ; i < LesParagraphes.size();i++) { + if(pasParagrapheVideSujet) { + String Texte = LesParagraphes.get(i).retourneLesContenusEnfants(""); + Texte = Texte.replace(" ", ""); + Texte = Texte.replace("[tab]", ""); + Texte = Texte.replace("[text:line-break]", ""); + Texte = Texte.replace("[text:s]", ""); + if(Texte.isEmpty()) pasParagrapheVideSujet=false; + } + } + + String reponsepasVide= "Il n'y a pas de paragraphe vide dans la page."; + String reponseVide= "Il y a au moins un paragraphe vide dans la page."; + + String reponseSujet = ""; + if(pasParagrapheVideSujet) reponseSujet = reponsepasVide; else reponseSujet = reponseVide; + + + retour = evaluationPasParagrapheVide(retour,null, reponseSujet, sujet.getAttributs().get("evalPasParagrapheVide"),"Absence paragraphe vide"); + + } + return retour; + } //*********************************************************************************** @@ -1090,6 +1180,27 @@ public class evaluationAttribut { return retour; } + /** + * + * @param retour + * @param sautStudent + * @param sautSujet + * @param point + * @param nameElt + * @return + */ + private static node evaluationPasParagrapheVide(node retour, String reponseStudent, String reponseSujet, String point, String nameElt) { + node item = null; + if(reponseStudent!=null) { + //compare la même valeur "contenuParagraph" pour obtenir les points mais si un voisinage du contenu. + item = retourneNoteAvecResultatsAnalyse("Absence","", reponseStudent , reponseSujet + "‽" +point, nameElt ); + }else { + evaluation.IncrementPointTotal(Integer.valueOf(point)); + item = new node("Absence", "Erreur : -"+ point, "" , "null", reponseSujet , 2, evaluation.getPointEnJeu(),nameElt); + } + retour.getNodes().add(item); + return retour; + } /** diff --git a/src/fenetres/afficheText.java b/src/fenetres/afficheText.java index 9d66052..88f17ef 100644 --- a/src/fenetres/afficheText.java +++ b/src/fenetres/afficheText.java @@ -77,6 +77,7 @@ public class afficheText extends JEditorPane { String imageEvalAncrageNumeroAbsoluPage= ""; String imageEvalFormatageDirect= ""; String imageEvalSautPageColonne= ""; + String imageEvalPasParagrapheVide= ""; StringBuilder sb = new StringBuilder(); @@ -255,6 +256,9 @@ public class afficheText extends JEditorPane { if(Lesattributsdunode.get(i).equals("evalSautPageColonne") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { sb.append("
  • "+imageEvalSautPageColonne+ " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } + if(Lesattributsdunode.get(i).equals("evalPasParagrapheVide") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) { + sb.append("
  • "+imageEvalPasParagrapheVide+ " " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); + } // sb.append("
  • " + Lesattributsdunode.get(i) + "=\"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"
  • "); } diff --git a/src/fenetres/createPopupMenu.java b/src/fenetres/createPopupMenu.java index 68bd6ad..4ba8ca5 100644 --- a/src/fenetres/createPopupMenu.java +++ b/src/fenetres/createPopupMenu.java @@ -39,6 +39,8 @@ import fenetres.create_act.actEvalNumeroAbsoluePageNon; import fenetres.create_act.actEvalNumeroAbsoluePageOui; import fenetres.create_act.actEvalNumeroPageNon; import fenetres.create_act.actEvalNumeroPageOui; +import fenetres.create_act.actEvalPasParagrapheVideNon; +import fenetres.create_act.actEvalPasParagrapheVideOui; import fenetres.create_act.actEvalPiedPageActive; import fenetres.create_act.actEvalPiedPageActiveNon; import fenetres.create_act.actEvalPiedPagePasActive; @@ -207,7 +209,7 @@ public class createPopupMenu extends JPopupMenu { } /** - * Evauler l'absence ou la présence du formatage direct.
    + * Evaluer l'absence ou la présence du formatage direct.
    * Uniquement présent sur les paragraphes ou les titres.
    * @return */ @@ -219,6 +221,19 @@ public class createPopupMenu extends JPopupMenu { return mnEvalFormatageDirect; } + /** + * Evaluer l'absence de paragraphe vide dans les pages.
    + * Uniquement présent sur les nodes page.
    + * @return + */ + private JMenu mnEvalPasParagrapheVide() { + JMenu mnEvalPasParagrapheVide = new JMenu("Evaluer l'absence de paragraphe vide dans la page"); + mnEvalPasParagrapheVide.setIcon( new ImageIcon(create.class.getResource("/resources/evalpasparagraphevidemini.png"))); + mnEvalPasParagrapheVide.add(new actEvalPasParagrapheVideOui()); + mnEvalPasParagrapheVide.add(new actEvalPasParagrapheVideNon()); + return mnEvalPasParagrapheVide; + } + /** * Menu Arbre.
    * @return @@ -791,6 +806,8 @@ public class createPopupMenu extends JPopupMenu { } if(listeDesNodesPourEvaluerPage.isPage(nod)) { + mnGroupeMethodeEvaluer.addSeparator(); + mnGroupeMethodeEvaluer.add(mnEvalPasParagrapheVide()); mnGroupeMethodeEvaluer.addSeparator(); mnGroupeMethodeEvaluer.add(mnEvalNamePage()); mnGroupeMethodeEvaluer.addSeparator(); diff --git a/src/fenetres/create_act/actEvalPasParagrapheVideNon.java b/src/fenetres/create_act/actEvalPasParagrapheVideNon.java new file mode 100644 index 0000000..5628cc9 --- /dev/null +++ b/src/fenetres/create_act/actEvalPasParagrapheVideNon.java @@ -0,0 +1,30 @@ +package fenetres.create_act; + +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ImageIcon; + +import cXML.node; +import fenetres.create; + +public class actEvalPasParagrapheVideNon extends AbstractAction{ + { + putValue( Action.NAME, "Supprime évaluer l'absence de paragraphe vide" ); + putValue( Action.SHORT_DESCRIPTION, "Supprime l'évaluation de l'absence de paragraphe vide." ); + putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/falsemini.png")) ); + } + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(ActionEvent e) { + node nod = (node) fenetres.create.getSelectNode().getUserObject(); + nod.supprimeAttribut("evalPasParagrapheVide"); + fenetres.create.getTextNodeSelect().refreshAffichage(nod); + } + +} diff --git a/src/fenetres/create_act/actEvalPasParagrapheVideOui.java b/src/fenetres/create_act/actEvalPasParagrapheVideOui.java new file mode 100644 index 0000000..147f5ea --- /dev/null +++ b/src/fenetres/create_act/actEvalPasParagrapheVideOui.java @@ -0,0 +1,54 @@ +package fenetres.create_act; + +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ImageIcon; +import javax.swing.JOptionPane; + +import cXML.node; +import fenetres.baliseStyle; +import fenetres.create; + +public class actEvalPasParagrapheVideOui extends AbstractAction{ + { + putValue( Action.NAME, "Oui, combien de point?" ); + putValue( Action.SHORT_DESCRIPTION, "Evaluer l'absence de paragraphe vide" ); + putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/truemini.png")) ); + } + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(ActionEvent e) { + node nod = (node) fenetres.create.getSelectNode().getUserObject(); + int point = 0; + if(nod.getAttributs().get("evalPasParagrapheVide")!=null) { + point = Integer.valueOf(nod.getAttributs().get("evalPasParagrapheVide")); + } + + String a = JOptionPane.showInputDialog(null,"Quel est le nombre de point?",point); + + if(!a.isEmpty()) { + try { + point = Integer.valueOf(a); + if(point<=0) { + nod.getAttributs().put("evalPasParagrapheVide", String.valueOf(0)); + fenetres.create.getTextNodeSelect().setText(baliseStyle.balise()); + fenetres.create.getTextNodeSelect().setText("

    Erreur la valeur doit être un nombre entier POSITIF supérieur à zéro.
    Cependant,la valeur a été modifiée.
    evalPasParagrapheVide=0.

    "); + }else { + nod.getAttributs().put("evalPasParagrapheVide", String.valueOf(point)); + } + } catch (Exception e2) { + fenetres.create.getTextNodeSelect().setText(baliseStyle.balise()); + fenetres.create.getTextNodeSelect().setText("

    Erreur la valeur doit être un nombre entier.
    L'attribut n'a pas été modifiée.

    "); + } + } + fenetres.create.getTextNodeSelect().refreshAffichage(nod); + + } + +} diff --git a/src/list/listeAttributsAnalyseWriter.java b/src/list/listeAttributsAnalyseWriter.java index 7ed3233..2600109 100644 --- a/src/list/listeAttributsAnalyseWriter.java +++ b/src/list/listeAttributsAnalyseWriter.java @@ -55,6 +55,7 @@ public class listeAttributsAnalyseWriter { case "evalAncrageNumeroAbsoluePage": return true; case "evalFormatageDirect": return true; case "evalSautPageColonne": return true; + case "evalPasParagrapheVide": return true; case "analysis_filename": return true; case "auteur": return true; diff --git a/src/resources/evalpasparagraphevide.png b/src/resources/evalpasparagraphevide.png new file mode 100644 index 0000000..5fe4d45 Binary files /dev/null and b/src/resources/evalpasparagraphevide.png differ diff --git a/src/resources/evalpasparagraphevidemini.png b/src/resources/evalpasparagraphevidemini.png new file mode 100644 index 0000000..601a35e Binary files /dev/null and b/src/resources/evalpasparagraphevidemini.png differ