diff options
Diffstat (limited to 'src/com.example.portfolio2/com/example/portfolio2/HelloApplication.java')
-rw-r--r-- | src/com.example.portfolio2/com/example/portfolio2/HelloApplication.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/com.example.portfolio2/com/example/portfolio2/HelloApplication.java b/src/com.example.portfolio2/com/example/portfolio2/HelloApplication.java index 1a79300..1fa5a62 100644 --- a/src/com.example.portfolio2/com/example/portfolio2/HelloApplication.java +++ b/src/com.example.portfolio2/com/example/portfolio2/HelloApplication.java @@ -18,9 +18,12 @@ import java.io.IOException; import java.util.List; public class HelloApplication extends Application { + // Initializing model, controller and database objects private Model model = new Model(); + private Controller con = new Controller(model,this); + MyDB myDB = new MyDB(); /* Below is the original implementation of the UI elements with @@ -84,14 +87,16 @@ public class HelloApplication extends Application { con.updateEcts(col.ectsLabel, col.categoryCombo); }); - switch (col.name) { // Switch statement handles different category boxes + // Switch statement handles different category boxes + switch (col.name) { case "Program" -> { col.categoryCombo.getItems().addAll("HumTek", "NatBach"); col.categoryCombo.setOnAction(event -> { con.onComboSelected(col.categoryCombo, col.activitySelect, col.area); }); } - case "Subject 1" -> { // We considered using the list for filling the box but couldn't figure it out + // We considered using the list for filling the box but couldn't figure it out + case "Subject 1" -> { col.categoryCombo.getItems().addAll("Computer Science", "Informatik", "Astrology"); col.categoryCombo.setOnAction(event -> { con.onSubjectModuleSelected(col.categoryCombo, columns.get(2).categoryCombo, subjectModules); @@ -100,14 +105,17 @@ public class HelloApplication extends Application { } case "Subject 2" -> { col.categoryCombo.getItems().addAll("Computer Science", "Informatik", "Astrology"); - col.categoryCombo.setOnAction(event -> { // We figured we have to specify - // the second column like this but reckon there's a better way. + // We figured we have to specify + // the second column like this but reckon there's a better way. + col.categoryCombo.setOnAction(event -> { con.onSubjectModuleSelected(col.categoryCombo, columns.get(1).categoryCombo, subjectModules); con.onComboSelected(col.categoryCombo, col.activitySelect, col.area); }); } case "Elective" -> { - col.categoryCombo.setVisible(false); // Hide useless box + + // Hide useless box + col.categoryCombo.setVisible(false); con.fillElective(col.activitySelect); } } @@ -127,6 +135,7 @@ public class HelloApplication extends Application { // Class for each column of activities private class ActivityColumn { + // Each column contains these elements String name; Label nameLabel; |