analyseWriter/src/fenetres/create_act/actEvalueTrue.java

76 lines
2.4 KiB
Java
Raw Normal View History

2022-06-19 21:01:30 +02:00
package fenetres.create_act;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
2022-06-19 21:01:30 +02:00
import cXML.node;
import fenetres.create;
import list.listeNodeFormatageDirectDeWriter;
2022-06-19 21:01:30 +02:00
public class actEvalueTrue extends AbstractAction{
/**
*
*/
private static final long serialVersionUID = 1L;
{
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_DOWN_MASK));
putValue( Action.NAME, "Evaluer true" );
putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/evaluertruemini.png")) );
putValue( Action.SHORT_DESCRIPTION, "Evaluer ce node par l'application" );
}
@Override
public void actionPerformed(ActionEvent e) {
node nod = (node) fenetres.create.getSelectNode().getUserObject();
nod.evaluerTrue();
//Ajoute addmenu au node de niveau 1.
if(nod.getLevel()==1) nod.addMenu(true);
//Change les évaluateurs pour les nodes style:style
if(nod.getNomElt().equals("style:style")) {
// Change les évaluateurs ‼ en ‽
if(nod.getAttributs().get("EvaluerATraversAnalyseStyle")!=null) {
if(!listeNodeFormatageDirectDeWriter.isFormatageDirect(nod)) {
nod.changeLesCodesEvaluateursVersCodeEvaluateurDirect();
}else {
nod.changeLesCodesEvaluateursVersCodeATraversAnalyseStyle();
}
}else {
// Change les évaluateurs ‽ en ‼
if(nod.getAttributs().get("EvaluerATraversAnalyseStyle").equals("true")) {
nod.changeLesCodesEvaluateursVersCodeATraversAnalyseStyle();
}else {
// Change les évaluateurs ‼ en ‽
nod.changeLesCodesEvaluateursVersCodeEvaluateurDirect();
}
}
}
TreePath path = fenetres.create.getTree().getSelectionPath();
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.getTextNodeSelect().refreshAffichage(nod);
2022-06-19 21:01:30 +02:00
}
}