From 9c63b2dd0f85f93245dedd578e15fce552fcd542 Mon Sep 17 00:00:00 2001 From: Konrad Neitzel Date: Wed, 25 Nov 2026 13:17:24 +0100 Subject: [PATCH] Offer grid row attributes and qualify Archiver folder profile editing --- README.md | 2 + .../fxdesigner/kit/GridDockEditor.java | 18 +- .../idea/FolderActionsTargetProbe.java | 60 ++-- .../idea/FolderProfilesTargetProbe.java | 328 ++++++++++++++++++ .../idea/FolderProfilesWorkflowProbe.java | 109 ++++++ integration-tests/idea/FormWorkflowProbe.java | 33 ++ .../idea/ImportWorkflowProbe.java | 36 +- .../idea/ManagementReadersWorkflowProbe.java | 32 -- scripts/check-ide-host.py | 7 +- scripts/run-fixture-host.py | 13 +- 10 files changed, 560 insertions(+), 78 deletions(-) create mode 100644 integration-tests/idea/FolderProfilesTargetProbe.java create mode 100644 integration-tests/idea/FolderProfilesWorkflowProbe.java diff --git a/README.md b/README.md index e4d24f0..f45ad25 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,8 @@ Use `--import-form` with `scripts/check-ide-host.py --archiver ../Archiver` and Use `--management-readers` with the Archiver host check to exercise the two account states, the empty and populated trash, and all five reader toolbars. The check saves and reopens CommandBinding changes in both management forms and an icon and accessible text change in the picture toolbar. +Use `--folder-profiles` with the Archiver host check to rebind the profile buttons and edit mail and book columns against indexed EML and EPUB files. The editable attribute list offers the row attributes used by the current grid. + Use `--folder-actions` with the Archiver host check to edit a text field’s column count, accessible name and controller action, then exercise the folder toolbar’s dismiss handler, full-text search, multiple selection and saved display profiles. Use `--document-tabs` with the Archiver host check to open the production archive window and select **Archiver · HTML-Dokumenttabs**. The check also opens the production HTML and details FXML files directly, edits the assigned-tag Component and the input prompt through the visual inspector, and reopens the saved files. In the archive window it adds a second tag to the invoice, switches to the delivery note and back, removes the selected tag, and checks each WebView and suggestion popup. Direct examples cover read-only and busy states. diff --git a/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/GridDockEditor.java b/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/GridDockEditor.java index a87e4d7..a162381 100644 --- a/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/GridDockEditor.java +++ b/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/GridDockEditor.java @@ -260,7 +260,23 @@ final class GridDockEditor extends VBox { "minimumWidth ≤ width ≤ maximumWidth. FXML references are resolved at runtime.")); } else value.setTooltip(null); value.setPromptText(hint); - value.getItems().setAll(GridDockDocument.options(field)); + if ("attribute".equals(field) || "groupAttribute".equals(field)) { + var columns = doc.branches(doc.parentOfType(e, "DataGrid")); + value + .getItems() + .setAll( + columns.stream() + .map( + column -> + column.getAttribute( + column.hasAttribute("attribute") ? "attribute" : "id")) + .filter(name -> !name.isBlank()) + .distinct() + .toList()); + value.setTooltip( + new Tooltip( + "Row attributes used by this grid. You can also enter another row attribute.")); + } else value.getItems().setAll(GridDockDocument.options(field)); value.setValue(e.getAttribute(field)); value.getEditor().setText(e.getAttribute(field)); } diff --git a/integration-tests/idea/FolderActionsTargetProbe.java b/integration-tests/idea/FolderActionsTargetProbe.java index f2d8865..c28a134 100644 --- a/integration-tests/idea/FolderActionsTargetProbe.java +++ b/integration-tests/idea/FolderActionsTargetProbe.java @@ -19,14 +19,14 @@ public final class FolderActionsTargetProbe { Thread.ofPlatform().daemon().start(() -> Worker.run(Path.of(dir))); } - private static final class Worker { - private static T fx(Callable action) throws Exception { + static final class Worker { + static T fx(Callable action) throws Exception { var task = new FutureTask<>(action); Platform.runLater(task); return task.get(10, TimeUnit.SECONDS); } - private static void await(String description, Callable test) throws Exception { + static void await(String description, Callable test) throws Exception { long end = System.nanoTime() + TimeUnit.SECONDS.toNanos(22); while (System.nanoTime() < end) { if (fx(test)) return; @@ -35,34 +35,38 @@ public final class FolderActionsTargetProbe { throw new AssertionError(description); } - private static void require(boolean value, String message) { + static void require(boolean value, String message) { if (!value) throw new AssertionError(message); } + static Stage previewStage() throws Exception { + Stage stage = null; + while (stage == null) { + Thread.sleep(120); + try { + stage = + fx( + () -> + Window.getWindows().stream() + .filter( + w -> + w instanceof Stage s + && s.isShowing() + && s.getOpacity() > 0 + && s.getTitle() != null + && s.getTitle().startsWith("Neitzel preview")) + .map(Stage.class::cast) + .findFirst() + .orElse(null)); + } catch (IllegalStateException starting) { + } + } + return stage; + } + private static void run(Path dir) { try { - Stage stage = null; - while (stage == null) { - Thread.sleep(120); - try { - stage = - fx( - () -> - Window.getWindows().stream() - .filter( - w -> - w instanceof Stage s - && s.isShowing() - && s.getOpacity() > 0 - && s.getTitle() != null - && s.getTitle().startsWith("Neitzel preview")) - .map(Stage.class::cast) - .findFirst() - .orElse(null)); - } catch (IllegalStateException starting) { - } - } - Stage shown = stage; + Stage shown = previewStage(); var root = fx( () -> { @@ -140,7 +144,7 @@ public final class FolderActionsTargetProbe { .orElseThrow(); } - private static boolean visible(Node grid, String column) throws Exception { + static boolean visible(Node grid, String column) throws Exception { return (boolean) grid.getClass().getMethod("isColumnVisible", String.class).invoke(grid, column); } @@ -283,7 +287,7 @@ public final class FolderActionsTargetProbe { + " Dateityp; Kurzansicht restored hidden Dateityp."); } - private static void image(Node node, Path path) throws Exception { + static void image(Node node, Path path) throws Exception { var img = node.snapshot(null, null); int w = (int) img.getWidth(), h = (int) img.getHeight(); var out = new java.awt.image.BufferedImage(w, h, java.awt.image.BufferedImage.TYPE_INT_ARGB); diff --git a/integration-tests/idea/FolderProfilesTargetProbe.java b/integration-tests/idea/FolderProfilesTargetProbe.java new file mode 100644 index 0000000..78ff3fc --- /dev/null +++ b/integration-tests/idea/FolderProfilesTargetProbe.java @@ -0,0 +1,328 @@ +package qualification; + +import static qualification.FolderActionsTargetProbe.Worker.*; + +import java.nio.file.*; +import java.time.*; +import java.time.format.*; +import java.util.*; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicInteger; +import javafx.application.Platform; +import javafx.collections.ListChangeListener; +import javafx.scene.*; +import javafx.scene.control.*; +import javafx.stage.Window; + +/** Checks rendered folder rows and the ordinary modal profile dialogs in the preview worker. */ +public final class FolderProfilesTargetProbe { + public static void premain(String directory) { + if (System.getProperty("sun.java.command", "") + .startsWith("de.neitzel.fxdesigner.target.WorkerMain ")) + Thread.ofPlatform().daemon().start(() -> Checks.run(Path.of(directory))); + } + + private static final class Checks { + private static void run(Path dir) { + try { + var stage = previewStage(); + var root = + fx( + () -> { + stage.setWidth(1360); + stage.setHeight(700); + var r = stage.getScene().getRoot(); + r.applyCss(); + r.layout(); + return r; + }); + var attempt = Files.readString(dir.resolve("layout-case")); + var result = + switch (attempt) { + case "profiles", "readonly", "rebound" -> profiles(root, attempt); + case "metadata", "renamed", "recovered" -> metadata(root, attempt, dir); + default -> throw new AssertionError(attempt); + }; + Files.writeString(dir.resolve("result-" + attempt), result); + } catch (Throwable failure) { + var trace = new java.io.StringWriter(); + failure.printStackTrace(new java.io.PrintWriter(trace)); + try { + Files.writeString(dir.resolve("target-error.txt"), trace.toString()); + } catch (Exception error) { + error.printStackTrace(); + } + } + } + + private static DialogPane dialog(String title) { + return Window.getWindows().stream() + .filter(javafx.stage.Stage.class::isInstance) + .map(javafx.stage.Stage.class::cast) + .filter(s -> s.isShowing() && title.equals(s.getTitle())) + .map(s -> (DialogPane) s.getScene().getRoot()) + .findFirst() + .orElse(null); + } + + private static Button change(DialogPane d) { + return (Button) + d.lookupButton( + d.getButtonTypes().stream() + .filter(t -> t.getButtonData() == ButtonBar.ButtonData.OTHER) + .findFirst() + .orElseThrow()); + } + + private static void toggle(Node grid, String header) { + var menu = (MenuButton) grid.lookup(".data-grid-column-menu"); + menu.show(); + var item = + (CheckMenuItem) + menu.getItems().stream() + .filter(i -> header.equals(i.getText())) + .findFirst() + .orElseThrow(); + item.setSelected(!item.isSelected()); + item.fire(); + menu.hide(); + } + + private static String profiles(Parent root, String attempt) throws Exception { + var grid = fx(() -> root.lookup("#grid")); + var profiles = fx(() -> (ComboBox) root.lookup("#folder-view-profile")); + var save = fx(() -> (Button) root.lookup("#save-folder-view-profile")); + var clear = fx(() -> (Button) root.lookup("#clear-folder-view-layout")); + var manage = fx(() -> (Button) root.lookup("#manage-folder-view-profiles")); + boolean readonly = attempt.equals("readonly"), rebound = attempt.equals("rebound"); + await( + "Initial profile", + () -> !manage.isDisabled() && profiles.isDisabled() == readonly && clear.isDisabled()); + String name = readonly ? "Metadaten" : "Prüfprofil"; + fx( + () -> { + require( + !profiles.getItems().contains("Prüfprofil"), + "New session inherited previous profile"); + if (!readonly) profiles.getEditor().setText(name); + require(readonly == save.isDisabled(), "Save availability"); + if (!readonly && !rebound) { + save.fire(); + require(profiles.getItems().contains(name), "Profile not saved"); + } + toggle(grid, "Dateityp"); + return null; + }); + await("Changed local layout", () -> !clear.isDisabled() && !visible(grid, "type")); + fx( + () -> { + clear.fire(); + return null; + }); + await("Restored local layout", () -> clear.isDisabled() && visible(grid, "type")); + var openings = new AtomicInteger(); + String title = "Anzeigeprofile verwalten"; + ListChangeListener shown = + changes -> { + while (changes.next()) + for (Window w : changes.getAddedSubList()) + if (w instanceof javafx.stage.Stage s && title.equals(s.getTitle())) + openings.incrementAndGet(); + }; + fx( + () -> { + Window.getWindows().addListener(shown); + Platform.runLater((rebound ? save : manage)::fire); + return null; + }); + await("Profile manager opened", () -> dialog(title) != null); + fx( + () -> { + var d = dialog(title); + var list = (ListView) d.lookup("#archive-display-profiles"); + if (rebound) require(!list.getItems().contains(name), "Old save handler also ran"); + else { + list.getSelectionModel().select(name); + var action = change(d); + require(action.isDisabled() == readonly, "Profile deletion availability"); + if (!readonly) Platform.runLater(action::fire); + } + return null; + }); + if (!readonly && !rebound) { + Callable confirm = + () -> + Window.getWindows().stream() + .filter(Window::isShowing) + .map(w -> w.getScene().getRoot()) + .filter(DialogPane.class::isInstance) + .map(DialogPane.class::cast) + .filter(d -> d.getButtonTypes().contains(ButtonType.OK)) + .findFirst() + .orElse(null); + await("Delete confirmation", () -> confirm.call() != null); + fx( + () -> { + ((Button) confirm.call().lookupButton(ButtonType.OK)).fire(); + return null; + }); + await("Deleted own profile", () -> !profiles.getItems().contains(name)); + } + fx( + () -> { + ((Button) dialog(title).lookupButton(ButtonType.CLOSE)).fire(); + return null; + }); + fx( + () -> { + Window.getWindows().removeListener(shown); + require( + openings.get() == 1 && dialog(title) == null, + "Expected exactly one profile dialog: " + openings); + return null; + }); + if (rebound) + return "Fresh session. Rebound Save opened exactly one management dialog, without saving a" + + " profile."; + if (readonly) + return "Read-only: archive save, selection and deletion disabled. Management and local" + + " layout change/reset succeeded."; + return "Saved Prüfprofil, hid and restored Dateityp, deleted own profile after confirmation."; + } + + private static Label cell(Node grid, String text) { + return grid.lookupAll(".label").stream() + .filter(Label.class::isInstance) + .map(Label.class::cast) + .filter(l -> text.equals(l.getText())) + .findFirst() + .orElseThrow(() -> new AssertionError(text)); + } + + private static List