summaryrefslogtreecommitdiff
path: root/src/com.example.portfolio2/com/example/portfolio2/Window.java
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-04-30 13:40:58 +0200
committerJonas Smedegaard <dr@jones.dk>2025-04-30 13:40:58 +0200
commit19584cfa12e80bd32e686c8da416aaec9aa063b9 (patch)
tree9d5a30810eb6fef9a5795308d16290de78dd7f76 /src/com.example.portfolio2/com/example/portfolio2/Window.java
parentf31de856243141d6533d53c0065aefd32fa31b4d (diff)
improve separation of concerns between view and controller
Diffstat (limited to 'src/com.example.portfolio2/com/example/portfolio2/Window.java')
-rw-r--r--src/com.example.portfolio2/com/example/portfolio2/Window.java41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/com.example.portfolio2/com/example/portfolio2/Window.java b/src/com.example.portfolio2/com/example/portfolio2/Window.java
index d3e2b06..774b012 100644
--- a/src/com.example.portfolio2/com/example/portfolio2/Window.java
+++ b/src/com.example.portfolio2/com/example/portfolio2/Window.java
@@ -100,9 +100,8 @@ public final class Window extends Application {
"HumTek", "NatBach");
col.categoryCombo.setOnAction(event -> {
con.onCategorySelected(
- col.categoryCombo.getValue(),
- col.activitySelect,
- col.area);
+ col.section,
+ col.categoryCombo.getValue());
});
}
// TODO: use the list for filling the box
@@ -118,9 +117,8 @@ public final class Window extends Application {
GUI.Section.SUBJECT2.column)
.categoryCombo);
con.onCategorySelected(
- col.categoryCombo.getValue(),
- col.activitySelect,
- col.area);
+ col.section,
+ col.categoryCombo.getValue());
});
}
case GUI.Section.SUBJECT2 -> {
@@ -136,9 +134,8 @@ public final class Window extends Application {
GUI.Section.SUBJECT1.column)
.categoryCombo);
con.onCategorySelected(
- col.categoryCombo.getValue(),
- col.activitySelect,
- col.area);
+ col.section,
+ col.categoryCombo.getValue());
});
}
case GUI.Section.ELECTIVE -> {
@@ -219,4 +216,30 @@ public final class Window extends Application {
ectsLabel);
}
}
+
+ /// populate activities for a category
+ ///
+ /// @param section structural section to operate on
+ /// @param activities activities to apply as string
+ public void setOptions(
+ final GUI.Section section, final List<String> activities
+ ) {
+
+ // clear the activity selection box
+ columns.get(section.column).activitySelect
+ .getItems().clear();
+
+ // fill activity box from data in store
+ columns.get(section.column).activitySelect
+ .getItems().addAll(activities);
+ }
+
+ /// remove selections from a category
+ ///
+ /// @param section structural section to operate on
+ public void clearSelections(final GUI.Section section) {
+
+ // clear text area
+ columns.get(section.column).area.clear();
+ }
}