From c50ba6c068bf034d0f84ebf52642d535d0ee9b57 Mon Sep 17 00:00:00 2001 From: Louis Bruneteau <bruneteau.louis@gmail.com> Date: Sun, 15 May 2022 12:49:35 +0200 Subject: [PATCH] =?UTF-8?q?j'ai=20termin=C3=A9=20de=20ne=20pas=20avoir=20t?= =?UTF-8?q?ermin=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/encodings.xml | 1 + .idea/runConfigurations.xml | 10 -------- .../td5b/controleur/ControleurSuppression.kt | 25 ++++++++++++++++--- 3 files changed, 22 insertions(+), 14 deletions(-) delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 7499b63..942f3a2 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -2,5 +2,6 @@ <project version="4"> <component name="Encoding"> <file url="file://$PROJECT_DIR$/src/main/kotlin" charset="UTF-8" /> + <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> </component> </project> \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="RunConfigurationProducerService"> - <option name="ignoredProducers"> - <set> - <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" /> - </set> - </option> - </component> -</project> \ No newline at end of file diff --git a/src/main/kotlin/ihm/td5b/controleur/ControleurSuppression.kt b/src/main/kotlin/ihm/td5b/controleur/ControleurSuppression.kt index 1009bdc..4a1793f 100644 --- a/src/main/kotlin/ihm/td5b/controleur/ControleurSuppression.kt +++ b/src/main/kotlin/ihm/td5b/controleur/ControleurSuppression.kt @@ -4,15 +4,32 @@ import ihm.td5b.Bibliotheque import ihm.td5b.MainVue import javafx.event.ActionEvent import javafx.event.EventHandler - +import javafx.scene.control.Alert +import javafx.scene.control.ButtonType class ControleurSuppression(vue: MainVue, modele: Bibliotheque): EventHandler<ActionEvent> { - //TODO - override fun handle(event: ActionEvent) { + private val vue: MainVue + private val modele: Bibliotheque + + init { + this.vue = vue + this.modele = modele + } - //TODO + private fun supprimer(){ + modele.suppressionLivre() + vue.updateLivres(modele.livres, modele.courant) + vue.panneauDroit.update(modele.courant, modele.donneLivre()) + vue.updateLivres(modele.livres, ControleurDetailLivre(vue, modele), 0) + } + + override fun handle(event: ActionEvent) { + val alert = Alert(Alert.AlertType.CONFIRMATION) + alert.title = "Boîte de dialogue de confirmation" + alert.headerText = "Voulez-vous vraiment supprimer ce livre ?" + alert.showAndWait().filter{i -> i == ButtonType.OK}.ifPresent { supprimer() } } } -- GitLab