From 8bb0aabb512d6af075288376e300f640a1d5cf57 Mon Sep 17 00:00:00 2001 From: Marcus van Elst Date: Tue, 28 Apr 2026 08:52:59 +0200 Subject: [PATCH] =?UTF-8?q?Code=20aufr=C3=A4umen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/GuiConfigurationEditorWorkspace.java | 57 ------------------- .../in/gui/batchrun/GuiBatchRunTab.java | 7 +-- .../batchrun/GuiBatchRunResultRowTest.java | 3 +- .../AnotherInstanceRunningException.java | 4 +- .../SingleInstanceGuardTest.java | 4 +- 5 files changed, 9 insertions(+), 66 deletions(-) diff --git a/pdf-umbenenner-adapter-in-gui/src/main/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/GuiConfigurationEditorWorkspace.java b/pdf-umbenenner-adapter-in-gui/src/main/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/GuiConfigurationEditorWorkspace.java index 011c5f3..a7ee815 100644 --- a/pdf-umbenenner-adapter-in-gui/src/main/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/GuiConfigurationEditorWorkspace.java +++ b/pdf-umbenenner-adapter-in-gui/src/main/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/GuiConfigurationEditorWorkspace.java @@ -2608,50 +2608,6 @@ public final class GuiConfigurationEditorWorkspace { return label; } - /** - * Builds a labelled path-field row as a {@link VBox} containing a grid row with the field - * and picker button, plus an optional error-slot label directly beneath. - *

- * The method uses an 8-pixel top padding to separate consecutive field rows visually, matching - * the former grid vgap behaviour. - * - * @param labelText the row label text; must not be {@code null} - * @param field the text field; must not be {@code null} - * @param errorLabel the field-level error label, or {@code null} for no error slot - * @param onPick action invoked when the picker button is clicked; must not be {@code null} - * @return a VBox containing the labelled row and optional error slot - */ - private static VBox buildPathFieldRow(String labelText, TextField field, - Label errorLabel, Runnable onPick) { - Label label = new Label(labelText); - Button pickButton = new Button("…"); - pickButton.setOnAction(e -> onPick.run()); - pickButton.setMinWidth(32); - HBox fieldBox = new HBox(4, field, pickButton); - HBox.setHgrow(field, Priority.ALWAYS); - fieldBox.setAlignment(Pos.CENTER_LEFT); - - GridPane grid = new GridPane(); - grid.setHgap(12); - grid.setVgap(0); - javafx.scene.layout.ColumnConstraints labelCol = new javafx.scene.layout.ColumnConstraints(); - labelCol.setMinWidth(180); - labelCol.setPrefWidth(200); - javafx.scene.layout.ColumnConstraints fieldCol = new javafx.scene.layout.ColumnConstraints(); - fieldCol.setFillWidth(true); - fieldCol.setHgrow(Priority.ALWAYS); - grid.getColumnConstraints().addAll(labelCol, fieldCol); - grid.add(label, 0, 0); - grid.add(fieldBox, 1, 0); - grid.setPadding(new Insets(4, 0, 0, 0)); - - VBox slot = new VBox(0, grid); - if (errorLabel != null) { - slot.getChildren().add(errorLabel); - } - return slot; - } - /** * Baut zwei Pfad-Felder nebeneinander in einer HBox. Jedes Feld hat ein Label und einen Picker-Button. * Error-Labels werden untereinander angezeigt. @@ -2786,19 +2742,6 @@ public final class GuiConfigurationEditorWorkspace { return field; } - /** - * Adds a label and a text field (without a picker button) to the given grid row. - * - * @param grid the target grid pane - * @param row the grid row index - * @param labelText the row label text - * @param field the text field to place - */ - private static void addSimpleRow(GridPane grid, int row, String labelText, TextField field) { - grid.add(new Label(labelText), 0, row); - grid.add(field, 1, row); - } - /** * Erstellt ein GridPane für Konfigurationsfelder mit kompaktem vertikalen Abstand. */ diff --git a/pdf-umbenenner-adapter-in-gui/src/main/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/batchrun/GuiBatchRunTab.java b/pdf-umbenenner-adapter-in-gui/src/main/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/batchrun/GuiBatchRunTab.java index 0e07dc3..eb4c109 100644 --- a/pdf-umbenenner-adapter-in-gui/src/main/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/batchrun/GuiBatchRunTab.java +++ b/pdf-umbenenner-adapter-in-gui/src/main/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/batchrun/GuiBatchRunTab.java @@ -204,7 +204,6 @@ public final class GuiBatchRunTab { private final GuiBatchRunCoordinator coordinator; private final Supplier manualFileRenamePortSupplier; private final Supplier manualFileCopyPortSupplier; - private final Supplier historicalDocumentContextPortSupplier; private final Supplier> sourceFolderSupplier; private final Supplier> targetFolderSupplier; @@ -275,7 +274,7 @@ public final class GuiBatchRunTab { manualFileRenamePortSupplier, "manualFileRenamePortSupplier must not be null"); this.manualFileCopyPortSupplier = Objects.requireNonNull( manualFileCopyPortSupplier, "manualFileCopyPortSupplier must not be null"); - this.historicalDocumentContextPortSupplier = Objects.requireNonNull( + Objects.requireNonNull( historicalDocumentContextPortSupplier, "historicalDocumentContextPortSupplier must not be null"); this.sourceFolderSupplier = Objects.requireNonNull( sourceFolderSupplier, "sourceFolderSupplier must not be null"); @@ -654,8 +653,8 @@ public final class GuiBatchRunTab { } }); - resultTable.getColumns().setAll( - checkboxCol, iconCol, nameCol, newNameCol, dateCol, durationCol); + resultTable.getColumns().setAll(List.of( + checkboxCol, iconCol, nameCol, newNameCol, dateCol, durationCol)); // Selektion im TableView synchronisiert selectedRows und Checkboxen. resultTable.getSelectionModel().getSelectedItems().addListener( diff --git a/pdf-umbenenner-adapter-in-gui/src/test/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/batchrun/GuiBatchRunResultRowTest.java b/pdf-umbenenner-adapter-in-gui/src/test/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/batchrun/GuiBatchRunResultRowTest.java index 104905d..4b26f74 100644 --- a/pdf-umbenenner-adapter-in-gui/src/test/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/batchrun/GuiBatchRunResultRowTest.java +++ b/pdf-umbenenner-adapter-in-gui/src/test/java/de/gecheckt/pdf/umbenenner/adapter/in/gui/batchrun/GuiBatchRunResultRowTest.java @@ -21,8 +21,7 @@ class GuiBatchRunResultRowTest { private static final DocumentFingerprint FP = new DocumentFingerprint("a".repeat(64)); - private static final DocumentFingerprint FP2 = - new DocumentFingerprint("b".repeat(64)); + // ------------------------------------------------------------------------- // Basic construction diff --git a/pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/singleinstance/AnotherInstanceRunningException.java b/pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/singleinstance/AnotherInstanceRunningException.java index 0e0de28..b58a8eb 100644 --- a/pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/singleinstance/AnotherInstanceRunningException.java +++ b/pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/singleinstance/AnotherInstanceRunningException.java @@ -9,7 +9,9 @@ package de.gecheckt.pdf.umbenenner.bootstrap.singleinstance; */ public class AnotherInstanceRunningException extends RuntimeException { - /** + private static final long serialVersionUID = 159711019801174340L; + + /** * Erstellt eine neue {@code AnotherInstanceRunningException} mit der angegebenen Nachricht. * * @param message die Fehlernachricht; darf {@code null} sein diff --git a/pdf-umbenenner-bootstrap/src/test/java/de/gecheckt/pdf/umbenenner/bootstrap/singleinstance/SingleInstanceGuardTest.java b/pdf-umbenenner-bootstrap/src/test/java/de/gecheckt/pdf/umbenenner/bootstrap/singleinstance/SingleInstanceGuardTest.java index fe67206..b3e758b 100644 --- a/pdf-umbenenner-bootstrap/src/test/java/de/gecheckt/pdf/umbenenner/bootstrap/singleinstance/SingleInstanceGuardTest.java +++ b/pdf-umbenenner-bootstrap/src/test/java/de/gecheckt/pdf/umbenenner/bootstrap/singleinstance/SingleInstanceGuardTest.java @@ -39,10 +39,10 @@ class SingleInstanceGuardTest { @Test void zweiterAcquireWirftAnotherInstanceRunningException() throws Exception { int port = freienPortErmitteln(); - try (SingleInstanceGuard ersterGuard = new SingleInstanceGuard(port)) { + try (SingleInstanceGuard ersterGuard = new SingleInstanceGuard(port); + SingleInstanceGuard zweiterGuard = new SingleInstanceGuard(port)) { ersterGuard.acquire(); - SingleInstanceGuard zweiterGuard = new SingleInstanceGuard(port); assertThrows(AnotherInstanceRunningException.class, zweiterGuard::acquire, "Während der erste Guard aktiv ist, soll der zweite acquire() eine " + "AnotherInstanceRunningException werfen.");