[docs] javadoc gui

This commit is contained in:
MAMBILA TETE jean philipp 2024-05-05 12:58:03 +02:00
parent 7485fc492d
commit 1056dd2c79

View file

@ -364,6 +364,9 @@ public class View extends JFrame {
});
}
/**
* @param schedules
*/
private void createHourWindow(ArrayList<Integer> 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<Stop> 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<Path> 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());