Code aufräumen
This commit is contained in:
-57
@@ -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.
|
||||
* <p>
|
||||
* 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.
|
||||
*/
|
||||
|
||||
+3
-4
@@ -204,7 +204,6 @@ public final class GuiBatchRunTab {
|
||||
private final GuiBatchRunCoordinator coordinator;
|
||||
private final Supplier<GuiManualFileRenamePort> manualFileRenamePortSupplier;
|
||||
private final Supplier<GuiManualFileCopyPort> manualFileCopyPortSupplier;
|
||||
private final Supplier<GuiHistoricalDocumentContextPort> historicalDocumentContextPortSupplier;
|
||||
private final Supplier<Optional<Path>> sourceFolderSupplier;
|
||||
private final Supplier<Optional<String>> 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(
|
||||
|
||||
+1
-2
@@ -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
|
||||
|
||||
+2
@@ -9,6 +9,8 @@ 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.
|
||||
*
|
||||
|
||||
+2
-2
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user