From 1056dd2c7964de7d5032c1a2c7481f327f6cb8b2 Mon Sep 17 00:00:00 2001 From: MAMBILA TETE jean philipp <@mambilat> Date: Sun, 5 May 2024 12:58:03 +0200 Subject: [PATCH] [docs] javadoc gui --- .../java/fr/u_paris/gla/project/gui/View.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) 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 index 6ed68bf..d3cb19e 100644 --- a/src/main/java/fr/u_paris/gla/project/gui/View.java +++ b/src/main/java/fr/u_paris/gla/project/gui/View.java @@ -364,6 +364,9 @@ public class View extends JFrame { }); } + /** + * @param schedules + */ private void createHourWindow(ArrayList schedules) { JFrame frame = new JFrame("Schedule"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); @@ -396,6 +399,11 @@ public class View extends JFrame { frame.setResizable(false); } + /** Used to select a departure/arrival stop in the "Network" section, UNUSED + * @param table the table that displays the stops + * @param x x coordinate of mouse click + * @param y y coordinate of mouse click + */ 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 @@ -421,6 +429,9 @@ public class View extends JFrame { } } + /** Load all stops related to coordinates + * @param stops a String in format (x1,y1);(x2,y2) + */ public void LoadStringCoords(String stops){ System.out.println(stops); stops = stops.replaceAll("[()]", "").replaceAll(";", ","); @@ -434,6 +445,9 @@ public class View extends JFrame { } + /** Load all stops related to locations + * @param stops a String in format name1;name2 + */ public void LoadStringStops(String stops){ String[] stops_array = stops.split(";"); double[] coords = new double[4]; @@ -449,7 +463,10 @@ public class View extends JFrame { } - + /** Load a list of stops to display (used for selecting a departure and arrival stop, W.I.P) + * @param stops the stops list + * @param model the JTable model that will store them + */ public void LoadSearchResult(ArrayList stops, DefaultTableModel model) { // Clear existing rows from the table int cols = model.getColumnCount(); @@ -484,6 +501,11 @@ public class View extends JFrame { NetworkPanel.repaint(); } + /** + * Function that takes a list of paths and displays it in a JTabke + * @param paths the list of paths (from one stop to another) + * @param model the TableModel that stores the Table's data + */ public void LoadSearchResultItinerary(ArrayList paths, DefaultTableModel model){ // Clear existing rows from the table int cols = model.getColumnCount(); @@ -530,6 +552,9 @@ public class View extends JFrame { this.displayTableValues(model); } + /** Takes a table's data as argument and displays it + * @param mod the table's data + */ public void displayTableValues(TableModel mod) { for (int row = 0; row < mod.getRowCount(); row++) { for (int column = 0; column < mod.getColumnCount(); column++) { @@ -540,6 +565,9 @@ public class View extends JFrame { System.out.println(); } + /** open a URL in browser + * @param uri + */ private void openWebpage(URI uri) { Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { @@ -551,6 +579,9 @@ public class View extends JFrame { } } + /** open a URL (taken from a String) in browser + * @param url the url String + */ private void openWebpage(String url) { try { openWebpage(new URL(url).toURI());