Fix connection creation dialog error message issues

This commit is contained in:
crschnick 2023-07-13 07:45:23 +00:00
parent 888fa3d92b
commit 23736d41c0
4 changed files with 28 additions and 13 deletions

View file

@ -7,8 +7,6 @@ repositories {
mavenCentral()
}
def appVersion = rootProject.versionString
configurations {
dep
}

View file

@ -2,6 +2,7 @@ package io.xpipe.app.comp.base;
import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.fxcomps.util.PlatformThread;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.control.TextArea;
@ -24,17 +25,20 @@ public class ErrorOverlayComp extends SimpleComp {
protected Region createSimple() {
var content = new SimpleObjectProperty<ModalOverlayComp.OverlayContent>();
this.text.addListener((observable, oldValue, newValue) -> {
var comp = Comp.of(() -> {
var l = new TextArea();
l.textProperty().bind(text);
l.setWrapText(false);
l.getStyleClass().add("error-overlay-comp");
l.setEditable(false);
return l;
PlatformThread.runLaterIfNeeded(() -> {
var comp = Comp.of(() -> {
var l = new TextArea();
l.textProperty().bind(PlatformThread.sync(text));
l.setWrapText(false);
l.getStyleClass().add("error-overlay-comp");
l.setEditable(false);
return l;
});
content.set(new ModalOverlayComp.OverlayContent("error", comp, null, () -> {}));
});
content.set(new ModalOverlayComp.OverlayContent("error", comp, null, () -> {}));
});
content.addListener((observable, oldValue, newValue) -> {
// Handle close
if (newValue == null) {
this.text.setValue(null);
}

View file

@ -45,8 +45,9 @@ public class ModalOverlayComp extends SimpleComp {
var pane = new StackPane(bgRegion, modal);
pane.setPickOnBounds(false);
PlatformThread.sync(overlayContent).addListener((observable, oldValue, newValue) -> {
if (oldValue != null) {
if (oldValue != null && newValue == null && modal.isDisplay()) {
modal.hide(true);
return;
}
if (newValue != null) {
@ -72,6 +73,7 @@ public class ModalOverlayComp extends SimpleComp {
var modalBox = new ModalBox(box);
modalBox.setOnClose(event -> {
overlayContent.setValue(null);
modal.hide(true);
event.consume();
});
modalBox.prefWidthProperty().bind(box.widthProperty());

View file

@ -36,6 +36,7 @@ import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Predicate;
@ -332,7 +333,12 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
.get(0)
.getText();
TrackEvent.info(msg);
messageProp.setValue(msg);
var newMessage = msg;
// Temporary fix for equal error message not showing up again
if (Objects.equals(newMessage, messageProp.getValue())) {
newMessage = newMessage + " ";
}
messageProp.setValue(newMessage);
changedSinceError.setValue(false);
return false;
}
@ -343,7 +349,12 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
finished.setValue(true);
PlatformThread.runLaterIfNeeded(parent::next);
} catch (Exception ex) {
messageProp.setValue(ExceptionConverter.convertMessage(ex));
var newMessage = ExceptionConverter.convertMessage(ex);
// Temporary fix for equal error message not showing up again
if (Objects.equals(newMessage, messageProp.getValue())) {
newMessage = newMessage + " ";
}
messageProp.setValue(newMessage);
changedSinceError.setValue(false);
ErrorEvent.fromThrowable(ex).omit().handle();
}