63 lines
2.8 KiB
Java
63 lines
2.8 KiB
Java
package action;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
|
|
import javax.swing.AbstractAction;
|
|
import javax.swing.Action;
|
|
import javax.swing.ImageIcon;
|
|
|
|
import MEPTL.commandes;
|
|
import cXML.node;
|
|
import fenetres.CustomInputDialogSimplePointCaseCoche;
|
|
import fenetres.create;
|
|
|
|
public class actEvaluerNomDuStyleHeriteTrue extends AbstractAction{
|
|
{
|
|
putValue( Action.NAME, "Evaluer le style du premier parent (hérité)" );
|
|
putValue( Action.SHORT_DESCRIPTION, "Evaluer le nom du style hérité.\nSi pas d'héritage alors évalue celui du nom de ce style.");
|
|
putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/heritagestylemini.png")));
|
|
}
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
node nod = (node) fenetres.create.getSelectNode().getUserObject();
|
|
String nameStyle = "";
|
|
String texteInsert ="";
|
|
|
|
if(nod.getAttributs().get("text:style-name")!=null) {
|
|
nameStyle = nod.getAttributs().get("text:style-name");
|
|
Pattern p = Pattern.compile("^P[0-9]{1,}|^T[0-9]{1,}|^L[0-9]{1,}");
|
|
Matcher m = p.matcher(nameStyle);
|
|
if(m.find()) {
|
|
if(commandes.sujet.retourneFirstEnfantsByName("style:paragraph").retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", nameStyle)!=null) {
|
|
node nodeStyle = commandes.sujet.retourneFirstEnfantsByName("style:paragraph").retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", nameStyle);
|
|
if(nodeStyle.getAttributs().get("style:parent-style-name")!=null) {
|
|
nameStyle = nodeStyle.getAttributs().get("style:parent-style-name");
|
|
texteInsert = "<p><span style=\"color: red;\">Pour ce node, le style parent (hérité) est <u>"+nameStyle+"</u>.</span></p><br>";
|
|
}
|
|
}
|
|
texteInsert = "<p><span style=\"color: red;\">pour ce node, il n'y a pas d'héritage, <u>"+nameStyle+"</u>.</span></p><br>";
|
|
}else {
|
|
texteInsert = "<p><span style=\"color: red;\">pour ce node, il n'y a pas d'héritage, <u>"+nameStyle+"</u>.</span></p><br>";
|
|
}
|
|
}
|
|
|
|
CustomInputDialogSimplePointCaseCoche.showCustominputDialog(nod,"evalNameLegacyStyle",
|
|
"<html><p>Si le node de l'étudiant possède le même style par héritage<br>"
|
|
+ "que ce node, alors l'étudiant obtiendra les points ci-dessous.</p><br>"
|
|
+ texteInsert
|
|
+ "<p>Cochez la case pour placer ou supprimer la méthode sur<br>tous les nodes frères.</p><br>"
|
|
+ "<p>Cliquez sur le bouton supprimer pour retirer la méthode<br>"
|
|
+ "d'évaluation evalNameLegacyStyle.</p></html>",
|
|
new ImageIcon(create.class.getResource("/resources/heritagestyle.png")));
|
|
fenetres.create.getTextNodeSelect().refreshAffichage(nod);
|
|
}
|
|
|
|
}
|