2023-02-05 17:46:02 +01:00
|
|
|
package action;
|
2022-12-10 10:00:28 +01:00
|
|
|
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
|
|
|
import javax.swing.AbstractAction;
|
|
|
|
import javax.swing.Action;
|
2022-12-12 11:49:47 +01:00
|
|
|
import javax.swing.ImageIcon;
|
2022-12-10 10:00:28 +01:00
|
|
|
import javax.swing.JOptionPane;
|
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
|
import javax.swing.tree.DefaultTreeModel;
|
|
|
|
import javax.swing.tree.TreePath;
|
|
|
|
|
|
|
|
import MEPTL.commandes;
|
|
|
|
import cXML.node;
|
2022-12-12 11:49:47 +01:00
|
|
|
import fenetres.create;
|
2022-12-10 10:00:28 +01:00
|
|
|
|
|
|
|
public class actEvaluerTousLesStylesParagraphesFalse extends AbstractAction{
|
|
|
|
{
|
|
|
|
putValue( Action.NAME, "Supprime la méthode analyseStyle de tous les paragraphes ou les titres." );
|
2022-12-12 11:49:47 +01:00
|
|
|
putValue( Action.SHORT_DESCRIPTION, "Retire analyseStyle de tous les nodes text:p ou text:h" );
|
|
|
|
putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/falsemini.png")));
|
2022-12-10 10:00:28 +01:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
TreePath path = fenetres.create.getTree().getSelectionPath();
|
|
|
|
node nod = (node) fenetres.create.getSelectNode().getUserObject();
|
|
|
|
|
|
|
|
|
|
|
|
boolean retire =false;
|
|
|
|
if(JOptionPane.showConfirmDialog(null,"Voulez-vous aussi retirer de tous les styles du node \"style:paragraph\"\n"
|
|
|
|
+ "la méthode \"EvaluerATraversAnalyseStyle=true\"?", "Avertissement", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
|
|
|
|
retire=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(int i =0 ; i < nod.getNodes().size(); i++) {
|
|
|
|
if(nod.getNodes().get(i).getNomElt().equals("text:p")||nod.getNodes().get(i).getNomElt().equals("text:h")) {
|
|
|
|
nod.getNodes().get(i).getAttributs().put("analyseStyle", "false");
|
|
|
|
|
|
|
|
//***************************************************************************************************************
|
|
|
|
//** Place l'attribut EvaluerATraversAnalyseStyle=true au style qui doit être évaluer à travers d'analyseStyle **
|
|
|
|
//** S'il y a des attributs évaluer avec ‽ alors change par ‼ **
|
|
|
|
//***************************************************************************************************************
|
|
|
|
|
|
|
|
if(retire) {
|
|
|
|
node nodStyle = commandes.sujet.retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", nod.getNodes().get(i).getAttributs().get("text:style-name"));
|
|
|
|
if(nodStyle!=null) {
|
|
|
|
nodStyle.getAttributs().put("EvaluerATraversAnalyseStyle", "false");
|
|
|
|
nodStyle.changeLesCodesEvaluateursVersCodeEvaluateurDirect();;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel();
|
|
|
|
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
|
|
|
|
model.reload(root);
|
|
|
|
|
|
|
|
fenetres.create.getTree().setSelectionPath(path);
|
|
|
|
fenetres.create.getTree().expandPath(path);
|
|
|
|
|
|
|
|
fenetres.create.getTree().repaint();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|