From fcebe01f1e8395a990139e8b30f99a00800421c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Thu, 2 May 2024 15:07:09 +0200 Subject: [PATCH] #29: SetAll instead of AddAll to avoid Duplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Säume --- .../de/hitec/nhplus/treatment/AllTreatmentController.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java b/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java index 919433b..c878133 100644 --- a/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java +++ b/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java @@ -77,11 +77,10 @@ public class AllTreatmentController { } public void readAllAndShowInTableView() { - this.treatments.clear(); comboBoxPatientSelection.getSelectionModel().select(0); this.dao = DaoFactory.getDaoFactory().createTreatmentDao(); try { - this.treatments.addAll(dao.readAll()); + this.treatments.setAll(dao.readAll()); } catch (SQLException exception) { exception.printStackTrace(); } @@ -109,7 +108,7 @@ public class AllTreatmentController { if (selectedPatient.equals("alle")) { try { - this.treatments.addAll(this.dao.readAll()); + this.treatments.setAll(this.dao.readAll()); } catch (SQLException exception) { exception.printStackTrace(); } @@ -118,7 +117,7 @@ public class AllTreatmentController { Patient patient = searchInList(selectedPatient); if (patient != null) { try { - this.treatments.addAll(this.dao.readTreatmentsByPid(patient.getId())); + this.treatments.setAll(this.dao.readTreatmentsByPid(patient.getId())); } catch (SQLException exception) { exception.printStackTrace(); }