MAJ V4.5.0
This commit is contained in:
parent
1fd130533e
commit
acc3398aa5
1
bin/.gitignore
vendored
1
bin/.gitignore
vendored
@ -12,3 +12,4 @@
|
||||
/sousmenuEvaluation/
|
||||
/sousmenuRecherche/
|
||||
/sousmenuRepresentation/
|
||||
/resources/
|
||||
|
BIN
icons/enregistrer_modifications.png
Normal file
BIN
icons/enregistrer_modifications.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
7382
icons/enregistrer_modifications.svg
Normal file
7382
icons/enregistrer_modifications.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 1.1 MiB |
@ -6,8 +6,10 @@ import java.awt.event.KeyEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import MEPTL.commandes;
|
||||
import fenetres.baseDonneesEvaluations;
|
||||
import fenetres.create;
|
||||
import fenetres.evaluate;
|
||||
@ -27,9 +29,22 @@ public class actEvaluer extends AbstractAction{
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if(commandes.evaluationChargeEnMemoire!=null) {
|
||||
evaluate.getInstance();
|
||||
if(!baseDonneesEvaluations.isDispose) baseDonneesEvaluations.ferme();
|
||||
create.fermeCreate();
|
||||
}else {
|
||||
// Message à afficher
|
||||
String message = "Pour évaluer des fichiers d'étudiants,\nvous devez charger ou créer en mémoire une évaluation !";
|
||||
|
||||
// Titre de la boîte de dialogue
|
||||
String title = "Information";
|
||||
|
||||
// Affichage de la boîte de dialogue d'information
|
||||
JOptionPane.showMessageDialog(null, message, title, JOptionPane.INFORMATION_MESSAGE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,18 @@
|
||||
package action;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import MEPTL.commandes;
|
||||
import fenetres.baseDonneesEvaluations;
|
||||
@ -33,20 +38,145 @@ public class actExit extends AbstractAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int H = commandes.evaluationChargeEnMemoire.hashCode();
|
||||
int H = 0;
|
||||
if(commandes.evaluationChargeEnMemoire!=null) H=commandes.evaluationChargeEnMemoire.hashCode();
|
||||
|
||||
if(H==commandes.hashCodeEvaluationSave){
|
||||
if(JOptionPane.showConfirmDialog(null,"Voulez-vous quitter analyseWriter?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
|
||||
|
||||
// Définir les dimensions de la boîte de dialogue
|
||||
int dialogWidth = 420;
|
||||
int dialogHeight = 260;
|
||||
|
||||
// Chargement de l'icône personnalisée
|
||||
ImageIcon customIcon = new ImageIcon(create.class.getResource("/resources/bye-bye.png"));
|
||||
|
||||
// Création du panneau pour contenir l'image
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JLabel labelImage = new JLabel(customIcon, JLabel.CENTER);
|
||||
|
||||
// Ajouter l'image au panneau
|
||||
panel.add(labelImage, BorderLayout.CENTER);
|
||||
|
||||
// Définir les boutons personnalisés
|
||||
JButton buttonYes = new JButton("Quitter");
|
||||
JButton buttonNo = new JButton("Annuler");
|
||||
|
||||
// Ajout des boutons à un panneau
|
||||
JPanel buttonPanel = new JPanel();
|
||||
buttonPanel.add(buttonYes);
|
||||
buttonPanel.add(buttonNo);
|
||||
|
||||
// Ajouter le panneau de boutons au panneau principal
|
||||
panel.add(buttonPanel, BorderLayout.SOUTH);
|
||||
|
||||
// Affichage de la boîte de dialogue
|
||||
JDialog dialog = new JDialog();
|
||||
dialog.setTitle("Quitter");
|
||||
dialog.setModal(true);
|
||||
dialog.setContentPane(panel);
|
||||
dialog.setSize(dialogWidth, dialogHeight);
|
||||
dialog.setResizable(false);
|
||||
dialog.setLocationRelativeTo(null); // Pour centrer la boîte de dialogue à l'écran
|
||||
|
||||
// Définir le bouton par défaut
|
||||
dialog.getRootPane().setDefaultButton(buttonYes);
|
||||
|
||||
// Actions des boutons
|
||||
buttonYes.addActionListener((ActionEvent evt) -> {
|
||||
baseDonneesEvaluations.ferme();
|
||||
create.fermeCreate();
|
||||
evaluate.ferme();
|
||||
}
|
||||
dialog.dispose();
|
||||
System.exit(0); // Fermer l'application
|
||||
});
|
||||
|
||||
buttonNo.addActionListener((ActionEvent evt) -> {
|
||||
System.out.println("L'utilisateur a choisi de ne pas quitter.");
|
||||
dialog.dispose();
|
||||
});
|
||||
|
||||
// Afficher la boîte de dialogue
|
||||
dialog.setVisible(true);
|
||||
|
||||
// Placer le focus sur le bouton "Oui"
|
||||
SwingUtilities.invokeLater(() -> buttonYes.requestFocusInWindow());
|
||||
|
||||
|
||||
}else{
|
||||
if(JOptionPane.showConfirmDialog(null,"Vous avez apporté des modifications à cette évaluation.\n"
|
||||
+ "Voulez-vous quitter analyseWriter sans enregistrer vos modification ?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
|
||||
|
||||
// Définir les dimensions de la boîte de dialogue
|
||||
int dialogWidth = 420;
|
||||
int dialogHeight = 260;
|
||||
|
||||
// Chargement de l'icône personnalisée
|
||||
ImageIcon customIcon = new ImageIcon(create.class.getResource("/resources/enregistrer_modifications.png"));
|
||||
|
||||
// Création du panneau pour contenir l'image
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JLabel labelImage = new JLabel(customIcon, JLabel.CENTER);
|
||||
|
||||
// Ajouter l'image au panneau
|
||||
panel.add(labelImage, BorderLayout.CENTER);
|
||||
|
||||
// Définir les boutons personnalisés
|
||||
JButton buttonYes = new JButton("Quitter");
|
||||
JButton buttonNo = new JButton("Annuler");
|
||||
JButton buttonSave = new JButton("Enregistrer puis quitter");
|
||||
|
||||
// Ajout des boutons à un panneau
|
||||
JPanel buttonPanel = new JPanel();
|
||||
buttonPanel.add(buttonSave);
|
||||
buttonPanel.add(buttonYes);
|
||||
buttonPanel.add(buttonNo);
|
||||
|
||||
|
||||
// Ajouter le panneau de boutons au panneau principal
|
||||
panel.add(buttonPanel, BorderLayout.SOUTH);
|
||||
|
||||
// Affichage de la boîte de dialogue
|
||||
JDialog dialog = new JDialog();
|
||||
dialog.setTitle("Quitter");
|
||||
dialog.setModal(true);
|
||||
dialog.setContentPane(panel);
|
||||
dialog.setSize(dialogWidth, dialogHeight);
|
||||
dialog.setResizable(false);
|
||||
dialog.setLocationRelativeTo(null); // Pour centrer la boîte de dialogue à l'écran
|
||||
|
||||
|
||||
|
||||
// Définir le bouton par défaut
|
||||
dialog.getRootPane().setDefaultButton(buttonSave);
|
||||
|
||||
// Actions des boutons
|
||||
buttonYes.addActionListener((ActionEvent evt) -> {
|
||||
baseDonneesEvaluations.ferme();
|
||||
create.fermeCreate();
|
||||
evaluate.ferme();
|
||||
}
|
||||
dialog.dispose();
|
||||
System.exit(0); // Fermer l'application
|
||||
});
|
||||
|
||||
buttonNo.addActionListener((ActionEvent evt) -> {
|
||||
System.out.println("L'utilisateur a choisi de ne pas quitter.");
|
||||
dialog.dispose();
|
||||
});
|
||||
|
||||
buttonSave.addActionListener((ActionEvent evt) -> {
|
||||
System.out.println("L'utilisateur a choisi d'enregistrer.");
|
||||
// Appeler l'action d'enregistrement
|
||||
new actSaveEvaluation().actionPerformed(null);
|
||||
baseDonneesEvaluations.ferme();
|
||||
create.fermeCreate();
|
||||
evaluate.ferme();
|
||||
dialog.dispose();
|
||||
System.exit(0);
|
||||
});
|
||||
|
||||
// Afficher la boîte de dialogue
|
||||
dialog.setVisible(true);
|
||||
|
||||
// Placer le focus sur le bouton "Save"
|
||||
SwingUtilities.invokeLater(() -> buttonSave.requestFocusInWindow());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
@ -622,20 +621,7 @@ public final class create extends JFrame {
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
|
||||
int H = commandes.evaluationChargeEnMemoire.hashCode();
|
||||
if(H==commandes.hashCodeEvaluationSave){
|
||||
if(JOptionPane.showConfirmDialog(null,"Voulez-vous quitter analyseWriter?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
|
||||
baseDonneesEvaluations.ferme();
|
||||
evaluate.ferme();
|
||||
fermeCreate();
|
||||
}
|
||||
}else{
|
||||
if(JOptionPane.showConfirmDialog(null,"Vous avez apporté des modifications à cette évaluation.\n"
|
||||
+ "Voulez-vous quitter analyseWriter sans enregistrer vos modification ?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
|
||||
baseDonneesEvaluations.ferme();
|
||||
create.fermeCreate();
|
||||
}
|
||||
}
|
||||
new actExit().actionPerformed(null);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -463,20 +463,7 @@ public class evaluate extends JFrame {
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
|
||||
if(commandes.evaluationChargeEnMemoire.hashCode()==commandes.hashCodeEvaluationSave){
|
||||
if(JOptionPane.showConfirmDialog(null,"Voulez-vous quitter analyseWriter?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
|
||||
baseDonneesEvaluations.ferme();
|
||||
create.fermeCreate();
|
||||
ferme();
|
||||
}
|
||||
}else{
|
||||
if(JOptionPane.showConfirmDialog(null,"Vous avez apporté des modifications à cette évaluation.\n"
|
||||
+ "Voulez-vous quitter analyseWriter sans enregistrer vos modification ?", "Quitter", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)==JOptionPane.YES_OPTION) {
|
||||
baseDonneesEvaluations.ferme();
|
||||
create.fermeCreate();
|
||||
ferme();
|
||||
}
|
||||
}
|
||||
new actExit().actionPerformed(null);
|
||||
}
|
||||
});
|
||||
|
||||
@ -713,7 +700,7 @@ public class evaluate extends JFrame {
|
||||
|
||||
toolBar.addSeparator();
|
||||
|
||||
JButton btnExit = toolBar.add(new action.actExit());
|
||||
JButton btnExit = toolBar.add(new actExit());
|
||||
btnExit.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
|
BIN
src/resources/bye-bye.png
Normal file
BIN
src/resources/bye-bye.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 65 KiB |
BIN
src/resources/enregistrer_modifications.png
Normal file
BIN
src/resources/enregistrer_modifications.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
Loading…
Reference in New Issue
Block a user