diff --git a/src/main/java/fr/u_paris/gla/project/gui/View.form b/src/main/java/fr/u_paris/gla/project/gui/View.form
new file mode 100644
index 0000000..928c8a8
--- /dev/null
+++ b/src/main/java/fr/u_paris/gla/project/gui/View.form
@@ -0,0 +1,270 @@
+
+
diff --git a/src/main/java/fr/u_paris/gla/project/gui/View.java b/src/main/java/fr/u_paris/gla/project/gui/View.java
new file mode 100644
index 0000000..e6bc8ef
--- /dev/null
+++ b/src/main/java/fr/u_paris/gla/project/gui/View.java
@@ -0,0 +1,239 @@
+package fr.u_paris.gla.project.gui;
+
+import fr.u_paris.gla.project.itinerary.Stop;
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.ArrayList;
+import java.util.stream.Collectors;
+
+public class View extends JFrame {
+ private JPanel Cardpanel;
+ private JMenuItem Home;
+ private JMenuItem Network;
+ private JMenuItem Favorites;
+ private JPanel NetworkPanel;
+ private JPanel FavoritesPanel;
+ private JTextField textField1;
+ private JButton searchButton;
+ private JPanel HomePanel;
+ private JPanel MainPanel;
+ private DefaultTableModel model;
+
+ private JTable table;
+
+ private JScrollPane mypane;
+ private JPanel ItineraryPanel;
+ private JMenuItem Itinerary;
+ private JPanel stationsPanel;
+ private JLabel departText;
+ private JLabel arrText;
+
+ private ArrayList StopList;
+
+ private String departureCur;
+
+ private String arrivalCur;
+
+ private String searchCur;
+
+ private ArrayList searchRes;
+
+ private int count = 0;
+
+
+ public View(ArrayList s) throws HeadlessException {
+ model = (DefaultTableModel) table.getModel();
+ model.setColumnCount(2);
+ model.setColumnIdentifiers(new Object[]{"Line", "Stop"});
+ this.StopList = s;
+
+
+ setContentPane(MainPanel);
+ setTitle("app");
+ setExtendedState(JFrame.MAXIMIZED_BOTH);
+ //setUndecorated(true);
+ setVisible(true);
+ ;
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ Home.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Cardpanel.removeAll();
+ Cardpanel.add(HomePanel);
+ Cardpanel.repaint();
+ Cardpanel.revalidate();
+ }
+ });
+
+ Network.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showSearch(s);
+ Cardpanel.removeAll();
+ Cardpanel.add(NetworkPanel);
+
+ Cardpanel.repaint();
+ Cardpanel.revalidate();
+ }
+ });
+
+ Favorites.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Cardpanel.removeAll();
+ Cardpanel.add(FavoritesPanel);
+ Cardpanel.repaint();
+ Cardpanel.revalidate();
+ }
+ });
+
+
+ textField1.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ super.keyReleased(e);
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+
+ searchCur = textField1.getText();
+ showSearch(s);
+ System.out.println("Enter key released with text " + searchCur);
+ Cardpanel.removeAll();
+ Cardpanel.add(NetworkPanel);
+
+ Cardpanel.repaint();
+ Cardpanel.revalidate();
+ }
+ }
+ });
+
+ searchButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Cardpanel.removeAll();
+ searchCur = textField1.getText();
+ showSearch(s);
+ System.out.println("search button clicked with text " + searchCur);
+ Cardpanel.add(NetworkPanel);
+
+ Cardpanel.repaint();
+ Cardpanel.revalidate();
+ }
+ });
+ table.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ super.mouseClicked(e);
+ System.out.println("MouseClick: " + e.getX() + ";" + e.getY());
+ showOptionsDialog(table, e.getX(), e.getY());
+
+ }
+ });
+
+
+ mypane.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ super.mouseClicked(e);
+ }
+ });
+ }
+
+ private void showOptionsDialog(JTable table, int x, int y) {
+ int selectedRow = table.rowAtPoint(new Point(x, y));
+ if (selectedRow != -1) { // If a row is selected
+
+ String stationSel = (String) table.getValueAt(selectedRow, 1);
+
+ // Options to set Departure, Arrival, or Cancel
+ Object[] options = {"Departure", "Arrival", "Cancel"};
+ int choice = JOptionPane.showOptionDialog(null, "What action would you like to perform for " + stationSel + "?", "Action Selection",
+ JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]);
+
+ // Handling the choice
+ if (choice == 0) {
+ this.departureCur = stationSel;
+ this.departText.setText("Departure: " + stationSel);
+ } else if (choice == 1) {
+ this.arrivalCur = stationSel;
+ this.arrText.setText("Arrival: " + stationSel);
+ } else {
+ System.out.println("rien");
+ }
+ System.out.println("Départ: " + this.departureCur + "; Arrivée: " + this.arrivalCur);
+ }
+ }
+
+
+
+ public static void main(String[] args) {
+ ArrayList s = new ArrayList<>();
+ s.add(new Stop("M8", "Balard", 1.0315897, 3.0265513));
+ s.add(new Stop("M14", "Gare de Lyon", 2.4658452681, 3.0265513));
+ View v = new View(s);
+
+
+ }
+
+
+
+
+ public void showSearch(ArrayList stops) {
+ // Clear existing rows from the table
+
+ model.setRowCount(0);
+ model.setColumnCount(2);
+
+
+ // Add new rows based on the search results
+ count = 0;
+ for (Stop stop : stops) {
+ // Add a row to the table with Stop's line in the first column and Stop's name in the second column
+
+ model.addRow(new Object[]{String.join(",", stop.getLines()), stop.getName()});
+ ++count;
+ }
+
+ System.out.println(stops.toString());
+ for (int i = 0; i < model.getRowCount(); i++) {
+ for (int j = 0; j < model.getColumnCount(); j++) {
+ System.out.print("valeur at coord " + i +";" + j +": " + model.getValueAt(i, j) + "\t");
+ }
+ System.out.println();
+ }
+
+ System.out.println(count);
+
+ table.revalidate();
+ table.repaint();
+
+ mypane.setViewportView(table);
+ mypane.revalidate();
+ mypane.repaint();
+
+ NetworkPanel.revalidate();
+ NetworkPanel.repaint();
+
+
+ this.displayTableValues();
+
+ }
+
+ public void displayTableValues() {
+ TableModel mod = table.getModel();
+ for (int row = 0; row < mod.getRowCount(); row++) {
+ for (int column = 0; column < mod.getColumnCount(); column++) {
+ System.out.print(mod.getValueAt(row, column).toString() + " ");
+ }
+ System.out.print(";");
+
+ }
+ System.out.println();
+
+ }
+
+}
diff --git a/src/main/java/fr/u_paris/gla/project/utils/CSVTools.java b/src/main/java/fr/u_paris/gla/project/utils/CSVTools.java
index 8fa35db..086aacb 100644
--- a/src/main/java/fr/u_paris/gla/project/utils/CSVTools.java
+++ b/src/main/java/fr/u_paris/gla/project/utils/CSVTools.java
@@ -37,7 +37,7 @@ public final class CSVTools {
throws IOException {
ICSVParser parser = new CSVParserBuilder().withSeparator(';').build();
try (Reader reader = new BufferedReader(
- new InputStreamReader(is, StandardCharsets.UTF_8))) {
+ new InputStreamReader(is, StandardCharsets.UTF_8))) {
CSVReaderBuilder csvBuilder = new CSVReaderBuilder(reader)
.withCSVParser(parser);
try (CSVReader csv = csvBuilder.build()) {