aboutsummaryrefslogtreecommitdiff
path: root/src/com.example.portfolio2/com/example/portfolio2/Window.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com.example.portfolio2/com/example/portfolio2/Window.java')
-rw-r--r--src/com.example.portfolio2/com/example/portfolio2/Window.java35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/com.example.portfolio2/com/example/portfolio2/Window.java b/src/com.example.portfolio2/com/example/portfolio2/Window.java
index 94c5609..36be369 100644
--- a/src/com.example.portfolio2/com/example/portfolio2/Window.java
+++ b/src/com.example.portfolio2/com/example/portfolio2/Window.java
@@ -48,8 +48,11 @@ public final class Window extends Application {
/// Storage model
private Database store = new Database();
+ /// UI model
+ private UI ui = new GUI();
+
/// Application controller
- private Controller con = new Controller(store, this);
+ private Controller con = new Controller(store, ui, this);
@Override
public void start(final Stage stage) throws IOException {
@@ -58,10 +61,10 @@ public final class Window extends Application {
// define list of columns based on their names
List<ActivityColumn> columns = List.of(
- new ActivityColumn("Program"),
- new ActivityColumn("Subject 1"),
- new ActivityColumn("Subject 2"),
- new ActivityColumn("Elective")
+ new ActivityColumn(UI.Section.PROGRAM),
+ new ActivityColumn(UI.Section.SUBJECT1),
+ new ActivityColumn(UI.Section.SUBJECT2),
+ new ActivityColumn(UI.Section.ELECTIVE)
);
// define button functionality for each activity column
@@ -86,8 +89,8 @@ public final class Window extends Application {
});
// handle each category box
- switch (col.name) {
- case "Program" -> {
+ switch (col.section) {
+ case UI.Section.PROGRAM -> {
col.categoryCombo.getItems().addAll(
"HumTek", "NatBach");
col.categoryCombo.setOnAction(event -> {
@@ -98,7 +101,7 @@ public final class Window extends Application {
});
}
// TODO: use the list for filling the box
- case "Subject 1" -> {
+ case UI.Section.SUBJECT1 -> {
col.categoryCombo.getItems().addAll(
"Computer Science",
"Informatik",
@@ -114,7 +117,7 @@ public final class Window extends Application {
col.area);
});
}
- case "Subject 2" -> {
+ case UI.Section.SUBJECT2 -> {
col.categoryCombo.getItems().addAll(
"Computer Science",
"Informatik",
@@ -131,7 +134,7 @@ public final class Window extends Application {
col.area);
});
}
- case "Elective" -> {
+ case UI.Section.ELECTIVE -> {
// hide useless box
col.categoryCombo.setVisible(false);
@@ -164,14 +167,14 @@ public final class Window extends Application {
/// column of activities
///
- /// @param name identifier stored in the text felt
+ /// @param section structural section for column
/// @param nameLabel display text
/// @param categoryCombo dropdown list for categories
/// @param activitySelect dropdown list for activities
/// @param area description of chosen activities
/// @param ectsLabel text to display ECTS points
private record ActivityColumn(
- String name,
+ UI.Section section,
Label nameLabel,
ComboBox<String> categoryCombo,
ComboBox<String> activitySelect,
@@ -181,11 +184,11 @@ public final class Window extends Application {
/// column of activities
///
- /// @param name identifier
- public ActivityColumn(String name) {
+ /// @param section structural section for column
+ public ActivityColumn(UI.Section section) {
this(
- name,
- new Label(name),
+ section,
+ new Label(section.label),
new ComboBox<>(),
new ComboBox<>(),
new TextArea(),