buttons = buttonGroup.getElements(); buttons.hasMoreElements(); ) {
+ AbstractButton button = buttons.nextElement();
+ if (button.isSelected()) {
+ return button.getText();
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/src/view/StrategyWindow.java b/src/view/StrategyWindow.java
new file mode 100644
index 0000000..3eedb99
--- /dev/null
+++ b/src/view/StrategyWindow.java
@@ -0,0 +1,24 @@
+package view;
+
+import javax.swing.*;
+import java.awt.*;
+import java.io.Serial;
+
+public class StrategyWindow extends JFrame {
+ @Serial
+ private static final long serialVersionUID = 1L;
+ private static final String WINDOW_TITLE = "Sélectionnez votre stratégie de vente";
+ private static final Dimension DIMENSION = new Dimension(250, 100);
+
+ private final StrategyPanel strategyPanel = new StrategyPanel();
+
+ public StrategyWindow() {
+ add(strategyPanel);
+ setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+ setTitle(WINDOW_TITLE);
+ setSize(DIMENSION);
+ setVisible(true);
+ setLocationRelativeTo(null);
+ setResizable(false);
+ }
+}
diff --git a/src/view/WindowMenu.java b/src/view/WindowMenu.java
new file mode 100644
index 0000000..9791372
--- /dev/null
+++ b/src/view/WindowMenu.java
@@ -0,0 +1,99 @@
+package view;
+
+import javax.swing.*;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import javax.swing.filechooser.FileSystemView;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.Serial;
+
+public class WindowMenu extends JMenuBar {
+ @Serial
+ private static final long serialVersionUID = 1L;
+ private static final String MENU_FILE_TITLE = "Fichier";
+ private static final String MENU_FILE_LOAD = "Charger";
+ private static final String MENU_FILE_EXIT = "Quitter";
+ private static final String MENU_SIMULATION_TITLE = "Simulation";
+ private static final String MENU_SIMULATION_CHOOSE = "Choisir";
+ private static final String MENU_HELP_TITLE = "Aide";
+ private static final String MENU_HELP_ABOUT = "À propos de...";
+
+ public WindowMenu() {
+ addFileMenu();
+ addSimulationMenu();
+ addHelpMenu();
+ }
+
+ /**
+ * Créer le menu de fichier.
+ */
+ private void addFileMenu() {
+ JMenu fileMenu = new JMenu(MENU_FILE_TITLE);
+ JMenuItem loadMenu = new JMenuItem(MENU_FILE_LOAD);
+ JMenuItem exitMenu = new JMenuItem(MENU_FILE_EXIT);
+
+ loadMenu.addActionListener((ActionEvent e) -> {
+ JFileChooser fileChooser = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());
+ fileChooser.setDialogTitle("Sélectionnez un fichier de configuration");
+ fileChooser.setAcceptAllFileFilterUsed(false);
+ // Créer un filtre
+ FileNameExtensionFilter filter = new FileNameExtensionFilter(".xml", "xml");
+ fileChooser.addChoosableFileFilter(filter);
+
+ int returnValue = fileChooser.showOpenDialog(null);
+ if (returnValue == JFileChooser.APPROVE_OPTION) {
+ // TODO - Parser le fichier XML sélectionné
+ File selectedFile = fileChooser.getSelectedFile();
+ System.out.println(selectedFile.getAbsoluteFile());
+ }
+ });
+
+ exitMenu.addActionListener((ActionEvent e) -> {
+ System.exit(0);
+ });
+
+ fileMenu.add(loadMenu);
+ fileMenu.add(exitMenu);
+
+ add(fileMenu);
+ }
+
+ /**
+ * Créer le menu de simulation.
+ */
+ private void addSimulationMenu() {
+ JMenu simulationMenu = new JMenu(MENU_SIMULATION_TITLE);
+ JMenuItem chooseMenu = new JMenuItem(MENU_SIMULATION_CHOOSE);
+
+ chooseMenu.addActionListener((ActionEvent e) -> {
+ // Ouvrir la fenêtre de sélection
+ // TODO - Récupérer la bonne stratégie de vente
+ new StrategyWindow();
+ });
+
+ simulationMenu.add(chooseMenu);
+
+ add(simulationMenu);
+ }
+
+ /**
+ * Créer le menu aide.
+ */
+ private void addHelpMenu() {
+ JMenu helpMenu = new JMenu(MENU_HELP_TITLE);
+ JMenuItem aboutMenu = new JMenuItem(MENU_HELP_ABOUT);
+
+ aboutMenu.addActionListener((ActionEvent e) -> {
+ JOptionPane.showMessageDialog(null,
+ "Application simulation une chaine de production d'avions.
" +
+ "© 2017 Ghizlane El Boussaidi
" +
+ "© 2017 Dany Boisvert
" +
+ "© 2017 Vincent Mattard
" +
+ "École de technologie supérieure
");
+ });
+
+ helpMenu.add(aboutMenu);
+
+ add(helpMenu);
+ }
+}