MAJ V4.4.2 - ajout de la méthode evalPasParagrapheVide.

Cette méthode permet d'évaluer l'absence de paragraphe vide dans une
page.
This commit is contained in:
pablo rodriguez 2022-12-26 10:30:23 +01:00
parent bc8411ee0e
commit 6bccbd6014
21 changed files with 298 additions and 4 deletions

View File

@ -12,6 +12,6 @@
<classpathentry kind="lib" path="C:/Users/pabr6/git/analyseWriter/MEPTL/miglayout15-swing.jar"/>
<classpathentry kind="lib" path="jgoodies-forms-1.8.0.jar" sourcepath="jgoodies-forms-1.8.0-sources.jar"/>
<classpathentry kind="lib" path="C:/Users/pabr6/eclipse-workspace/Exportation documentation analyseWriter/plugins/documentation.analyseWriter_1.0.0.202212032022.jar"/>
<classpathentry kind="lib" path="C:/Users/pabr6/eclipse-workspace/cXML.jar"/>
<classpathentry kind="lib" path="C:/Users/pabr6/eclipse-workspace/cXML.jar" sourcepath="/cXML"/>
<classpathentry kind="output" path="bin"/>
</classpath>

Binary file not shown.

Binary file not shown.

1
bin/.gitignore vendored
View File

@ -128,3 +128,4 @@
/sautpageColonne.svg
/sautpagecolonne.png
/sautpagecolonnemini.png
/resources/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="45"
height="45"
viewBox="0 0 11.90625 11.90625"
version="1.1"
id="svg5"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
sodipodi:docname="evalpasparagraphevide.svg"
inkscape:export-filename="evalpasparagraphevidemini.png"
inkscape:export-xdpi="51.200001"
inkscape:export-ydpi="51.200001"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="14.50748"
inkscape:cx="17.542674"
inkscape:cy="20.368803"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs2" />
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<text
xml:space="preserve"
style="font-size:11.7061px;line-height:1.2;font-family:Symbol;-inkscape-font-specification:Symbol;stroke-width:0.264583;fill:#0000ff"
x="0.95308274"
y="8.9726267"
id="text265"
transform="scale(0.9988156,1.0011858)"><tspan
sodipodi:role="line"
id="tspan263"
style="font-style:normal;font-variant:normal;font-weight:900;font-stretch:normal;font-size:11.7061px;font-family:Arial;-inkscape-font-specification:'Arial Heavy';stroke-width:0.264583;fill:#0000ff"
x="0.95308274"
y="8.9726267">¶</tspan></text>
<path
style="fill:none;stroke:#ff0000;stroke-width:0.8;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 1.0395499,0.83893503 10.924393,11.252672"
id="path479"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#ff0000;stroke-width:0.8;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 10.924393,0.83893503 1.0395499,11.252672"
id="path1131"
sodipodi:nodetypes="cc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

View File

@ -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 *****
//***********************************************

View File

@ -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.</br>
* Evaluer l'absence de paragraphe vide dans la page.</br>
* @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<node> LesParagraphes = nodeStudent.retourneEnfantsByName("text:p", new ArrayList<node>());
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<node>());
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<node> LesParagraphes = sujet.retourneEnfantsByName("text:p", new ArrayList<node>());
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;
}
/**

View File

@ -77,6 +77,7 @@ public class afficheText extends JEditorPane {
String imageEvalAncrageNumeroAbsoluPage= "<img src="+afficheText.class.getResource("/resources/evalnumeropageancragemini.png").toString()+">";
String imageEvalFormatageDirect= "<img src="+afficheText.class.getResource("/resources/evalformatagedirectmini.png").toString()+">";
String imageEvalSautPageColonne= "<img src="+afficheText.class.getResource("/resources/sautpagecolonnemini.png").toString()+">";
String imageEvalPasParagrapheVide= "<img src="+afficheText.class.getResource("/resources/evalpasparagraphevidemini.png").toString()+">";
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("<li class=\"p4\">"+imageEvalSautPageColonne+ "<b> " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"</b></li>");
}
if(Lesattributsdunode.get(i).equals("evalPasParagrapheVide") && !nod.getAttributs().get(Lesattributsdunode.get(i)).equals("0")) {
sb.append("<li class=\"p4\">"+imageEvalPasParagrapheVide+ "<b> " + Lesattributsdunode.get(i) + " = \"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"</b></li>");
}
// sb.append("<li class=\"p4\"><b>" + Lesattributsdunode.get(i) + "=\"" + nod.getAttributs().get(Lesattributsdunode.get(i))+"\"</b></li>");
}

View File

@ -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.</br>
* Evaluer l'absence ou la présence du formatage direct.</br>
* Uniquement présent sur les paragraphes ou les titres.</br>
* @return
*/
@ -219,6 +221,19 @@ public class createPopupMenu extends JPopupMenu {
return mnEvalFormatageDirect;
}
/**
* Evaluer l'absence de paragraphe vide dans les pages.</br>
* Uniquement présent sur les nodes page.</br>
* @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.</br>
* @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();

View File

@ -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);
}
}

View File

@ -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("<h2>Erreur la valeur doit être un nombre entier POSITIF supérieur à zéro.<br>Cependant,la valeur a été modifiée.<br>evalPasParagrapheVide=0.</h2>");
}else {
nod.getAttributs().put("evalPasParagrapheVide", String.valueOf(point));
}
} catch (Exception e2) {
fenetres.create.getTextNodeSelect().setText(baliseStyle.balise());
fenetres.create.getTextNodeSelect().setText("<h2>Erreur la valeur doit être un nombre entier.<br>L'attribut n'a pas été modifiée.</h2>");
}
}
fenetres.create.getTextNodeSelect().refreshAffichage(nod);
}
}

View File

@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B