-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrontendPlaceholder.java
More file actions
102 lines (86 loc) · 3.2 KB
/
FrontendPlaceholder.java
File metadata and controls
102 lines (86 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
public class FrontendPlaceholder extends Application implements FrontendInterface {
private static BackendPlaceholder back;
public static void setBackend(BackendPlaceholder back) {
FrontendPlaceholder.back = back;
}
public void start(Stage stage) {
Pane root = new Pane();
createAllControls(root);
Scene scene = new Scene(root, 800, 600);
stage.setScene(scene);
stage.setTitle("P2: Prototype");
stage.show();
}
public void createAllControls(Pane parent) {
createShortestPathControls(parent);
createPathListDisplay(parent);
createAdditionalFeatureControls(parent);
createAboutAndQuitControls(parent);
}
public void createShortestPathControls(Pane parent) {
Label src = new Label("Path Start Selector: Memorial Union");
src.setLayoutX(32);
src.setLayoutY(16);
parent.getChildren().add(src);
Label dst = new Label("Path End Selector: Computer Science");
dst.setLayoutX(32);
dst.setLayoutY(48);
parent.getChildren().add(dst);
Button find = new Button("Submit/Find Button");
find.setLayoutX(32);
find.setLayoutY(80);
parent.getChildren().add(find);
}
public void createPathListDisplay(Pane parent) {
Label path =
new Label(
"Results List: \n\tMemorial Union\n\tSciene Hall\n\tPyschology\n\tComputer Science" +
"\n\n" +
"Results List (with walking times):\n\tMemorial Union\n\t-(30sec)->Science Hall\n\t-(170sec)->Psychology\n\t-(45sec)->Computer Science\n\tTotal time: 4.08min"
);
path.setLayoutX(32);
path.setLayoutY(112);
parent.getChildren().add(path);
}
public void createAdditionalFeatureControls(Pane parent) {
this.createTravelTimesBox(parent);
this.createFurthestDestinationControls(parent);
}
public void createTravelTimesBox(Pane parent) {
CheckBox showTimesBox = new CheckBox("Show Walking Times");
showTimesBox.setLayoutX(200);
showTimesBox.setLayoutY(80);
parent.getChildren().add(showTimesBox);
}
public void createFurthestDestinationControls(Pane parent) {
Label locationSelector = new Label("Location Selector: Memorial Union");
locationSelector.setLayoutX(500);
locationSelector.setLayoutY(16);
parent.getChildren().add(locationSelector);
Button furthestFromButton = new Button("Find Most Distant Location");
furthestFromButton.setLayoutX(500);
furthestFromButton.setLayoutY(48);
parent.getChildren().add(furthestFromButton);
Label furthestFromLabel = new Label("Most Distance Location: Union South");
furthestFromLabel.setLayoutX(500);
furthestFromLabel.setLayoutY(80);
parent.getChildren().add(furthestFromLabel);
}
public void createAboutAndQuitControls(Pane parent) {
Button about = new Button("About");
about.setLayoutX(32);
about.setLayoutY(560);
parent.getChildren().add(about);
Button quit = new Button("Quit");
quit.setLayoutX(96);
quit.setLayoutY(560);
parent.getChildren().add(quit);
}
}