2022-06-19 21:01:30 +02:00
|
|
|
package fenetres.create_act;
|
|
|
|
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
|
|
|
import javax.swing.AbstractAction;
|
|
|
|
import javax.swing.Action;
|
2022-12-18 14:04:11 +01:00
|
|
|
import javax.swing.Box;
|
|
|
|
import javax.swing.JLabel;
|
2022-06-19 21:01:30 +02:00
|
|
|
import javax.swing.JOptionPane;
|
2022-12-18 14:04:11 +01:00
|
|
|
import javax.swing.JPanel;
|
|
|
|
import javax.swing.JTextField;
|
2022-06-19 21:01:30 +02:00
|
|
|
|
|
|
|
import cXML.node;
|
|
|
|
|
|
|
|
public class actTitrePrincipal extends AbstractAction{
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
{
|
|
|
|
putValue( Action.NAME, "Titre principal" );
|
|
|
|
putValue( Action.SHORT_DESCRIPTION, "Titre principal" );
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
node nod = (node) fenetres.create.getSelectNode().getUserObject();
|
|
|
|
String titre = "";
|
|
|
|
if(nod.getAttributs().get("titre")!=null) {
|
|
|
|
titre = nod.getAttributs().get("titre");
|
|
|
|
}
|
|
|
|
|
2022-12-18 14:04:11 +01:00
|
|
|
JTextField xField = new JTextField(30);
|
|
|
|
xField.setText(titre);
|
|
|
|
JPanel myPanel = new JPanel();
|
|
|
|
myPanel.add(new JLabel("Titre :"));
|
|
|
|
myPanel.add(Box.createHorizontalStrut(2)); // a spacer
|
|
|
|
myPanel.add(xField);
|
|
|
|
|
|
|
|
|
2022-12-20 20:57:12 +01:00
|
|
|
int result = JOptionPane.showConfirmDialog(null,myPanel,"Saisissez votre titre principal", JOptionPane.OK_CANCEL_OPTION);
|
2022-12-18 14:04:11 +01:00
|
|
|
if (result == JOptionPane.OK_OPTION) {
|
|
|
|
nod.titre(xField.getText());
|
|
|
|
fenetres.create.getTextNodeSelect().refreshAffichage(nod);
|
|
|
|
}
|
|
|
|
|
2022-06-19 21:01:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|