diff --git a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java index 8224cc2a9..aaff0e610 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckDetailController.java +++ b/src/main/java/org/cryptomator/ui/health/CheckDetailController.java @@ -37,7 +37,6 @@ public class CheckDetailController implements FxController { private final Binding warnOrCritsExist; private final ResultListCellFactory resultListCellFactory; - public CheckStateIconView checkStateIconView; public ListView resultsListView; private Subscription resultSubscription; diff --git a/src/main/java/org/cryptomator/ui/health/StartFailController.java b/src/main/java/org/cryptomator/ui/health/StartFailController.java index 953b7c830..b1724b35c 100644 --- a/src/main/java/org/cryptomator/ui/health/StartFailController.java +++ b/src/main/java/org/cryptomator/ui/health/StartFailController.java @@ -1,15 +1,11 @@ package org.cryptomator.ui.health; import com.google.common.base.Preconditions; -import com.tobiasdiez.easybind.EasyBind; import org.cryptomator.cryptofs.VaultConfigLoadException; import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.controls.FontAwesome5Icon; import javax.inject.Inject; -import javafx.beans.binding.Binding; -import javafx.beans.binding.Bindings; -import javafx.beans.binding.BooleanBinding; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; @@ -23,15 +19,18 @@ import java.nio.charset.StandardCharsets; @HealthCheckScoped public class StartFailController implements FxController { + private final Stage window; + private final ObjectProperty loadError; + private final ObjectProperty moreInfoIcon; + + /* FXML */ + public TitledPane moreInfoPane; + @Inject public StartFailController(@HealthCheckWindow Stage window, HealthCheckComponent.LoadUnverifiedConfigResult configLoadResult) { Preconditions.checkNotNull(configLoadResult.error()); this.window = window; this.loadError = new SimpleObjectProperty<>(configLoadResult.error()); - this.localizedErrorMessage = EasyBind.map(loadError, Throwable::getLocalizedMessage); - this.parseException = Bindings.createBooleanBinding(() -> loadError.get() instanceof VaultConfigLoadException); - this.ioException = parseException.not(); - this.stackTrace = EasyBind.map(loadError, this::createPrintableStacktrace); this.moreInfoIcon = new SimpleObjectProperty<>(FontAwesome5Icon.CARET_RIGHT); } @@ -43,48 +42,12 @@ public class StartFailController implements FxController { moreInfoIcon.set(willExpand ? FontAwesome5Icon.CARET_DOWN : FontAwesome5Icon.CARET_RIGHT); } - private String createPrintableStacktrace(Throwable t) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - t.printStackTrace(new PrintStream(baos)); - return baos.toString(StandardCharsets.UTF_8); - } - @FXML public void close() { window.close(); } - public Binding stackTraceProperty() { - return stackTrace; - } - - public String getStackTrace() { - return stackTrace.getValue(); - } - - public Binding localizedErrorMessageProperty() { - return localizedErrorMessage; - } - - public String getLocalizedErrorMessage() { - return localizedErrorMessage.getValue(); - } - - public BooleanBinding parseExceptionProperty() { - return parseException; - } - - public boolean isParseException() { - return parseException.getValue(); - } - - public BooleanBinding ioExceptionProperty() { - return ioException; - } - - public boolean isIoException() { - return ioException.getValue(); - } + /* Getter & Setter */ public ObjectProperty moreInfoIconProperty() { return moreInfoIcon; @@ -94,15 +57,22 @@ public class StartFailController implements FxController { return moreInfoIcon.getValue(); } - private final Stage window; - private final ObjectProperty loadError; - private final Binding stackTrace; - private final Binding localizedErrorMessage; - private final BooleanBinding ioException; - private final BooleanBinding parseException; - private final ObjectProperty moreInfoIcon; + public String getStackTrace() { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + loadError.get().printStackTrace(new PrintStream(baos)); + return baos.toString(StandardCharsets.UTF_8); + } - /* FXML */ - public TitledPane moreInfoPane; + public String getLocalizedErrorMessage() { + return loadError.get().getLocalizedMessage(); + } + + public boolean isParseException() { + return loadError.get() instanceof VaultConfigLoadException; + } + + public boolean isIoException() { + return !isParseException(); + } } diff --git a/src/main/resources/fxml/health_check_details.fxml b/src/main/resources/fxml/health_check_details.fxml index 1fab3a069..60b98d9da 100644 --- a/src/main/resources/fxml/health_check_details.fxml +++ b/src/main/resources/fxml/health_check_details.fxml @@ -5,15 +5,18 @@ + - + + \ No newline at end of file diff --git a/src/main/resources/fxml/health_check_list.fxml b/src/main/resources/fxml/health_check_list.fxml index 61309f8f1..05ac42cdb 100644 --- a/src/main/resources/fxml/health_check_list.fxml +++ b/src/main/resources/fxml/health_check_list.fxml @@ -24,7 +24,7 @@ - +