diff --git a/.gitignore b/.gitignore index da73cf060ffc904e1b537f47cc4a444fbf8f7db4..d37caf74137bbc9b91b6dd6a7c33a6aa96c4f232 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ +<<<<<<< HEAD +# Created by https://www.toptal.com/developers/gitignore/api/java,netbeans,maven,eclipse,intellij +# Edit at https://www.toptal.com/developers/gitignore?templates=java,netbeans,maven,eclipse,intellij +======= # Created by https://www.toptal.com/developers/gitignore/api/eclipse,java,intellij,netbeans,maven # Edit at https://www.toptal.com/developers/gitignore?templates=eclipse,java,intellij,netbeans,maven +>>>>>>> Cedric ### Eclipse ### .metadata @@ -235,4 +240,8 @@ dist/ nbdist/ .nb-gradle/ +<<<<<<< HEAD +# End of https://www.toptal.com/developers/gitignore/api/java,netbeans,maven,eclipse,intellij +======= # End of https://www.toptal.com/developers/gitignore/api/eclipse,java,intellij,netbeans,maven +>>>>>>> Cedric diff --git a/pom.xml b/pom.xml index 649fbd6d0079615a954e72bdcd041266964a9b23..583b65ab19e2161897f25f5352c5c2a106bc503e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,6 +5,20 @@ Activite_calcul 01 jar + + + org.mariadb.jdbc + mariadb-java-client + 3.4.1 + + + org.junit.jupiter + junit-jupiter-api + 5.10.2 + test + jar + + UTF-8 17 diff --git a/src/main/java/Calcul/TestCalcul.java b/src/main/java/Calcul/Calcul.java similarity index 84% rename from src/main/java/Calcul/TestCalcul.java rename to src/main/java/Calcul/Calcul.java index 0d5a8d9792675ab4a0e912282295de64b07d8f74..3d834e6328df9ee9eda69ebfc96493a86335b229 100644 --- a/src/main/java/Calcul/TestCalcul.java +++ b/src/main/java/Calcul/Calcul.java @@ -3,31 +3,31 @@ package Calcul; import beans.Addition; import beans.Substraction; import java.util.Random; +import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.JButton; -import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.border.TitledBorder; /** * * @author cedric */ -public class TestCalcul extends JFrame { +public class Calcul extends JPanel { private JPanel[] panels; private JPanel currentPanel; - private final Box content; + private final Addition additionPanel; private final Substraction substractionPanel; - public TestCalcul() { - - this.setTitle("Seras-tu résoudre ce calcul"); - this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - + public Calcul() { this.content = Box.createVerticalBox(); + TitledBorder titledBorder = BorderFactory.createTitledBorder("Résous ce calcul"); + content.setBorder(titledBorder); + this.additionPanel = new Addition(); this.substractionPanel = new Substraction(); @@ -40,7 +40,6 @@ public class TestCalcul extends JFrame { this.setSize(800, 600); this.setVisible(true); - } private void TestPanel() { diff --git a/src/main/java/Calcul/Main.java b/src/main/java/Calcul/Main.java index 6629938c5e38942abaf9f437b278c5bb4a97a49c..62ab47b44216c106dc1d1d53f671d9497a32c92d 100644 --- a/src/main/java/Calcul/Main.java +++ b/src/main/java/Calcul/Main.java @@ -7,7 +7,7 @@ package Calcul; public class Main { public static void main(String[] args) { - TestCalcul test = new TestCalcul(); + Calcul test = new Calcul(); } } diff --git a/src/main/java/beans/Addition.java b/src/main/java/beans/Addition.java index 1681289f49ec46e8cdaeda0529bb912e49c21ad2..1246b9bed4bdabce444ff7cc06c6a094bffe883e 100644 --- a/src/main/java/beans/Addition.java +++ b/src/main/java/beans/Addition.java @@ -2,9 +2,7 @@ package beans; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.FlowLayout; import java.awt.event.ActionEvent; -import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -51,7 +49,6 @@ public class Addition extends JPanel { operation.add(addition); - //partie answer int resultatA = c1 + c2; @@ -79,11 +76,9 @@ public class Addition extends JPanel { JOptionPane.showMessageDialog(proposition, "le résultat est " + resultatA); }); - button.add(check); button.add(solution); - answer.add(propo); answer.add(proposition); @@ -98,7 +93,6 @@ public class Addition extends JPanel { place.add(answer, BorderLayout.EAST); place.add(button, BorderLayout.SOUTH); - this.add(operation); this.add(answer); this.add(button); diff --git a/src/main/java/beans/Drawing.java b/src/main/java/beans/Drawing.java index f296347131e86eb765ffacc2018396f27f6d53cb..46ea309b56acf348f58c11c41f18b0573442ea34 100644 --- a/src/main/java/beans/Drawing.java +++ b/src/main/java/beans/Drawing.java @@ -1,64 +1,66 @@ package beans; - +import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.event.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; -public class Drawing extends JFrame { +public class Drawing extends JPanel { private Color currentColor = Color.BLACK; private int brushSize = 10; private boolean eraserMode = false; + private boolean hasDrawn = false; // Indicateur pour savoir si un dessin a été effectué + private DrawArea drawArea; + private JButton saveButton; // Bouton pour enregistrer public Drawing() { - setTitle("Application de Dessin"); + //setTitle("Application de Dessin"); setSize(800, 600); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - // Zone de dessin drawArea = new DrawArea(); drawArea.setBackground(Color.WHITE); - // Bouton pour choisir la couleur + // Créer les boutons et options (sans icônes ni curseur personnalisé) JButton colorButton = new JButton("Couleur"); - colorButton.setFocusable(false); colorButton.addActionListener(e -> chooseColor()); - // Bouton pour effacer tout JButton eraseButton = new JButton("Effacer tout"); - eraseButton.setFocusable(false); - eraseButton.addActionListener(e -> drawArea.clear()); + eraseButton.addActionListener(e -> { + drawArea.clear(); + hasDrawn = false; // Réinitialiser le statut + saveButton.setEnabled(false); // Désactiver le bouton d'enregistrement + }); - // Slider pour choisir la taille du pinceau JSlider sizeSlider = new JSlider(1, 50, brushSize); sizeSlider.setMajorTickSpacing(10); sizeSlider.setPaintTicks(true); sizeSlider.setPaintLabels(true); - sizeSlider.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - brushSize = sizeSlider.getValue(); - } - }); + sizeSlider.addChangeListener(e -> brushSize = sizeSlider.getValue()); - // Bouton pour activer/désactiver la gomme JButton eraserButton = new JButton("Gomme"); - eraserButton.setFocusable(false); eraserButton.addActionListener(e -> eraserMode = !eraserMode); - // Disposition des éléments d'interface dans un JPanel avec un FlowLayout + // Bouton "Enregistrer" désactivé par défaut + saveButton = new JButton("Enregistrer"); + saveButton.setEnabled(false); // Désactivé par défaut + saveButton.addActionListener(e -> saveDrawing()); + + // Disposition des éléments d'interface JPanel controls = new JPanel(); - controls.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); // Espacement entre les composants controls.add(colorButton); - controls.add(new JLabel("Taille du pinceau :")); + controls.add(new JLabel("Taille du stylo :")); controls.add(sizeSlider); controls.add(eraserButton); controls.add(eraseButton); + controls.add(saveButton); // Ajout du bouton d'enregistrement // Ajouter les composants à la fenêtre + setLayout(new BorderLayout()); add(controls, BorderLayout.NORTH); add(drawArea, BorderLayout.CENTER); @@ -74,10 +76,33 @@ public class Drawing extends JFrame { } } - // Zone de dessin personnalisée - private class DrawArea extends JPanel { + // Méthode pour enregistrer le dessin dans un fichier + private void saveDrawing() { + if (!hasDrawn) { + JOptionPane.showMessageDialog(this, "Rien n'a été dessiné à enregistrer.", "Erreur", JOptionPane.ERROR_MESSAGE); + return; + } + + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle("Enregistrer le dessin"); + int userSelection = fileChooser.showSaveDialog(this); + + if (userSelection == JFileChooser.APPROVE_OPTION) { + File fileToSave = fileChooser.getSelectedFile(); + try { + // Crée un fichier PNG + ImageIO.write(drawArea.getImage(), "png", new File(fileToSave.getAbsolutePath() + ".png")); + JOptionPane.showMessageDialog(this, "Dessin enregistré avec succès !"); + } catch (IOException ex) { + ex.printStackTrace(); + JOptionPane.showMessageDialog(this, "Erreur lors de l'enregistrement du fichier.", "Erreur", JOptionPane.ERROR_MESSAGE); + } + } + } - private Image image; + // Zone de dessin + private class DrawArea extends JPanel { + private BufferedImage image; private Graphics2D g2d; private int prevX, prevY; @@ -103,45 +128,26 @@ public class Drawing extends JFrame { int y = e.getY(); if (eraserMode) { - g2d.setColor(Color.WHITE); // Utiliser la gomme + g2d.setColor(Color.WHITE); // Mode gomme } else { - g2d.setColor(currentColor); // Utiliser la couleur sélectionnée + g2d.setColor(currentColor); // Mode pinceau } - // Dessiner un trait continu g2d.setStroke(new BasicStroke(brushSize, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); g2d.drawLine(prevX, prevY, x, y); - repaint(); prevX = x; prevY = y; - } - }); - // Redimensionner l'image lors du redimensionnement de la fenêtre - addComponentListener(new ComponentAdapter() { - @Override - public void componentResized(ComponentEvent e) { - if (g2d != null) { - Image newImage = createImage(getWidth(), getHeight()); - Graphics2D g2dNew = (Graphics2D) newImage.getGraphics(); - g2dNew.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2dNew.setColor(Color.WHITE); - g2dNew.fillRect(0, 0, getWidth(), getHeight()); - g2dNew.drawImage(image, 0, 0, null); // Copie l'ancien contenu sur la nouvelle image - g2d = g2dNew; - image = newImage; - } else { - initDrawing(getSize().width, getSize().height); - } - repaint(); + hasDrawn = true; // Marque le fait qu'un dessin a été effectué + saveButton.setEnabled(true); // Active le bouton d'enregistrement } }); } - // Méthode pour initialiser l'image de dessin + // Initialisation de l'image de dessin private void initDrawing(int width, int height) { - image = createImage(width, height); + image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); g2d = (Graphics2D) image.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.WHITE); @@ -149,7 +155,7 @@ public class Drawing extends JFrame { g2d.setColor(Color.BLACK); } - // Méthode pour effacer le dessin + // Effacer tout public void clear() { g2d.setPaint(Color.WHITE); g2d.fillRect(0, 0, getSize().width, getSize().height); @@ -157,6 +163,11 @@ public class Drawing extends JFrame { repaint(); } + // Retourne l'image en cours de dessin + public BufferedImage getImage() { + return image; + } + @Override protected void paintComponent(Graphics g) { super.paintComponent(g); diff --git a/src/main/java/beans/Question.java b/src/main/java/beans/Question.java new file mode 100644 index 0000000000000000000000000000000000000000..77b10dcea6cd2a586b05effb18a5632662fe1f11 --- /dev/null +++ b/src/main/java/beans/Question.java @@ -0,0 +1,73 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package beans; + +import java.io.Serializable; + +/** + * + * @author Clément GROSSELLE + */ +public class Question implements Serializable { + + private int id; + private int level; + private String statement; + private String answer; + + public Question() { + } + + public Question(Question q) { + this.id = q.id; + this.level = q.level; + this.statement = q.statement; + this.answer = q.answer; + } + + public void setId(int id) { + this.id = id; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public String getStatement() { + return statement; + } + + public void setStatement(String statement) { + this.statement = statement; + } + + public String getAnswer() { + return answer; + } + + public void setAnswer(String answer) { + this.answer = answer; + } + + public int getId() { + return id; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Questions{"); + sb.append("id=").append(id); + sb.append(", level=").append(level); + sb.append(", statement=").append(statement); + sb.append(", answer=").append(answer); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/beans/Substraction.java b/src/main/java/beans/Substraction.java index f670e5baa08d3be0bccee35cb29ad55c56c56939..cf65a7acc8bb5c5b2fbbd6e11fff7e95db88cf13 100644 --- a/src/main/java/beans/Substraction.java +++ b/src/main/java/beans/Substraction.java @@ -2,10 +2,7 @@ package beans; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.GridLayout; import java.awt.event.ActionEvent; -import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -87,7 +84,6 @@ public class Substraction extends JPanel { button.add(check); button.add(solution); - answer.add(propo); answer.add(proposition); @@ -106,7 +102,6 @@ public class Substraction extends JPanel { this.add(answer); this.add(button); - } } diff --git a/src/main/java/com/mycompany/groupe_05/ContentFrame.java b/src/main/java/com/mycompany/groupe_05/ContentFrame.java new file mode 100644 index 0000000000000000000000000000000000000000..0f07ae90778076d095e6b51fb5aca4c9e00b812c --- /dev/null +++ b/src/main/java/com/mycompany/groupe_05/ContentFrame.java @@ -0,0 +1,129 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.mycompany.groupe_05; + +import beans.Drawing; +import gui.MainMenu; +import gui.QuestionsGui; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; + +/** + * + * @author stag + */ +public class ContentFrame extends JFrame { + + private static final long serialVersionUID = 1L; + + private final JPanel content; + private final MainMenu menuPanel; + private final Drawing drawingPane; + private final Container mathPane; + private final QuestionsGui questionsPane; + private final JMenuBar menuBar; + + + + public ContentFrame() { + content = new JPanel(new BorderLayout()); + drawingPane = new Drawing(); + questionsPane = new QuestionsGui(); + mathPane = new JPanel(); + menuPanel = new MainMenu(); + menuBar = new JMenuBar(); + + setTitle("Multi Jeux"); + initGui(); + initEvent(); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setResizable(true); + setSize(800, 600); + setLocationRelativeTo(null); + setVisible(true); + + } + + private void initGui() { + initMenuBar(); + initMenuPanel(); + content.add(menuPanel, BorderLayout.WEST); + setJMenuBar(menuBar); + setContentPane(content); + } + + private void initEvent() { + menuPanel.getDrawButton().addActionListener((ActionEvent ae) -> { + switchActivities(drawingPane); + }); + menuPanel.getMathButton().addActionListener((ActionEvent ae) -> { + switchActivities(mathPane); + }); + menuPanel.getQuestButton().addActionListener((ActionEvent ae) -> { + switchActivities(questionsPane); + }); + } + + private void initMenuBar() { + //Définition des différents groupes de menus + JMenu activitiesMenu = new JMenu("Jeux"); + JMenu optionsMenu = new JMenu("Options"); + JMenu otherMenu = new JMenu("Infos"); + + JMenuItem drawI = new JMenuItem("Ardoise magique"); + JMenuItem mathI = new JMenuItem("Test de maths"); + JMenuItem questI = new JMenuItem("Culture générale"); + JMenuItem newQuestI = new JMenuItem("Créer nouvelle question"); + JMenuItem helpI = new JMenuItem("Besoin d'aide?"); + JMenuItem mainI = new JMenuItem("Menu Principal"); + JMenuItem exitI = new JMenuItem("Quitter"); + + activitiesMenu.add(drawI); + activitiesMenu.add(mathI); + activitiesMenu.add(questI); + + optionsMenu.add(mainI); + optionsMenu.add(newQuestI); + optionsMenu.add(exitI); + + otherMenu.add(helpI); + + menuBar.add(activitiesMenu); + menuBar.add(optionsMenu); + menuBar.add(otherMenu); + drawI.addActionListener(ae -> switchActivities(drawingPane)); + mathI.addActionListener(ae -> switchActivities(mathPane)); + questI.addActionListener(ae -> switchActivities(questionsPane)); + mainI.addActionListener((ActionEvent ae) -> { + content.add(menuPanel, BorderLayout.WEST); + }); + exitI.addActionListener(ae -> System.exit(0)); + + } + + private void initMenuPanel() { + } + + private void switchActivities(Container newActivitie) { + content.removeAll(); + //content.add(menuPanel, BorderLayout.WEST); + add(newActivitie, BorderLayout.CENTER); + revalidate(); + repaint(); + + } +} diff --git a/src/main/java/com/mycompany/groupe_05/Groupe_05.java b/src/main/java/com/mycompany/groupe_05/Groupe_05.java index 585e8f53a4c05dc9284e1a22a7e60090bedd461c..762bfc93df875de886451e2202f1f56231468279 100644 --- a/src/main/java/com/mycompany/groupe_05/Groupe_05.java +++ b/src/main/java/com/mycompany/groupe_05/Groupe_05.java @@ -1,10 +1,9 @@ package com.mycompany.groupe_05; -import beans.Drawing; - public class Groupe_05 { public static void main(String[] args) { - Drawing Draw = new Drawing(); + ContentFrame content = new ContentFrame(); } + } diff --git a/src/main/java/com/mycompany/groupe_05/TestFrame.java b/src/main/java/com/mycompany/groupe_05/TestFrame.java new file mode 100644 index 0000000000000000000000000000000000000000..a03ee5d5c2ee5d9f6bd2ee749c684d640cbc7277 --- /dev/null +++ b/src/main/java/com/mycompany/groupe_05/TestFrame.java @@ -0,0 +1,34 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.mycompany.groupe_05; + +import gui.QuestionsGui; +import javax.swing.JFrame; +import javax.swing.JPanel; + +/** + * + * @author stag + */ +public class TestFrame extends JFrame { + + private static final long serialVersionUID = 1L; + JPanel qPane = new QuestionsGui(); + + public TestFrame() { + this.initGui(); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setResizable(true); + this.pack(); + //this.setSize(600, 600); + this.setLocationRelativeTo(null); + this.setVisible(true); + } + + private void initGui() { + this.add(qPane); + this.setContentPane(qPane); + } +} diff --git a/src/main/java/dao/Dao.java b/src/main/java/dao/Dao.java new file mode 100644 index 0000000000000000000000000000000000000000..1d95ae5f3ae9455fc7a4b0ad990bec81a33734d2 --- /dev/null +++ b/src/main/java/dao/Dao.java @@ -0,0 +1,47 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template + */ +package dao; + +import java.util.Collection; + +/** + * Interface CRUD sur le stockage des données + * @author Clément GROSSELLE + * @param La classe + */ +public interface Dao { + + /** + * Retourne l'objet lu en DB grâce à son identifiant ou null. + * @param id L'identifiant en DB de l'objet + * @return L'objet ou null + */ + T find(int id); + + /** + * Hydrate la DB avec l'objet fourni. Cet objet doit avoir un id null. + * @param obj + */ + void create(T obj); + + /** + * Supprime la ligne d'identifiant id dans la DB. + * @param id + */ + void delete(int id); + + /** + * Met à jour l'objet dans la DB. L'objet doit avoir un id non null. + * @param obj + */ + void update(T obj); + + /** + * Retourne toutes les lignes de la DB dans une collection. + * @return Collection contenant tous les objets hydratés par la DB. + */ + Collection all(); + +} diff --git a/src/main/java/dao/DaoQuestion.java b/src/main/java/dao/DaoQuestion.java new file mode 100644 index 0000000000000000000000000000000000000000..51f7d2b517c47f7da62b22b76ed0fc60b0c4f864 --- /dev/null +++ b/src/main/java/dao/DaoQuestion.java @@ -0,0 +1,109 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package dao; + +import beans.Question; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import sql.MariaDbConnection; + +/** + * + * @author Clément GROSSELLE + */ +public class DaoQuestion implements Dao { + + private final Connection connect = MariaDbConnection.getInstance(); + + private Question createBean(ResultSet rs) { + Question obj = new Question(); + try { + obj.setLevel(rs.getInt("level")); + obj.setStatement(rs.getString("statement")); + obj.setAnswer(rs.getString("answer")); + } catch (SQLException ex) { + System.out.println("Impossible de parcourir le resultSet" + ex.getMessage()); + } + return obj; + } + + @Override + public Question find(int id) { + Question q = null; + String sql = "SELECT * FROM questions WHERE id=?"; + try (PreparedStatement pstmt = connect.prepareStatement(sql)) { + pstmt.setInt(1, id); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) { + q = createBean(rs); + } + } catch (SQLException ex) { + throw new RuntimeException("Recherche impossible dans la table questions" + ex.getMessage()); + } + return q; + } + + @Override + public void create(Question obj) { + String sql = "INSERT INTO questions (level, statement, answer) VALUES (?, ?, ?)"; + try (PreparedStatement pstmt = connect.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS)) { + pstmt.setInt(1, obj.getLevel()); + pstmt.setString(2, obj.getStatement()); + pstmt.setString(3, obj.getAnswer()); + pstmt.executeUpdate(); + ResultSet keys = pstmt.getGeneratedKeys(); + if (keys.next()) { + obj.setId(keys.getInt(1)); + } + } catch (SQLException ex) { + throw new RuntimeException("Insertion impossible dans la table questions\t Message: " + ex.getMessage()); + } + } + + @Override + public void delete(int id) { + String sql = "DELETE FROM questions WHERE id=?"; + try (PreparedStatement pstmt = connect.prepareStatement(sql)) { + pstmt.setInt(1, id); + pstmt.executeUpdate(); + } catch (SQLException ex) { + throw new RuntimeException("Suppression impossible dans la table questions" + ex.getMessage()); + } + } + + @Override + public void update(Question obj) { + String sql = "UPDATE questions SET level=?, statement=?, answer=? WHERE id=?"; + try (PreparedStatement pstmt = connect.prepareStatement(sql)) { + pstmt.setInt(1, obj.getLevel()); + pstmt.setString(2, obj.getStatement()); + pstmt.setString(3, obj.getAnswer()); + pstmt.setInt(4, obj.getId()); + pstmt.executeUpdate(); + } catch (SQLException ex) { + throw new RuntimeException("Update impossible dans la table questions" + ex.getMessage()); + } + } + + @Override + public Collection all() { + Collection list = new ArrayList<>(); + String sql = "SELECT * FROM questions"; + try (PreparedStatement pstmt = connect.prepareStatement(sql)) { + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + list.add(createBean(rs)); + } + } catch (SQLException ex) { + System.out.println("Récupération impossible de la table questions" + ex.getMessage()); + } + return list; + } + +} diff --git a/src/main/java/gui/MainMenu.java b/src/main/java/gui/MainMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..17b787c3347b369f5fdd13a2f3616e5fa44731d1 --- /dev/null +++ b/src/main/java/gui/MainMenu.java @@ -0,0 +1,77 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package gui; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; + +/** + * + * @author stag + */ +public class MainMenu extends JPanel { + + private JLabel menuLabel; + private JPanel topMenuPanel; + private JButton drawButton, mathButton, questButton, hideButton; + + public MainMenu() { + initGui(); + initEvent(); + + } + + private void initEvent() { + } + + private void initGui() { + + topMenuPanel = new JPanel(new BorderLayout()); + menuLabel = new JLabel("Menu Principal"); + menuLabel.setHorizontalAlignment(JLabel.CENTER); + menuLabel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); + hideButton = new JButton("<"); + hideButton.setPreferredSize(new Dimension(30, 30)); + topMenuPanel.add(menuLabel, BorderLayout.CENTER); + topMenuPanel.add(hideButton, BorderLayout.NORTH); + + drawButton = new JButton("Ardoise Magique"); + mathButton = new JButton("Test de maths"); + questButton = new JButton("Culture générale"); + + setLayout(new GridLayout(0, 1)); + //menuPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + + add(topMenuPanel); + add(drawButton); + add(mathButton); + add(questButton); + + setPreferredSize(new Dimension(200, getHeight())); + } + + public JButton getDrawButton() { + return drawButton; + } + + public JButton getMathButton() { + return mathButton; + } + + public JButton getQuestButton() { + return questButton; + } + + public JButton getHideButton() { + return hideButton; + } + +} diff --git a/src/main/java/gui/QuestionsGui.java b/src/main/java/gui/QuestionsGui.java new file mode 100644 index 0000000000000000000000000000000000000000..0becab004b09b8f94dac912dce7eb76c646223f9 --- /dev/null +++ b/src/main/java/gui/QuestionsGui.java @@ -0,0 +1,206 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package gui; + +import beans.Question; +import dao.DaoQuestion; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.text.Normalizer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Random; +import javax.swing.AbstractAction; +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.KeyStroke; + +/** + * + * @author Clément GROSSELLE + */ +public class QuestionsGui extends JPanel { + + private static final long serialVersionUID = 1L; + + JPanel questionsPane, statmentPane, helpPane, answerPane, buttonsPane; + JLabel sLabel, aLabel, hLabel; + JTextField atf; + JButton confirmButton, showButton, nextButton; + Question q = new Question(); + Collection qlist = new ArrayList<>(); + Font labelFont = new Font(Font.SANS_SERIF, Font.BOLD, 20); + Font helpFont = new Font(Font.SANS_SERIF, Font.ITALIC, 12); + Font buttonFont = new Font(Font.SANS_SERIF, Font.PLAIN, 15); + Font textFieldFont = new Font(Font.SANS_SERIF, Font.PLAIN, 20); + + public QuestionsGui() { + qlist = initQuestion(); + //System.out.println("qlist: " + qlist); + q = selectRandomQuestion((ArrayList) qlist); + + // Initialisation des panneaux et composants + questionsPane = new JPanel(); + statmentPane = new JPanel(); + helpPane = new JPanel(); + answerPane = new JPanel(); + buttonsPane = new JPanel(); + + confirmButton = new JButton("Valider réponse"); + showButton = new JButton("Afficher réponse"); + nextButton = new JButton("Question suivante"); + + // Config labels: + // Question + sLabel = new JLabel(q.getStatement()); + sLabel.setFont(labelFont); + sLabel.setHorizontalAlignment(JLabel.CENTER); + + // Aide + hLabel = new JLabel(" ", JLabel.CENTER); + hLabel.setFont(helpFont); + hLabel.setHorizontalAlignment(JLabel.CENTER); + + // Réponse + aLabel = new JLabel("Saisissez votre réponse", JLabel.CENTER); + aLabel.setFont(helpFont); + aLabel.setHorizontalAlignment(JLabel.CENTER); + + atf = new JTextField(5); + + // Paramétrage des dfférentes font + confirmButton.setFont(buttonFont); + showButton.setFont(buttonFont); + nextButton.setFont(buttonFont); + atf.setFont(textFieldFont); + + initGui(); + initEvent(); + + } + + private void initGui() { + // Layout + questionsPane.setLayout(new BorderLayout()); + answerPane.setLayout(new BoxLayout(answerPane, BoxLayout.Y_AXIS)); + + //Size + statmentPane.setPreferredSize(new Dimension(600, 50)); + helpPane.setPreferredSize(new Dimension(200, 50)); + + //Ajout des composants + //Question + statmentPane.add(sLabel); + //Aide + helpPane.add(hLabel); + //Saisie utilisateur + answerPane.add(aLabel); + answerPane.add(atf); + //Boutons + buttonsPane.add(confirmButton); + buttonsPane.add(showButton); + buttonsPane.add(nextButton); + + // Panneau principal de l'activité + questionsPane.add(statmentPane, BorderLayout.NORTH); + questionsPane.add(helpPane, BorderLayout.CENTER); + questionsPane.add(answerPane, BorderLayout.CENTER); + questionsPane.add(buttonsPane, BorderLayout.SOUTH); + + // Pas sur pour ça + this.add(questionsPane); + } + + private void initEvent() { + // Méthode validation réponse, clic confirmButton ou Enter + AbstractAction confirmAction = new AbstractAction() { + @Override + public void actionPerformed(ActionEvent ae) { + if (compareStrings(atf.getText(), q.getAnswer())) { + //Pop-up validé + System.out.println("oui"); + hLabel.setText("Bravo, tu as trouvé la bonne réponse!"); + changeQuestion(); + atf.setText(""); + } else { + System.out.println("nop"); + hLabel.setText("Oh non c'est raté! Essaye encore."); + } + } + }; + //Association au boutton confirm + confirmButton.addActionListener(confirmAction); + // Et à la touche entrée + atf.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "confirm"); + atf.getActionMap().put("confirm", confirmAction); + + // Clic boutton afficher réponse + showButton.addActionListener((ActionEvent ae) -> { + System.out.println("bouton afficher"); + hLabel.setText("La réponse attendue est :\n " + q.getAnswer()); + }); + + // Clic bouton suivant + nextButton.addActionListener((ActionEvent ae) -> { + hLabel.setText(""); + System.out.println("bouton suivant\n Nombre de questions restantes:" + qlist.size()); + if (!qlist.isEmpty()) { + // Si il reste des question dans la liste, on passe à la suivante + changeQuestion(); + } else { + // Sinon on réinjecte les questions de la bdd et zérapatis + qlist = initQuestion(); + changeQuestion(); + } + }); + } + + private Collection initQuestion() { + DaoQuestion daoq = new DaoQuestion(); + return daoq.all(); + } + + private Question selectRandomQuestion(ArrayList qlist) { + Random randGen = new Random(); + //Question q = new Question(); + int rand = randGen.nextInt(qlist.size()); + q = qlist.get(rand); + try { + qlist.remove(rand); + } catch (IllegalArgumentException iae) { + throw new IllegalArgumentException("La liste des question est vide"); + } + return q; + } + + private String removeAccents(String text) { + if (text == null) { + return null; + } + String replaceAll = Normalizer.normalize(text, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); + return replaceAll; + } + + private boolean compareStrings(String inString, String ansString) { + inString = inString.toLowerCase(); + ansString = ansString.toLowerCase(); + inString = removeAccents(inString); + return inString.equals(ansString); + } + + private void changeQuestion() { + q = selectRandomQuestion((ArrayList) qlist); + sLabel.setText(q.getStatement()); + } + +} diff --git a/src/main/java/sql/MariaDbConnection.java b/src/main/java/sql/MariaDbConnection.java new file mode 100644 index 0000000000000000000000000000000000000000..736e7f2c9c033fc303a5d181d4cb3fb300e01dec --- /dev/null +++ b/src/main/java/sql/MariaDbConnection.java @@ -0,0 +1,77 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package sql; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Clément GROSSELLE + */ +public class MariaDbConnection { + + private static Connection instance; + + public MariaDbConnection() { + } + + public static Connection getInstance() throws RuntimeException { + if (instance == null) { + Properties config = getConfig(); + try { + Class.forName("org.mariadb.jdbc.Driver"); + } catch (ClassNotFoundException ex) { + throw new RuntimeException("Driver introuvable"); + } + String server = config.getProperty("server"); + String port = config.getProperty("port"); + String dbname = config.getProperty("dbname"); + String url = "jdbc:mariadb://" + server + ":" + port + "/" + dbname; + try { + instance = DriverManager.getConnection(url, config); + } catch (SQLException ex) { + throw new RuntimeException("Connection à la base de donnée impossible\t Message:" + ex.getMessage()); + } + } + return instance; + } + + private static Properties getConfig() { + Properties config = new Properties(); + try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("db.properties")) { + config.load(is); + } catch (FileNotFoundException ex) { + throw new RuntimeException("Fichier de paramétrage inexistant"); + } catch (IOException ex) { + throw new RuntimeException("Fichier de paramétrage illisible"); + } + return config; + } + + public static void closeConnection() { + if (instance != null) { + try { + instance.close(); + } catch (SQLException ex) { + Logger.getLogger(MariaDbConnection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + + public static void main(String[] args) { + getInstance(); + closeConnection(); + + } + +} diff --git a/src/main/resources/db.properties b/src/main/resources/db.properties new file mode 100644 index 0000000000000000000000000000000000000000..985af6abe1faa0d9b49cb1df796f025af59f9264 --- /dev/null +++ b/src/main/resources/db.properties @@ -0,0 +1,5 @@ +server=wp.ldnr.fr +port=3306 +dbname=cda202401_jse_g5 +user=cda202401_jse_g5 +password=n3z3XS9y9z8jZOnB diff --git a/src/main/resources/db.sql b/src/main/resources/db.sql new file mode 100644 index 0000000000000000000000000000000000000000..a7ad42b41c0ffa883c499f75b3caca17bac8c1fb --- /dev/null +++ b/src/main/resources/db.sql @@ -0,0 +1,77 @@ +-- phpMyAdmin SQL Dump +-- version 4.9.6 +-- https://www.phpmyadmin.net/ +-- +-- Hôte : localhost +-- Généré le : jeu. 19 sep. 2024 à 12:14 +-- Version du serveur : 10.1.48-MariaDB-0+deb9u2 +-- Version de PHP : 7.4.33 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Base de données : `cda202401_jse_g5` +-- + +-- -------------------------------------------------------- + +-- +-- Structure de la table `questions` +-- + +CREATE TABLE `questions` ( + `id` int(11) NOT NULL, + `level` int(11) NOT NULL, + `statement` text NOT NULL, + `answer` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- +-- Déchargement des données de la table `questions` +-- + +INSERT INTO `questions` (`id`, `level`, `statement`, `answer`) VALUES +(1, 1, 'Combien y a-t-il de doigts sur une main?', 'Cinq'), +(2, 1, 'De quelle couleur est le ciel?', 'Bleu'), +(3, 1, 'De quelle couleur est le cheval blanc d\'Henry IV?', 'Blanc'), +(4, 1, 'Quel animal fait miaou?', 'Chat'), +(5, 1, 'De quelle couleur est une tomate bien mûre?', 'Rouge'), +(6, 1, 'Combien y a-t-il de saisons dans une année?', 'Quatre'), +(7, 1, 'Combien de côtés a un carré?', 'Quatre'), +(8, 1, 'Quelle est la couleur de l\'herbe?', 'Verte'), +(13, 1, 'Quel est le meilleur formateur?', 'Herbert'), +(15, 1, 'Quel est le meilleur formateur?', 'Herbert'); + +-- +-- Index pour les tables déchargées +-- + +-- +-- Index pour la table `questions` +-- +ALTER TABLE `questions` + ADD PRIMARY KEY (`id`); + +-- +-- AUTO_INCREMENT pour les tables déchargées +-- + +-- +-- AUTO_INCREMENT pour la table `questions` +-- +ALTER TABLE `questions` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/src/test/java/dao/DaoQuestionTest.java b/src/test/java/dao/DaoQuestionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..323ee8b52510dc5c69941bd35b67a6655c7b4749 --- /dev/null +++ b/src/test/java/dao/DaoQuestionTest.java @@ -0,0 +1,59 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package dao; + +import beans.Question; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; + +/** + * + * @author CLément GROSSELLE + */ +public class DaoQuestionTest { + + public DaoQuestionTest() { + } + + @Test + public void testAllCrudMethods() { + DaoQuestion daoq = new DaoQuestion(); + Question q = new Question(); + + System.out.println("Test de la méthode find"); + assertDoesNotThrow(() -> daoq.find(1)); + assertNotNull(daoq.find(1)); + assertNull(daoq.find(0)); + + System.out.println("Test de la méthode create"); + q.setStatement("test"); + q.setAnswer("test"); + q.setLevel(100); + assertDoesNotThrow(() -> daoq.create(q)); + assertNotNull(q.getId()); + + System.out.println("Test de la méthode update"); + q.setStatement("pouet"); + q.setAnswer("pouet"); + q.setLevel(50); + assertDoesNotThrow(() -> daoq.update(q)); + assertEquals("pouet", daoq.find(q.getId()).getStatement()); + assertEquals("pouet", daoq.find(q.getId()).getAnswer()); + assertEquals(50, daoq.find(q.getId()).getLevel()); + + System.out.println("Test de la méthode delete"); + assertDoesNotThrow(() -> daoq.delete(q.getId())); + assertNull(daoq.find(q.getId())); + } + + @Test + public void testAll() { + DaoQuestion daoq =new DaoQuestion(); + System.out.println("Test de la méthode all"); + assertDoesNotThrow(() -> daoq.all()); + assertEquals(daoq.all().size(), 8); + } + +} diff --git a/target/classes/beans/Drawing$DrawArea$1.class b/target/classes/beans/Drawing$DrawArea$1.class index aab4a789bc4bb9af8738a9261368f6a92a95c755..2239d545ab2f88aad207e903b8058500bdd437e6 100644 Binary files a/target/classes/beans/Drawing$DrawArea$1.class and b/target/classes/beans/Drawing$DrawArea$1.class differ diff --git a/target/classes/beans/Drawing$DrawArea$2.class b/target/classes/beans/Drawing$DrawArea$2.class index 2b7cb82cf89d26d2d7ebf92c6fcf99d32116f1b1..fcf52034f496a09d12fb88df37924e9b24729e18 100644 Binary files a/target/classes/beans/Drawing$DrawArea$2.class and b/target/classes/beans/Drawing$DrawArea$2.class differ diff --git a/target/classes/beans/Drawing$DrawArea.class b/target/classes/beans/Drawing$DrawArea.class index bc680f548466c89767dc8482fb959d77c57556a6..f5fcea423cf19a0fe6f7f506d5c7ed81c7c871a9 100644 Binary files a/target/classes/beans/Drawing$DrawArea.class and b/target/classes/beans/Drawing$DrawArea.class differ diff --git a/target/classes/beans/Drawing.class b/target/classes/beans/Drawing.class index 2d5c035e5297ff58be8442112dff9ea4e8db5288..7f27ae2097e4af77efd5db3137274ea74deccc5c 100644 Binary files a/target/classes/beans/Drawing.class and b/target/classes/beans/Drawing.class differ diff --git a/target/classes/com/mycompany/groupe_05/Groupe_05.class b/target/classes/com/mycompany/groupe_05/Groupe_05.class index c9e5944b6eb377556cd6227f25cdd9a55597c646..a0eeebeb114dc683503b8f3fdb516b4ab30e50c9 100644 Binary files a/target/classes/com/mycompany/groupe_05/Groupe_05.class and b/target/classes/com/mycompany/groupe_05/Groupe_05.class differ diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 9c60d4097c87b6494d5133e167ecf0829f0bda84..3d7cd2b109e43db04d414ea388955ff664ee857c 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,4 +1,18 @@ -beans/Substraction.class -Calcul/Main.class -Calcul/TestCalcul.class +beans/Drawing$DrawArea$1.class +com/mycompany/groupe_05/TestFrame.class +dao/Dao.class +beans/Drawing$DrawArea$2.class +Calcul/Calcul.class +gui/QuestionsGui.class +beans/Drawing$DrawArea.class +gui/QuestionsGui$1.class beans/Addition.class +sql/MariaDbConnection.class +com/mycompany/groupe_05/ContentFrame.class +beans/Question.class +beans/Drawing.class +Calcul/Main.class +gui/MainMenu.class +com/mycompany/groupe_05/Groupe_05.class +dao/DaoQuestion.class +beans/Substraction.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index f66af9686ffa6c91cc0fc1cf2fab8739022c469d..3b4b7a09d7aa7ec5414f7fd3009fae5ed1ce5c2c 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,4 +1,14 @@ -/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/02_Calcul/Activite_calcul/src/main/java/beans/Addition.java -/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/02_Calcul/Activite_calcul/src/main/java/beans/Substraction.java -/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/02_Calcul/Activite_calcul/src/main/java/Calcul/Main.java -/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/02_Calcul/Activite_calcul/src/main/java/Calcul/TestCalcul.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/beans/Substraction.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/sql/MariaDbConnection.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/gui/MainMenu.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/com/mycompany/groupe_05/Groupe_05.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/gui/QuestionsGui.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/com/mycompany/groupe_05/TestFrame.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/dao/DaoQuestion.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/Calcul/Calcul.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/beans/Question.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/beans/Drawing.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/com/mycompany/groupe_05/ContentFrame.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/Calcul/Main.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/dao/Dao.java +/home/stag/Documents/JSE/Exos/projet_Activités/projet_groupe05/src/main/java/beans/Addition.java