From 800279f4760e9fc83f5d4df61edb0259fd510b6f Mon Sep 17 00:00:00 2001 From: Paul Mertens <50475262+LeStegii@users.noreply.github.com> Date: Mon, 13 May 2024 09:53:31 +0200 Subject: [PATCH] docs: Enhance modal documentation --- docs/features/4-modals.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/features/4-modals.md b/docs/features/4-modals.md index 12733d2d..b1d309f6 100644 --- a/docs/features/4-modals.md +++ b/docs/features/4-modals.md @@ -10,6 +10,8 @@ A BiConsumer provides access to the component instance and the stage for configu When displaying the component, the parameters `modalStage` and `ownerStage` will be passed so that the modal can for example be closed from inside the component class. +The same component instance cannot be used twice for displaying a modal. When using Dagger it is recommended to inject a provider and use it to create an instance for every modal. + ```java @Component @@ -35,7 +37,8 @@ public class ModalComponent extends VBox { ``` ```java -Modals.showModal(app, modalComponent, (stage, component) -> { +// As every modal needs its own instance, we use a provider (e.g. with Dagger) +Modals.showModal(app, modalComponentProvider.get(), (stage, component) -> { stage.doSomething(); component.doSomethingElse(); }); @@ -43,4 +46,4 @@ Modals.showModal(app, modalComponent, (stage, component) -> { --- -[⬅ History](3-history.md) | [Overview](README.md) | [Duplicator ➡](5-node-duplicator.md) \ No newline at end of file +[⬅ History](3-history.md) | [Overview](README.md) | [Duplicator ➡](5-node-duplicator.md)