[docs] javadoc gui
This commit is contained in:
parent
7485fc492d
commit
1056dd2c79
1 changed files with 32 additions and 1 deletions
|
@ -364,6 +364,9 @@ public class View extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param schedules
|
||||||
|
*/
|
||||||
private void createHourWindow(ArrayList<Integer> schedules) {
|
private void createHourWindow(ArrayList<Integer> schedules) {
|
||||||
JFrame frame = new JFrame("Schedule");
|
JFrame frame = new JFrame("Schedule");
|
||||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
|
@ -396,6 +399,11 @@ public class View extends JFrame {
|
||||||
frame.setResizable(false);
|
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) {
|
private void showOptionsDialog(JTable table, int x, int y) {
|
||||||
int selectedRow = table.rowAtPoint(new Point(x, y));
|
int selectedRow = table.rowAtPoint(new Point(x, y));
|
||||||
if (selectedRow != -1) { // If a row is selected
|
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){
|
public void LoadStringCoords(String stops){
|
||||||
System.out.println(stops);
|
System.out.println(stops);
|
||||||
stops = stops.replaceAll("[()]", "").replaceAll(";", ",");
|
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){
|
public void LoadStringStops(String stops){
|
||||||
String[] stops_array = stops.split(";");
|
String[] stops_array = stops.split(";");
|
||||||
double[] coords = new double[4];
|
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) {
|
public void LoadSearchResult(ArrayList<Stop> stops, DefaultTableModel model) {
|
||||||
// Clear existing rows from the table
|
// Clear existing rows from the table
|
||||||
int cols = model.getColumnCount();
|
int cols = model.getColumnCount();
|
||||||
|
@ -484,6 +501,11 @@ public class View extends JFrame {
|
||||||
NetworkPanel.repaint();
|
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){
|
public void LoadSearchResultItinerary(ArrayList<Path> paths, DefaultTableModel model){
|
||||||
// Clear existing rows from the table
|
// Clear existing rows from the table
|
||||||
int cols = model.getColumnCount();
|
int cols = model.getColumnCount();
|
||||||
|
@ -530,6 +552,9 @@ public class View extends JFrame {
|
||||||
this.displayTableValues(model);
|
this.displayTableValues(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Takes a table's data as argument and displays it
|
||||||
|
* @param mod the table's data
|
||||||
|
*/
|
||||||
public void displayTableValues(TableModel mod) {
|
public void displayTableValues(TableModel mod) {
|
||||||
for (int row = 0; row < mod.getRowCount(); row++) {
|
for (int row = 0; row < mod.getRowCount(); row++) {
|
||||||
for (int column = 0; column < mod.getColumnCount(); column++) {
|
for (int column = 0; column < mod.getColumnCount(); column++) {
|
||||||
|
@ -540,6 +565,9 @@ public class View extends JFrame {
|
||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** open a URL in browser
|
||||||
|
* @param uri
|
||||||
|
*/
|
||||||
private void openWebpage(URI uri) {
|
private void openWebpage(URI uri) {
|
||||||
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
|
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
|
||||||
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
|
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) {
|
private void openWebpage(String url) {
|
||||||
try {
|
try {
|
||||||
openWebpage(new URL(url).toURI());
|
openWebpage(new URL(url).toURI());
|
||||||
|
|
Reference in a new issue