analyseCalc/analyseCalc/analyseCalc/analyseCalc/analyseCalc/src/fenetres/create_act/actEvalNameNodeOui.java

51 lines
1.7 KiB
Java

package fenetres.create_act;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JOptionPane;
import fenetres.baliseStyle;
import nodeAC.nodeAC;
public class actEvalNameNodeOui extends AbstractAction{
/**
*
*/
private static final long serialVersionUID = 1L;
{
putValue( Action.NAME, "Oui, combien de point?" );
putValue( Action.SHORT_DESCRIPTION, "Evaluer la présence de ce nodeAC" );
}
@Override
public void actionPerformed(ActionEvent e) {
nodeAC nod = (nodeAC) fenetres.create.getSelectNode().getUserObject();
int point = 0;
if(nod.getAttributs().get("evalNameNode")!=null) {
point = Integer.valueOf(nod.getAttributs().get("evalNameNode"));
}
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("evalNameNode", 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>evalNameNode=0.</h2>");
}else {
nod.getAttributs().put("evalNameNode", 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);
}
}