From 61b64658e12144d462c30fd7c8423478456b295e Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 8 Aug 2015 22:14:17 +0200 Subject: [PATCH] Fixed validation error popup location when the first page is invalid --- .../src/dorkbox/util/javafx/Wizard.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Dorkbox-Util/src/dorkbox/util/javafx/Wizard.java b/Dorkbox-Util/src/dorkbox/util/javafx/Wizard.java index dca6115..6273cf8 100644 --- a/Dorkbox-Util/src/dorkbox/util/javafx/Wizard.java +++ b/Dorkbox-Util/src/dorkbox/util/javafx/Wizard.java @@ -334,15 +334,17 @@ public class Wizard { void validatePopover(final String newValue) { if (newValue != null) { currentPage.ifPresent(currentPage -> { - final PopOver popOver = this.popOver; + Platform.runLater(() -> { + final PopOver popOver = this.popOver; - this.popOverErrorText.setText(newValue); + this.popOverErrorText.setText(newValue); - if (!popOver.isShowing()) { - popOver.setX(0); - popOver.setY(0); - popOver.show(BUTTON_NEXT, -10); - } + if (!popOver.isShowing()) { + popOver.setX(0); + popOver.setY(0); + popOver.show(BUTTON_NEXT, -10); + } + }); }); } else { popOver.hide(); @@ -685,12 +687,6 @@ public class Wizard { invalidProperty.bind(currentPage.invalidProperty); invalidPropertyStrings.bind(currentPage.invalidPropertyStrings); - if (currentPage.invalidProperty.get()) { - validatePopover(currentPage.invalidPropertyStrings.get()); - } else { - popOver.hide(); - } - final Node firstFocusElement = currentPage.firstFocusElement; if (firstFocusElement != null) { Platform.runLater(() -> { @@ -736,7 +732,13 @@ public class Wizard { stage.sizeToScene(); } - currentPage.validationSupport.redecorate(); + Platform.runLater(() -> { + if (isInvalid()) { + validatePopover(currentPage.invalidPropertyStrings.get()); + } else { + popOver.hide(); + } + }); }); validateActionState();