From 4845984a354b2014e4f1ce545dcb3b44a1384052 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 21 May 2021 12:43:07 +0200 Subject: [PATCH] ui sugar * show correct name for health check tasks * some padding * resize window when run button is hit --- .../cryptomator/ui/health/CheckListCell.java | 5 +++++ .../ui/health/CheckListController.java | 19 +++++++++++++++++-- .../resources/fxml/health_check_list.fxml | 6 ++---- .../fxml/health_result_listcell.fxml | 2 +- .../main/resources/i18n/strings.properties | 1 + 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/health/CheckListCell.java b/main/ui/src/main/java/org/cryptomator/ui/health/CheckListCell.java index d4270c40c..ce01006c3 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/health/CheckListCell.java +++ b/main/ui/src/main/java/org/cryptomator/ui/health/CheckListCell.java @@ -5,6 +5,7 @@ import org.cryptomator.ui.controls.FontAwesome5IconView; import javafx.beans.value.ObservableValue; import javafx.concurrent.Worker; +import javafx.geometry.Insets; import javafx.scene.control.ContentDisplay; import javafx.scene.control.ListCell; @@ -12,6 +13,10 @@ class CheckListCell extends ListCell { private final FontAwesome5IconView stateIcon = new FontAwesome5IconView(); + CheckListCell(){ + paddingProperty().set(new Insets(6)); + } + @Override protected void updateItem(HealthCheckTask item, boolean empty) { super.updateItem(item, empty); diff --git a/main/ui/src/main/java/org/cryptomator/ui/health/CheckListController.java b/main/ui/src/main/java/org/cryptomator/ui/health/CheckListController.java index 600549237..f7dec4ad5 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/health/CheckListController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/health/CheckListController.java @@ -22,6 +22,8 @@ import javafx.concurrent.Worker; import javafx.fxml.FXML; import javafx.scene.control.ListView; import javafx.scene.control.cell.CheckBoxListCell; +import javafx.stage.Stage; +import javafx.util.StringConverter; import java.io.IOException; import java.util.Collection; import java.util.HashMap; @@ -35,6 +37,7 @@ public class CheckListController implements FxController { private static final Logger LOG = LoggerFactory.getLogger(CheckListController.class); private static final Set END_STATES = Set.of(Worker.State.FAILED, Worker.State.CANCELLED, Worker.State.SUCCEEDED); + private final Stage window; private final ObservableList tasks; private final ReportWriter reportWriter; private final ExecutorService executorService; @@ -52,7 +55,8 @@ public class CheckListController implements FxController { @Inject - public CheckListController(Lazy> tasks, ReportWriter reportWriteTask, ObjectProperty selectedTask, ExecutorService executorService) { + public CheckListController(@HealthCheckWindow Stage window, Lazy> tasks, ReportWriter reportWriteTask, ObjectProperty selectedTask, ExecutorService executorService) { + this.window = window; this.tasks = FXCollections.observableArrayList(tasks.get()); this.reportWriter = reportWriteTask; this.executorService = executorService; @@ -74,7 +78,17 @@ public class CheckListController implements FxController { @FXML public void initialize() { checksListView.setItems(tasks); - checksListView.setCellFactory(CheckBoxListCell.forListView(listPickIndicators::get)); + checksListView.setCellFactory(CheckBoxListCell.forListView(listPickIndicators::get, new StringConverter() { + @Override + public String toString(HealthCheckTask object) { + return object.getCheck().identifier(); + } + + @Override + public HealthCheckTask fromString(String string) { + return null; + } + })); selectedTask.bind(checksListView.getSelectionModel().selectedItemProperty()); } @@ -89,6 +103,7 @@ public class CheckListController implements FxController { checksListView.setCellFactory(view -> new CheckListCell()); showResultScreen.set(true); checksListView.getSelectionModel().select(batch.getViewIndex(0)); + window.sizeToScene(); } @FXML diff --git a/main/ui/src/main/resources/fxml/health_check_list.fxml b/main/ui/src/main/resources/fxml/health_check_list.fxml index ba2778476..2e2cd5ff6 100644 --- a/main/ui/src/main/resources/fxml/health_check_list.fxml +++ b/main/ui/src/main/resources/fxml/health_check_list.fxml @@ -12,8 +12,6 @@ @@ -24,8 +22,8 @@ - -