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.create; public class actDownNode extends AbstractAction{ /** * */ private static final long serialVersionUID = 1L; { putValue( Action.NAME, "Descendre le node" ); putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/downnodemini.png")) ); putValue( Action.SHORT_DESCRIPTION, "Descendre le node" ); } @Override public void actionPerformed(ActionEvent e) { if(fenetres.create.getTree().getSelectionPath()!=null) { int a = JOptionPane.showConfirmDialog(null,"Voulez-vous descendre le node " + fenetres.create.getSelectNode().toString() + "?", "Sélectionner un choix", JOptionPane.YES_NO_OPTION); if(a == JOptionPane.YES_NO_OPTION) { node nod = (node) fenetres.create.getSelectNode().getUserObject(); if(!nod.chemin().contains("setting")) { nod.getParent().downNodeEnfant(nod); fenetres.create.constructionTree(); }else { JOptionPane.showMessageDialog(null,"Vous ne devez pas déplacer ce node !", "Oh non!!!", JOptionPane.INFORMATION_MESSAGE); } } } } }