mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-28 21:37:50 -04:00
ui adjustments & code cleanup
This commit is contained in:
@@ -37,7 +37,6 @@ public class CheckDetailController implements FxController {
|
||||
private final Binding<Boolean> warnOrCritsExist;
|
||||
private final ResultListCellFactory resultListCellFactory;
|
||||
|
||||
public CheckStateIconView checkStateIconView;
|
||||
public ListView<Result> resultsListView;
|
||||
private Subscription resultSubscription;
|
||||
|
||||
|
||||
@@ -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<Throwable> loadError;
|
||||
private final ObjectProperty<FontAwesome5Icon> 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<String> stackTraceProperty() {
|
||||
return stackTrace;
|
||||
}
|
||||
|
||||
public String getStackTrace() {
|
||||
return stackTrace.getValue();
|
||||
}
|
||||
|
||||
public Binding<String> 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<FontAwesome5Icon> moreInfoIconProperty() {
|
||||
return moreInfoIcon;
|
||||
@@ -94,15 +57,22 @@ public class StartFailController implements FxController {
|
||||
return moreInfoIcon.getValue();
|
||||
}
|
||||
|
||||
private final Stage window;
|
||||
private final ObjectProperty<Throwable> loadError;
|
||||
private final Binding<String> stackTrace;
|
||||
private final Binding<String> localizedErrorMessage;
|
||||
private final BooleanBinding ioException;
|
||||
private final BooleanBinding parseException;
|
||||
private final ObjectProperty<FontAwesome5Icon> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,15 +5,18 @@
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import org.cryptomator.ui.health.CheckStateIconView?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="org.cryptomator.ui.health.CheckDetailController"
|
||||
spacing="6">
|
||||
<FormattedLabel fx:id="checkTitle" styleClass="label-large" format="%health.check.detail.header" arg1="${controller.checkName}" contentDisplay="LEFT">
|
||||
<Label fx:id="detailHeader" styleClass="label-large" text="${controller.checkName}" contentDisplay="LEFT">
|
||||
<graphic>
|
||||
<CheckStateIconView fx:id="checkStateIconView" check="${controller.check}" glyphSize="20"/>
|
||||
<HBox alignment="CENTER" minWidth="25" maxWidth="25">
|
||||
<CheckStateIconView fx:id="checkStateIconView" check="${controller.check}" glyphSize="20"/>
|
||||
</HBox>
|
||||
</graphic>
|
||||
</FormattedLabel>
|
||||
</Label>
|
||||
|
||||
<Label text="%health.check.detail.checkRunning" visible="${controller.checkRunning}" managed="${controller.checkRunning}"/>
|
||||
<Label text="%health.check.detail.checkScheduled" visible="${controller.checkScheduled}" managed="${controller.checkScheduled}"/>
|
||||
@@ -23,5 +26,5 @@
|
||||
<Label text="%health.check.detail.checkSucceeded" visible="${controller.checkSucceeded && !controller.warnOrCritsExist}" managed="${controller.checkSucceeded && !controller.warnOrCritsExist}"/>
|
||||
<Label text="TODO: check finished and found something" visible="${controller.checkSucceeded && controller.warnOrCritsExist}" managed="${controller.checkSucceeded && controller.warnOrCritsExist}"/>
|
||||
|
||||
<ListView fx:id="resultsListView" VBox.vgrow="ALWAYS" visible="${!controller.checkSkipped}"/>
|
||||
<ListView fx:id="resultsListView" VBox.vgrow="ALWAYS" visible="${!controller.checkSkipped}" fixedCellSize="25"/>
|
||||
</VBox>
|
||||
@@ -24,7 +24,7 @@
|
||||
</fx:define>
|
||||
<children>
|
||||
<HBox spacing="12" VBox.vgrow="ALWAYS">
|
||||
<ListView fx:id="checksListView" VBox.vgrow="ALWAYS" prefWidth="175"/>
|
||||
<ListView fx:id="checksListView" VBox.vgrow="ALWAYS" minWidth="175" maxWidth="175"/>
|
||||
<VBox alignment="CENTER" visible="${!controller.mainRunStarted}" managed="${!controller.mainRunStarted}" HBox.hgrow="ALWAYS">
|
||||
<Label text="TODO: Introductory/Explanatory Text? "/>
|
||||
<Button onAction="#selectAllChecks" text="%health.checkList.selectAllBox" />
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<?import javafx.scene.control.TitledPane?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.health.StartFailController"
|
||||
@@ -20,9 +21,11 @@
|
||||
<Label text="TODO: Error on loading" />
|
||||
<FormattedLabel format="TODO: Error reading file: %s" arg1="${controller.localizedErrorMessage}" visible="${controller.ioException}" managed="${controller.ioException}"/>
|
||||
<Label text="TODO: Malformed vault config" visible="${controller.parseException}" managed="${controller.parseException}"/>
|
||||
<TitledPane fx:id="moreInfoPane" text="More Info" expanded="false" contentDisplay="LEFT">
|
||||
<TitledPane fx:id="moreInfoPane" text="TODO: More" expanded="false" contentDisplay="LEFT" >
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="${controller.moreInfoIcon}"/>
|
||||
<HBox alignment="CENTER" minWidth="8">
|
||||
<FontAwesome5IconView glyph="${controller.moreInfoIcon}"/>
|
||||
</HBox>
|
||||
</graphic>
|
||||
<content>
|
||||
<TextArea VBox.vgrow="ALWAYS" text="${controller.stackTrace}" prefRowCount="20" editable="false" />
|
||||
|
||||
Reference in New Issue
Block a user