diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-28 22:49:33 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-28 22:49:33 +0200 |
commit | a701fe0f29f82cdcf445cc24f79877116ca62ca4 (patch) | |
tree | dd965ec66db85d310e832a21be59c597c34ae042 /src/com.example.portfolio2 | |
parent | 862fb85d541af579657cfdaa8db770e4c3916eaf (diff) |
rename class Model -> Database; rename variable model -> store
Diffstat (limited to 'src/com.example.portfolio2')
-rw-r--r-- | src/com.example.portfolio2/com/example/portfolio2/Controller.java | 24 | ||||
-rw-r--r-- | src/com.example.portfolio2/com/example/portfolio2/Database.java (renamed from src/com.example.portfolio2/com/example/portfolio2/Model.java) | 4 | ||||
-rw-r--r-- | src/com.example.portfolio2/com/example/portfolio2/Window.java | 6 |
3 files changed, 17 insertions, 17 deletions
diff --git a/src/com.example.portfolio2/com/example/portfolio2/Controller.java b/src/com.example.portfolio2/com/example/portfolio2/Controller.java index 2212396..2457e25 100644 --- a/src/com.example.portfolio2/com/example/portfolio2/Controller.java +++ b/src/com.example.portfolio2/com/example/portfolio2/Controller.java @@ -14,23 +14,23 @@ import java.util.List; /// Bachelorizer - Controller class Controller{ - /// Application model - private Model model; + /// Storage model + private Database store; /// Application view private Window view; /// clear the participation database at program launch void initialize() { - model.initialize(); + store.initialize(); } /// default constructor /// - /// @param model Application model + /// @param store Storage model /// @param view Application view - Controller(Model model, Window view){ - this.model=model; this.view=view; + Controller(Database store, Window view){ + this.store = store; this.view = view; } /// callback when category box is selected @@ -46,8 +46,8 @@ class Controller{ // clear text area area.clear(); - // fill activity box using model method - select.getItems().addAll(model.selectProgram(combo.getValue())); + // fill activity box from data in store + select.getItems().addAll(store.selectProgram(combo.getValue())); } /// callback when activity box is selected @@ -87,7 +87,7 @@ class Controller{ /// @param s activity identifier /// @param textArea whole text area void addActivity(String s, TextArea textArea) { - model.addParticipation(model.getActivityIndeks(s)); + store.addParticipation(store.getActivityIndeks(s)); } /// update text area for an activity box @@ -99,7 +99,7 @@ class Controller{ /// @param textArea whole text area void updateArea(ComboBox<String> combo, TextArea textArea) { textArea.clear(); - for(String s : model.getParticipation(combo.getValue())) { + for(String s : store.getParticipation(combo.getValue())) { textArea.appendText(s + "\n"); } } @@ -108,10 +108,10 @@ class Controller{ /// @param ectslabel text display area for ECTS points /// @param comboBox involved activity box void updateEcts(Label ectslabel, ComboBox<String> comboBox) { - ectslabel.setText("ECTS: "+model.getSumEcts(comboBox.getValue())); + ectslabel.setText("ECTS: "+store.getSumEcts(comboBox.getValue())); } void fillElective(ComboBox<String> electiveBox) { - electiveBox.getItems().addAll(model.getAllActivities()); + electiveBox.getItems().addAll(store.getAllActivities()); } } diff --git a/src/com.example.portfolio2/com/example/portfolio2/Model.java b/src/com.example.portfolio2/com/example/portfolio2/Database.java index 8216ccc..2712e3d 100644 --- a/src/com.example.portfolio2/com/example/portfolio2/Model.java +++ b/src/com.example.portfolio2/com/example/portfolio2/Database.java @@ -10,14 +10,14 @@ import java.util.ArrayList; /// Bachelorizer - database model /// /// This model handles all interaction with the database. -class Model{ +class Database { /// database singleton MyDB db = new MyDB(); /// default constructor // (declared explicitly only to silence javadoc) - Model(){} + Database() {} /// clear the participation database at program launch void initialize() { diff --git a/src/com.example.portfolio2/com/example/portfolio2/Window.java b/src/com.example.portfolio2/com/example/portfolio2/Window.java index 730741a..c02017b 100644 --- a/src/com.example.portfolio2/com/example/portfolio2/Window.java +++ b/src/com.example.portfolio2/com/example/portfolio2/Window.java @@ -30,11 +30,11 @@ public final class Window extends Application { public static final String LABEL_STYLE = "-fx-font-weight: bold;-fx-font-size: 18;-fx-padding: 10"; - /// Application model - private Model model = new Model(); + /// Storage model + private Database store = new Database(); /// Application controller - private Controller con = new Controller(model,this); + private Controller con = new Controller(store,this); /// database singleton MyDB myDB = new MyDB(); |