diff --git a/README.md b/README.md index 8cdabd3..7b5ba13 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,8 @@ Add `--connection-form` to open or qualify `ConnectionForm.fxml`. After **Build In **Form controls**, select the palette type, destination child list and insertion position, then **Insert control**. Select a control on the canvas or in **Selected control**. **Set property** and **Reset property** edit its FXML, and **Bind property** opens the direct-binding form. For **suggestions**, enter one string per line. To reorder or move a child, choose its destination and position, then **Move to destination**. Each change participates in IntelliJ Undo and Redo. +Use **TabPane / tabs** for a Tab, **SplitPane / items** for an ordered child, or select the named content slot on a Tab, ScrollPane or BorderPane. Add `--media-layout-grid` to the Archiver host check to exercise these destinations, the document media button and the folder grid. [Form and grid editing](docs/user-guide/authoring.md) + Open **Bindings → DataGrid / Docking** in `FolderTab.fxml` to select the grid or one of its columns. **Apply setting** writes the selected property. Clear an optional value to restore its FXML default. **Edit data binding** opens the direct binding for `items` or `source`. The **Archivordner · Beispieldateien** example loads two local files using the grid's declared columns and grouping. In `ArchiveWindow.fxml`, select a layout branch to split it or an outer side area to move it. **Add area with group** creates a destination in an unused area. The **Beispielarchiv** example opens a document and its details in the declared destinations. Both the embedded image and the interactive window use this layout. To repeat both acceptance scenarios, add `--grid-docking ../NeitzelLib/fx-example/src/main/resources/de/neitzel/fx/example/docking/workspace/ReferenceWorkspace.fxml` to the Archiver host check. diff --git a/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/FormDocument.java b/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/FormDocument.java index bc36546..c322436 100644 --- a/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/FormDocument.java +++ b/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/FormDocument.java @@ -14,9 +14,11 @@ final class FormDocument { static { register( "javafx.scene.control", - "Label TextField TextArea PasswordField Button CheckBox ComboBox ToolBar"); + "Label TextField TextArea PasswordField Button CheckBox ComboBox ToolBar Tab TabPane" + + " ScrollPane SplitPane"); register( - "javafx.scene.layout", "GridPane VBox HBox StackPane AnchorPane FlowPane TilePane Pane"); + "javafx.scene.layout", + "GridPane VBox HBox StackPane AnchorPane FlowPane TilePane Pane BorderPane"); register( "de.neitzel.fx.control", "StatusBar ToolBarPane AutoCompleteTextField TagChip NonNegativeIntegerSpinner HtmlViewer"); @@ -107,7 +109,10 @@ final class FormDocument { return switch (type) { case "GridPane", "HBox", "VBox", "StackPane", "Pane", "AnchorPane", "FlowPane", "TilePane" -> List.of("children"); - case "ToolBarPane", "ToolBar" -> List.of("items"); + case "TabPane" -> List.of("tabs"); + case "Tab", "ScrollPane" -> List.of("content"); + case "BorderPane" -> List.of("center", "top", "bottom", "left", "right"); + case "SplitPane", "ToolBarPane", "ToolBar" -> List.of("items"); case "StatusBar" -> List.of("leftItems", "rightItems"); default -> List.of(); }; @@ -174,13 +179,57 @@ final class FormDocument { private List members(Slot slot) { Element host = owner(slot), list = property(host, slot.property()); - if (list == null && slot.owner().type().equals("StatusBar")) return List.of(); - return children(list == null ? host : list).stream() - .filter( - e -> - !BindingDocument.FX.equals(e.getNamespaceURI()) - && Character.isUpperCase(simple(e.getTagName()).charAt(0))) - .toList(); + if (list == null + && (slot.owner().type().equals("StatusBar") || slot.owner().type().equals("BorderPane"))) + return List.of(); + return children(list == null ? host : list).stream().filter(FormDocument::instance).toList(); + } + + private static boolean instance(Element child) { + if (BindingDocument.FX.equals(child.getNamespaceURI())) + return Set.of("include", "reference", "copy").contains(child.getLocalName()); + return Character.isUpperCase(simple(child.getTagName()).charAt(0)); + } + + private static boolean single(Slot slot) { + return slot.property().equals("content") || slot.owner().type().equals("BorderPane"); + } + + String destinationInfo(Slot slot) { + if (slot == null || !single(slot)) return ""; + var host = owner(slot); + if (host.hasAttribute(slot.property())) return "Single place · supplied by an FXML attribute."; + var children = members(slot); + if (!children.isEmpty()) { + var child = children.getFirst(); + boolean movable = items.stream().anyMatch(item -> element(item) == child); + return "Single place · occupied by " + + child.getTagName() + + (movable + ? ". Move that child to a free destination first." + : ". Choose another destination or edit this place in Source."); + } + var wrapper = property(host, slot.property()); + if (wrapper != null && (!children(wrapper).isEmpty() || !wrapper.getTextContent().isBlank())) + return "Single place · supplied by FXML content. Review this place in Source."; + return "Single place · empty"; + } + + private void accept(String type, Slot slot, Element moving) { + if (type.equals("Tab") != slot.property().equals("tabs")) + throw new IllegalArgumentException( + slot.property().equals("tabs") + ? "TabPane.tabs accepts Tab only." + : "A Tab belongs in TabPane.tabs. This destination accepts Nodes."); + if (owner(slot).hasAttribute(slot.property())) + throw new IllegalArgumentException("This destination is supplied by an FXML attribute."); + var wrapper = property(owner(slot), slot.property()); + if (single(slot) + && (members(slot).stream().anyMatch(e -> e != moving) + || wrapper != null + && members(slot).isEmpty() + && (!wrapper.getTextContent().isBlank() || !children(wrapper).isEmpty()))) + throw new IllegalArgumentException("Occupied: " + slot + ". " + destinationInfo(slot)); } int size(Slot slot) { @@ -198,7 +247,8 @@ final class FormDocument { } var container = property(owner, slot.property()); if (container != null) return xml.append(container, snippet, ""); - if (slot.owner().type().equals("StatusBar") + if ((single(slot) && members.isEmpty()) + || slot.owner().type().equals("StatusBar") || (slot.owner().type().equals("ToolBarPane") && members.isEmpty())) snippet = "<" + slot.property() + ">" + snippet + ""; return xml.append(owner, snippet, ""); @@ -234,6 +284,7 @@ final class FormDocument { Edit add(String type, Slot slot, int at) { var host = owner(slot); if (!TYPES.containsKey(type)) throw new IllegalArgumentException("Choose a palette control."); + accept(type, slot, null); String id = fresh(type), prefix = fxPrefix(host), qualified = TYPES.get(type); var edits = new ArrayList(); String tagName = type; @@ -245,7 +296,10 @@ final class FormDocument { } } String extra = - type.equals("Label") || type.equals("Button") || type.equals("TagChip") + type.equals("Label") + || type.equals("Button") + || type.equals("TagChip") + || type.equals("Tab") ? " text=\"" + type + "\"" : ""; if (slot.owner().type().equals("GridPane")) { @@ -292,6 +346,7 @@ final class FormDocument { throw new IllegalArgumentException("Only a child in a supported list can be moved."); for (Node n = host; n != null; n = n.getParentNode()) if (n == source) throw new IllegalArgumentException("Cannot move a control into itself."); + accept(item.type(), slot, source); var current = members(slot); int old = current.indexOf(source); if (old >= 0 && (at == old || at == old + 1)) return edit(List.of(), item.id()); @@ -316,6 +371,14 @@ final class FormDocument { List fields(Item item) { var e = element(item); var fields = new LinkedHashMap(); + if (item.type().equals("Tab")) { + field(fields, "text", "String", ""); + field(fields, "closable", "Boolean", "true"); + field(fields, "disable", "Boolean", "false"); + field(fields, "style", "CSS", ""); + field(fields, "styleClass", "CSS classes", "tab"); + return withSourceFields(e, fields); + } field(fields, "accessibleText", "String", ""); if (Set.of("TextField", "PasswordField", "AutoCompleteTextField").contains(item.type())) field(fields, "prefColumnCount", "Integer", "12"); @@ -394,6 +457,10 @@ final class FormDocument { } for (String name : List.of("width", "height")) fields.put(name, new Field(name, "Number", "layout", false)); + return withSourceFields(e, fields); + } + + private static List withSourceFields(Element e, Map fields) { for (int i = 0; i < e.getAttributes().getLength(); i++) { var a = e.getAttributes().item(i); if (a.getNamespaceURI() == null) diff --git a/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/FormEditor.java b/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/FormEditor.java index 653bd38..6c80258 100644 --- a/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/FormEditor.java +++ b/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/FormEditor.java @@ -10,6 +10,7 @@ import javafx.scene.layout.*; final class FormEditor extends VBox { private final ComboBox palette = combo("form-palette"); private final ComboBox destination = combo("form-destination"); + private final Label destinationInfo = new Label(); private final Spinner position = new Spinner<>(0, 0, 0); private final ComboBox selected = combo("form-control"); private final ComboBox field = combo("form-property"); @@ -75,6 +76,7 @@ final class FormEditor extends VBox { palette.getValue(), destination.getValue(), position.getValue())))), + destinationInfo, row( new Label("Selected control"), selected, @@ -171,6 +173,10 @@ final class FormEditor extends VBox { private void setPosition() { var slot = destination.getValue(); + String hint = form == null ? "" : form.destinationInfo(slot); + destinationInfo.setText(hint); + destinationInfo.setVisible(!hint.isEmpty()); + destinationInfo.setManaged(!hint.isEmpty()); int size = form == null || slot == null ? 0 : form.size(slot); position.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, size, size)); } diff --git a/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/GridDockDocument.java b/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/GridDockDocument.java index bb87478..abe605a 100644 --- a/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/GridDockDocument.java +++ b/designer-kit-ui/src/main/java/de/neitzel/fxdesigner/kit/GridDockDocument.java @@ -13,6 +13,8 @@ final class GridDockDocument { "DataGrid", List.of( "keyAttribute", + "setupId", + "setupVersion", "pageSize", "maximumPageSize", "selectionMode", @@ -33,7 +35,9 @@ final class GridDockDocument { "maximumWidth", "filterable", "checklist", - "groupAttribute"), + "groupAttribute", + "fixedPosition", + "groupLabels"), "DockGroupDefinition", List.of( "destinationId", @@ -177,9 +181,54 @@ final class GridDockDocument { return id; } + Map groupLabels(Element column) { + var names = new TreeMap(); + var map = property(column, "groupLabels"); + if (map != null) + for (int i = 0; i < map.getAttributes().getLength(); i++) { + var attr = map.getAttributes().item(i); + if (attr.getNamespaceURI() == null + && literalKey(attr.getNodeName()) + && !reference(attr.getNodeValue())) + names.put(attr.getNodeName(), attr.getNodeValue().replaceFirst("^\\\\", "")); + } + return names; + } + + private static boolean literalKey(String key) { + // FXMLLoader reads an inline, read-only Map's ordinary property attributes as keys. + return key.matches("[\\p{L}_][\\p{L}\\p{N}_-]*") + && !key.equals("xmlns") + && !key.startsWith("on"); + } + + private static boolean reference(String text) { + return !text.isEmpty() && "%@$".indexOf(text.charAt(0)) >= 0; + } + + List groupLabel(Element column, String key, String label, boolean remove) { + if (!type(column).equals("DataGridColumn") || !literalKey(key)) + throw new IllegalArgumentException( + "Use a literal FXML map key (letters, digits, underscores or hyphens)."); + if (column.hasAttribute("groupLabels")) + throw new IllegalArgumentException("This groupLabels map is supplied by an attribute."); + var map = property(column, "groupLabels"); + if (map != null && (property(map, key) != null || reference(map.getAttribute(key)))) + throw new IllegalArgumentException("This key is supplied by a nested value or reference."); + if (remove && (map == null || !map.hasAttribute(key))) return List.of(); + if (!remove && label.isBlank()) throw new IllegalArgumentException("Enter a group label."); + String encoded = (reference(label) || label.startsWith("\\")) ? "\\" + label : label; + if (map == null) + return List.of( + xml.append( + column, "", "")); + return xml.source.attributes( + xml.elements.indexOf(map), Collections.singletonMap(key, remove ? null : encoded)); + } + List set(Element e, String field, String value) { if (!SETTINGS.getOrDefault(type(e), List.of()).contains(field) - || Set.of("items", "source").contains(field)) + || Set.of("items", "source", "groupLabels").contains(field)) throw new IllegalArgumentException("Use a model binding for the data input."); if (property(e, field) != null) throw new IllegalArgumentException( @@ -210,6 +259,15 @@ final class GridDockDocument { && Set.of("pageSize", "maximumPageSize").contains(field) && Integer.parseInt(value) < 1) throw new IllegalArgumentException("Positive page size required"); + if (field.equals("setupVersion") && !value.isEmpty() && Integer.parseInt(value) < 1) + throw new IllegalArgumentException("Setup version must be a positive integer."); + if (field.equals("fixedPosition") && !value.isEmpty()) { + int index = branches(parentOfType(e, "DataGrid")).indexOf(e); + int fixed = Integer.parseInt(value); + if (fixed != -1 && fixed != index) + throw new IllegalArgumentException( + "Use " + index + " for this column, or -1 to allow moving it."); + } var edits = new ArrayList(); if (field.equals("destinationId") && destinations(e).stream().anyMatch(c -> c != e && c.getAttribute(field).equals(value))) @@ -273,13 +331,24 @@ final class GridDockDocument { if (index < 0) throw new IllegalArgumentException("Select a column."); if (index + delta < 0 || index + delta >= columns.size()) return List.of(); var other = columns.get(index + delta); + if (fixed(col) || fixed(other)) + throw new IllegalArgumentException("Clear the fixed position before moving these columns."); return List.of(replace(other, fragment(col)), replace(col, fragment(other))); } + private boolean fixed(Element col) { + return property(col, "fixedPosition") != null + || col.hasAttribute("fixedPosition") && !col.getAttribute("fixedPosition").equals("-1"); + } + List removeColumn(Element col) { if (!type(col).equals("DataGridColumn")) throw new IllegalArgumentException("Select a column."); if (grouped(parentOfType(col, "DataGrid")).contains(col.getAttribute("id"))) throw new IllegalArgumentException("Remove the column from groupBy first."); + var columns = branches(parentOfType(col, "DataGrid")); + if (columns.subList(columns.indexOf(col) + 1, columns.size()).stream().anyMatch(this::fixed)) + throw new IllegalArgumentException( + "Removing this column shifts a fixed column. Clear its fixed position first."); var span = tag(col); int start = xml.text.lastIndexOf('\n', span.start() - 1) + 1; int end = xml.text.indexOf('\n', span.end()); 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 47590d4..f407447 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 @@ -13,6 +13,13 @@ final class GridDockEditor extends VBox { private final ComboBox setting = new ComboBox<>(), value = new ComboBox<>(), area = new ComboBox<>(); + private final ComboBox groupKey = new ComboBox<>(); + private final TextField groupText = new TextField(); + private final FlowPane groupFields = new FlowPane(6, 4); + private final Label setupHint = + new Label( + "Saved setups use the setup ID and version. Restoring an older version requires a" + + " migration."); private final Label message = new Label(), signals = new Label( @@ -55,6 +62,38 @@ final class GridDockEditor extends VBox { () -> doc.set( selected(), setting.getValue(), value.getEditor().getText().trim()))); + groupKey.setId("group-label-key"); + groupKey.setEditable(true); + groupKey.setPromptText("Group key"); + groupText.setId("group-label-text"); + groupText.setPromptText("Displayed label"); + groupKey.setOnAction( + event -> { + if (selected() != null && groupKey.getValue() != null) + groupText.setText(doc.groupLabels(selected()).getOrDefault(groupKey.getValue(), "")); + }); + groupFields + .getChildren() + .addAll( + groupKey, + groupText, + button( + "Set group label", + () -> + edit( + () -> + doc.groupLabel( + selected(), + groupKey.getEditor().getText(), + groupText.getText(), + false))), + button( + "Remove group label", + () -> + edit( + () -> + doc.groupLabel(selected(), groupKey.getEditor().getText(), "", true)))); + setupHint.setWrapText(true); bind = button( "Edit data binding", @@ -82,6 +121,8 @@ final class GridDockEditor extends VBox { tree, new FlowPane(6, 4, setting, value, apply, bind), new FlowPane(6, 4, add, earlier, later, remove, area, addArea, moveArea, split), + groupFields, + setupHint, signals, message); tree.getSelectionModel().selectedItemProperty().addListener((o, a, b) -> select()); @@ -185,7 +226,17 @@ final class GridDockEditor extends VBox { String field = setting.getValue(); var e = selected(); boolean input = "items".equals(field) || "source".equals(field); - boolean editable = e != null && field != null && !input; + boolean labels = e != null && "groupLabels".equals(field); + visible(groupFields, labels); + visible(setupHint, "setupId".equals(field) || "setupVersion".equals(field)); + if (labels) { + groupKey.getItems().setAll(doc.groupLabels(e).keySet()); + groupKey.getSelectionModel().clearSelection(); + groupKey.getEditor().clear(); + groupText.clear(); + groupKey.getSelectionModel().selectFirst(); + } + boolean editable = e != null && field != null && !input && !labels; visible(bind, input); visible(apply, editable); visible(value, editable); diff --git a/designer-kit-ui/src/test/java/de/neitzel/fxdesigner/kit/FormDocumentTest.java b/designer-kit-ui/src/test/java/de/neitzel/fxdesigner/kit/FormDocumentTest.java index 60070bc..f768b39 100644 --- a/designer-kit-ui/src/test/java/de/neitzel/fxdesigner/kit/FormDocumentTest.java +++ b/designer-kit-ui/src/test/java/de/neitzel/fxdesigner/kit/FormDocumentTest.java @@ -45,6 +45,28 @@ class FormDocumentTest { apply(doc.set(item, field, value == null ? "" : value, value == null)); } + @Test + void singleSlotsRespectReferencesAndDefaultTabContent() throws Exception { + source = + """ + + + +
+ +
+
+ """; + add("Tab", "tabs", "tabs"); + assertThrows(IllegalArgumentException.class, () -> add("Label", "first", "content")); + assertThrows(IllegalArgumentException.class, () -> add("Label", "scroll", "content")); + assertThrows(IllegalArgumentException.class, () -> add("Label", "", "bottom")); + assertThrows(IllegalArgumentException.class, () -> add("Label", "tabs", "tabs")); + apply(doc().move(item("scroll"), slot("tab", "content"), 0)); + assertTrue(source.contains("")); + add("Label", "first", "content"); + } + @Test void emptyGridAndNamedListsKeepReferencesAndRejectCycles() throws Exception { assertEquals( diff --git a/designer-kit-ui/src/test/java/de/neitzel/fxdesigner/kit/GridDockDocumentTest.java b/designer-kit-ui/src/test/java/de/neitzel/fxdesigner/kit/GridDockDocumentTest.java index f2aee43..c63c875 100644 --- a/designer-kit-ui/src/test/java/de/neitzel/fxdesigner/kit/GridDockDocumentTest.java +++ b/designer-kit-ui/src/test/java/de/neitzel/fxdesigner/kit/GridDockDocumentTest.java @@ -5,6 +5,25 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class GridDockDocumentTest { + @Test + void updatingOneGroupLabelRetainsReferencesCommentsAndNestedEntries() throws Exception { + String source = + """ + + + + """; + var doc = new GridDockDocument(source); + var col = doc.branches(doc.roots().getFirst()).getFirst(); + assertEquals( + source.replace("Post='old'", "Post='Post & Briefe'"), + doc.xml.source.apply(doc.groupLabel(col, "Post", "Post & Briefe", false))); + assertThrows( + IllegalArgumentException.class, () -> doc.groupLabel(col, "other", "changed", false)); + assertThrows(IllegalArgumentException.class, () -> doc.groupLabel(col, "custom", "", true)); + assertThrows(IllegalArgumentException.class, () -> doc.set(col, "fixedPosition", "2")); + } + @Test void implicitRowAttributeAndGroupingSurviveRename() throws Exception { var source = diff --git a/docs/user-guide/authoring.md b/docs/user-guide/authoring.md index 6e5f6e8..8dcad44 100644 --- a/docs/user-guide/authoring.md +++ b/docs/user-guide/authoring.md @@ -45,3 +45,13 @@ Errors block new previews; warnings remain visible and permit preview. Stale dia In **Form controls**, select a control and property. **Set property** writes the FXML attribute. **Reset property** removes it and restores its JavaFX default. The accessible name is inherited from Node. Text fields including AutoCompleteTextField accept a non-negative integer for `prefColumnCount`. Layout results such as `width` are read-only. After **Build and Refresh**, select `onAction` on a supported action control, `onDismiss` on ToolBarPane, or `onRemove` on TagChip. Choose a compiled controller method in the list, or enter its `#method` reference and select **Set property**. The target checks accessible no-argument methods and methods accepting ActionEvent or Event, including inherited and FXML-annotated handlers. Without current controller metadata the inspector indicates that a build is needed for method checking. Undo, Redo and Save use the same FXML document as the bindings editor. + +### Tabs, split panes and border panes + +In **Form controls**, choose **Tab** from the palette and **TabPane / tabs** as the destination. Set its text under **Selected control**. Select **Tab / content** to add a layout or a ScrollPane. Each Tab, ScrollPane and named BorderPane region has one content slot. The inspector shows its occupant. To reuse an occupied slot, move its existing control to a free destination first. **Move to destination** keeps the subtree, its identifiers, event handlers and bindings together. For **SplitPane / items**, **Position** is the zero-based insertion index. + +### Grid setups and group headings + +Under **Bindings → DataGrid / Docking**, select the grid to edit `setupId` or `setupVersion`. Clear the field and use **Apply setting** to restore the default. Persisted settings identify the grid by its setup ID. Restoring an older definition version requires a migration for that version. + +Select a column and set `fixedPosition` to its current zero-based index. Clear the field or enter `-1` to make it movable. Under `groupLabels`, select or enter a literal FXML map key and its display text, then use **Set group label** or **Remove group label**. For the Archiver folder example, group by `folder` and label `Post` as **Posteingang**. Collapsing that heading still stores the key `Post`. Keys represented by resource references or nested declarations can be reviewed in **Source**. diff --git a/integration-tests/idea/MediaLayoutGridTargetProbe.java b/integration-tests/idea/MediaLayoutGridTargetProbe.java new file mode 100644 index 0000000..2351bcb --- /dev/null +++ b/integration-tests/idea/MediaLayoutGridTargetProbe.java @@ -0,0 +1,362 @@ +package qualification; + +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicBoolean; +import javafx.application.Platform; +import javafx.beans.value.*; +import javafx.event.ActionEvent; +import javafx.scene.*; +import javafx.scene.control.*; +import javafx.scene.layout.*; +import javafx.stage.*; +import javax.imageio.ImageIO; + +/** Acts on the actual controls in the interactive Archiver worker. */ +public final class MediaLayoutGridTargetProbe { + public static void premain(String dir) { + if (System.getProperty("sun.java.command", "") + .startsWith("de.neitzel.fxdesigner.target.WorkerMain ")) + Thread.ofPlatform().daemon().start(() -> Worker.run(Path.of(dir))); + } + + private static final class Worker { + private static T fx(Callable action) throws Exception { + var task = new FutureTask<>(action); + Platform.runLater(task); + return task.get(10, TimeUnit.SECONDS); + } + + private static void require(boolean value, String message) { + if (!value) throw new AssertionError(message); + } + + 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; + var attempt = Files.readString(dir.resolve("layout-case")); + fx( + () -> { + shown.setWidth(1180); + shown.setHeight(660); + return null; + }); + await( + "Resized interactive preview", + () -> shown.getScene().getWidth() >= 1100 && shown.getScene().getHeight() >= 550); + var root = + fx( + () -> { + var node = shown.getScene().getRoot(); + node.applyCss(); + node.layout(); + return node; + }); + String result = + switch (attempt) { + case "offline" -> fx(() -> offline(root)); + case "details" -> fx(() -> details(root, dir)); + case "trash" -> fx(() -> trash(root, dir)); + case "media" -> media(root, dir); + case "grid" -> fx(() -> grid(root, dir)); + default -> throw new IllegalArgumentException(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 ignored) { + } + } + } + + private static String offline(Node root) { + var media = (Button) root.lookup("#external-media-load"); + require( + media.isDisabled() && media.getAccessibleText().equals("Belegbilder laden"), + "Offline: " + media.getAccessibleText()); + require(media.getTooltip().getText().contains("Keine auflösbaren"), "Offline tooltip"); + return "Rechnung ohne Medien · gespeicherter Aktionsname, Tooltip und gesperrter Button"; + } + + private static String details(Parent root, Path dir) throws Exception { + var tabs = (TabPane) root; + require( + tabs.getTabs().stream() + .map(Tab::getText) + .toList() + .equals(List.of("Tags", "Datei", "Belegprüfung")), + "Tab order"); + var moved = tabs.getTabs().getLast(); + tabs.getSelectionModel().select(moved); + root.applyCss(); + root.layout(); + var scroll = (ScrollPane) moved.getContent(); + var box = (HBox) scroll.getContent(); + var input = (TextField) box.lookup("#tag-input"); + require(input != null && tabs.getTabs().getFirst().getContent() == null, "Moved HBox"); + require( + ((List) input.getClass().getMethod("getSuggestionsSource").invoke(input)) + .contains("Beleg geprüft"), + "Bound suggestions"); + input.setText("Beleg geprüft"); + input.fireEvent(new ActionEvent()); + require(box.lookupAll(".tag-chip").size() == 2, "Moved tag handler and Repeat"); + image(root, dir.resolve("details-moved.png")); + return "Dritter Tab → ScrollPane → ursprüngliche HBox · Vorschlagsquelle, onAction und beide" + + " TagChips wirksam"; + } + + private static String trash(Parent root, Path dir) throws Exception { + var split = (SplitPane) root.lookup(".split-pane"); + require( + split.getItems().size() == 3 + && "trash-items".equals(split.getItems().getFirst().getId()) + && split.getItems().get(1) instanceof Label l + && "Dateien der Auswahl".equals(l.getText()) + && "trash-files".equals(split.getItems().getLast().getId()), + "SplitPane order"); + require( + ((TableView) split.getItems().getLast()).getItems().size() == 2, + "Selected folder files"); + image(root, dir.resolve("trash-split.png")); + return "Beschriftung an Position 2 zwischen beiden Tabellen · zwei Dateien im markierten" + + " Ordner"; + } + + private static void await(String name, Callable test) throws Exception { + long end = System.nanoTime() + TimeUnit.SECONDS.toNanos(14); + while (System.nanoTime() < end) { + if (fx(test)) return; + Thread.sleep(60); + } + throw new AssertionError(name); + } + + private static Object get(Object target, String method) throws Exception { + return target.getClass().getMethod(method).invoke(target); + } + + private static String media(Parent root, Path dir) throws Exception { + var group = + fx( + () -> + root.lookupAll(".tab-pane").stream() + .map(TabPane.class::cast) + .filter( + p -> + p.getTabs().stream() + .anyMatch(t -> t.getText().equals("Rechnung.html"))) + .findFirst() + .orElseThrow()); + fx( + () -> { + require( + root instanceof BorderPane p + && p.getLeft() instanceof Label l + && l.getText().equals("Medienprüfung") + && p.getCenter().lookup("#dockPane") != null, + "BorderPane and docking"); + return null; + }); + var invoice = select(group, "Rechnung.html"); + fx(() -> offline(invoice)); + var delivery = select(group, "Lieferschein.html"); + var viewer = fx(() -> delivery.lookup("#html-document")); + var button = fx(() -> (Button) delivery.lookup("#external-media-load")); + var blockedDuringLoad = new AtomicBoolean(); + fx( + () -> { + require( + ((Label) root.lookup("#status")).getText().equals("Lokale Bildanfragen · 0"), + "Request before grant"); + require( + !button.isDisabled() + && button.getAccessibleText().equals("Belegbilder laden") + && button.getTooltip().getText().contains("Belegbilder laden") + && button.getTooltip().getText().contains("Kontaktiert die Bildserver"), + "Delivery action"); + var loading = (ObservableBooleanValue) get(viewer, "loadingProperty"); + loading.addListener( + (obs, old, active) -> { + if (active && button.isDisabled()) blockedDuringLoad.set(true); + }); + button.fire(); + return null; + }); + await( + "Granted image and request", + () -> { + var engine = get(viewer.lookup("WebView"), "getEngine"); + var pixels = + engine + .getClass() + .getMethod("executeScript", String.class) + .invoke(engine, "document.images.length ? document.images[0].naturalWidth : 0"); + return ((Label) root.lookup("#status")).getText().equals("Lokale Bildanfragen · 1") + && !button.isDisabled() + && ((Number) pixels).intValue() == 24; + }); + fx( + () -> { + require( + blockedDuringLoad.get() + && (boolean) get(viewer, "isExternalImagesAllowed") + && button.getAccessibleText().equals("Externe Medien erneut laden"), + "Loading / reload states"); + image(root, dir.resolve("media-granted.png")); + return null; + }); + var other = select(group, "Rechnung.html"); + fx( + () -> { + offline(other); + require( + !(boolean) get(other.lookup("#html-document"), "isExternalImagesAllowed"), + "Invoice inherited grant"); + return null; + }); + select(group, "Lieferschein.html"); + fx( + () -> { + require( + !button.isDisabled() && button.getAccessibleText().contains("erneut"), + "Return to delivery"); + button.fire(); + return null; + }); + await( + "Reload reached loopback", + () -> + ((Label) root.lookup("#status")).getText().equals("Lokale Bildanfragen · 2") + && !button.isDisabled()); + return "BorderPane.left mit intaktem Docking · HTTP-Anfragen 0 → 1 → 2 · Bildbreite 24 px," + + " Ladesperre, erneutes Laden und tabbezogene Freigabe geprüft"; + } + + private static Node select(TabPane tabs, String title) throws Exception { + return fx( + () -> { + var tab = + tabs.getTabs().stream() + .filter(t -> title.equals(t.getText())) + .findFirst() + .orElseThrow(); + tabs.getSelectionModel().select(tab); + tabs.applyCss(); + tabs.layout(); + return tab.getContent(); + }); + } + + private static String grid(Parent root, Path dir) throws Exception { + Node grid = root.lookup("#grid"); + var setup = get(grid, "snapshotSetup"); + require( + get(setup, "definitionId").equals("archiver-pruefung") + && get(setup, "definitionVersion").equals(2), + "Setup identity"); + var cols = (List) get(setup, "columns"); + var order = new ArrayList(); + for (var col : cols) order.add((String) get(col, "id")); + require(order.get(1).equals("folder"), "Column position"); + Collections.swap(order, 0, 1); + try { + grid.getClass().getMethod("setColumnOrder", List.class).invoke(grid, order); + throw new AssertionError("Fixed column displaced"); + } catch (InvocationTargetException ex) { + require( + ex.getCause() instanceof IllegalArgumentException + && ex.getCause().getMessage().contains("Fixed"), + "Fixed position check"); + } + var heading = + grid.lookupAll(".group-heading").stream() + .map(Button.class::cast) + .filter(b -> b.getText().contains("Posteingang")) + .findFirst() + .orElseThrow(); + require( + grid.lookupAll(".group-heading").stream() + .map(Button.class::cast) + .anyMatch(b -> b.getText().contains("Rechnungen")), + "Other group"); + image(root, dir.resolve("grid-group.png")); + heading.fire(); + var grouping = get(get(grid, "snapshotSetup"), "grouping"); + var choice = ((List) get(grouping, "choices")).getFirst(); + var segment = ((List) get(get(choice, "path"), "segments")).getFirst(); + require( + get(segment, "columnId").equals("folder") + && get(get(segment, "value"), "value").equals("Post"), + "Changed group key"); + for (String id : List.of("archive-folder", "archiver-pruefung")) { + var fields = setup.getClass().getRecordComponents(); + Object[] values = new Object[fields.length]; + for (int i = 0; i < fields.length; i++) + values[i] = + switch (fields[i].getName()) { + case "definitionId" -> id; + case "definitionVersion" -> 1; + default -> fields[i].getAccessor().invoke(setup); + }; + var old = + setup + .getClass() + .getConstructor( + Arrays.stream(fields).map(RecordComponent::getType).toArray(Class[]::new)) + .newInstance(values); + grid.getClass().getMethod("restoreSetup", setup.getClass()).invoke(grid, old); + var state = ((ObservableValue) get(grid, "stateProperty")).getValue(); + var error = (Throwable) get(state, "error"); + require( + error != null + && error + .getMessage() + .contains( + id.equals("archive-folder") + ? "another grid definition" + : "Missing definition migration"), + "Wrong setup restore " + error); + } + return "Setup archiver-pruefung/2 · fremde ID und alte Version abgewiesen · folder fest an" + + " Index 1 · Posteingang sichtbar, Gruppenschlüssel Post"; + } + + private 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); + int[] pixels = new int[w * h]; + img.getPixelReader() + .getPixels(0, 0, w, h, javafx.scene.image.PixelFormat.getIntArgbInstance(), pixels, 0, w); + out.setRGB(0, 0, w, h, pixels, 0, w); + ImageIO.write(out, "png", path.toFile()); + } + } +} diff --git a/integration-tests/idea/MediaLayoutGridWorkflowProbe.java b/integration-tests/idea/MediaLayoutGridWorkflowProbe.java new file mode 100644 index 0000000..08672bc --- /dev/null +++ b/integration-tests/idea/MediaLayoutGridWorkflowProbe.java @@ -0,0 +1,336 @@ +package qualification; + +import static qualification.WorkflowProbe.*; + +import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.LocalFileSystem; +import de.neitzel.fxdesigner.workflow.DesignerWorkflow.Example; +import java.nio.file.*; +import java.util.*; +import javafx.embed.swing.SwingFXUtils; +import javafx.scene.control.*; +import javafx.scene.image.ImageView; +import javax.imageio.ImageIO; +import org.w3c.dom.Element; + +/** Edits original Archiver forms in the registered IntelliJ designer. */ +public final class MediaLayoutGridWorkflowProbe extends FormWorkflowProbe { + private Project project; + + void verify(Project project) throws Exception { + this.project = project; + open("HtmlDocument"); + controls(true); + choose("form-control", "HtmlViewer #article"); + set("mediaLoadText", "Belegbilder laden", "mediaLoadText=\"Belegbilder laden\""); + reopen("HtmlDocument", "Belegbilder laden"); + build("html-invoice"); + interactive("html-invoice", "offline"); + details(); + trash(); + window(); + folder(); + Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt"))); + } + + private void insert(String type, String slot, int position, String id) throws Exception { + choose("form-palette", type); + choose("form-destination", slot); + if (position >= 0) + fx( + () -> { + ((Spinner) pane.lookup("#form-position")).getValueFactory().setValue(position); + return null; + }); + String before = source(); + click(pane, "Insert control"); + edited(before, "fx:id=\"" + id + "\""); + } + + private void reject(String type, String slot, String reason) throws Exception { + choose("form-palette", type); + choose("form-destination", slot); + String before = source(); + click(pane, "Insert control"); + if (!before.equals(source()) + || !fx(() -> ((Label) pane.lookup("#form-message")).getText()).contains(reason)) + throw new AssertionError("Expected " + reason); + } + + private void history(String before, String after) throws Exception { + click(pane, "Undo"); + await(() -> source().equals(before)); + click(pane, "Redo"); + await(() -> source().equals(after)); + fx(pane::flush).toCompletableFuture().get(); + } + + private List declarations() throws Exception { + return source() + .lines() + .map(String::trim) + .filter( + l -> + l.startsWith(" + ((ComboBox) pane.lookup("#form-destination")) + .getItems().stream() + .map(Object::toString) + .filter(v -> v.startsWith("BorderPane [") && v.endsWith(" / left")) + .findFirst() + .orElseThrow()); + String owner = left.substring(0, left.lastIndexOf(" / ")); + for (String region : List.of("center", "top", "bottom", "left", "right")) { + choose("form-destination", owner + " / " + region); + } + reject("Label", owner + " / center", "Occupied"); + insert("Label", left, 0, "label"); + choose("form-control", "Label #label"); + set("text", "Medienprüfung", "text=\"Medienprüfung\""); + reopen("ArchiveWindow", "Medienprüfung"); + build("archive-window-media"); + interactive("archive-window-media", "media"); + } + + private void folder() throws Exception { + open("FolderTab"); + inspector(true); + var original = declarations(); + select("DataGrid", "grid"); + gridSet("setupId", "archiver-pruefung"); + gridSet("setupVersion", "2"); + for (var pair : + List.of(List.of("setupId", "archiver-pruefung"), List.of("setupVersion", "2"))) { + String before = source(); + combo("declaration-property", pair.getFirst()); + fx( + () -> { + ((ComboBox) pane.lookup("#declaration-value")).getEditor().clear(); + return null; + }); + click(pane, "Apply setting"); + await(() -> !source().contains(pair.getFirst() + "=\"")); + click(pane, "Undo"); + await(() -> source().equals(before)); + } + gridSet("groupBy", "folder"); + select("DataGridColumn", "folder"); + gridSet("fixedPosition", "1"); + combo("declaration-property", "groupLabels"); + fx( + () -> { + ((ComboBox) pane.lookup("#group-label-key")).getEditor().setText("Post"); + ((TextField) pane.lookup("#group-label-text")).setText("Posteingang"); + return null; + }); + String before = source(); + edit("Set group label", "Post=\"Posteingang\""); + String grouped = source(); + history(before, grouped); + combo("declaration-property", "groupLabels"); + choose("group-label-key", "Post"); + click(pane, "Remove group label"); + await(() -> !source().contains("Post=\"Posteingang\"")); + click(pane, "Undo"); + await(() -> source().equals(grouped)); + reopen("FolderTab", "Posteingang"); + if (!original.equals(declarations())) throw new AssertionError("Grid bindings"); + inspector(true); + select("DataGridColumn", "folder"); + combo("declaration-property", "groupLabels"); + if (!fx(() -> ((TextField) pane.lookup("#group-label-text")).getText().equals("Posteingang"))) + throw new AssertionError("Reopened mapping"); + fx( + () -> { + ImageIO.write( + SwingFXUtils.fromFXImage(pane.snapshot(null, null), null), + "png", + output.resolve("intellij.png").toFile()); + return null; + }); + build("archive-folder"); + interactive("archive-folder", "grid"); + } + + private void open(String name) throws Exception { + var path = + Path.of(project.getBasePath(), "src/main/resources/de/neitzel/archiver/ui", name + ".fxml"); + file = edt(() -> LocalFileSystem.getInstance().refreshAndFindFileByNioFile(path)); + pane = openDesigner(project, file); + if (!source().contains(" + fx( + () -> + ((ComboBox) pane.lookup("#preview-example")) + .getItems().stream().anyMatch(item -> item.toString().contains(id)))); + } + + private void interactive(String id, String attempt) throws Exception { + choose("preview-example", id); + await( + () -> + fx( + () -> { + var state = ((Label) pane.lookup("#preview-state")).getText(); + if (state.startsWith("Preview failed") + || state.startsWith("Preview blocked") + || state.startsWith("Preview unavailable")) + throw new AssertionError(id + " · " + state); + var choice = (Example) ((ComboBox) pane.lookup("#preview-example")).getValue(); + return ((ImageView) pane.lookup("#full-preview-image")).getImage() != null + && state.contains(choice.label()); + })); + Files.writeString(output.resolve("layout-case"), attempt); + click(pane, "Interactive preview"); + String name = "result-" + attempt; + awaitTarget(name); + step(id + " · " + Files.readString(output.resolve(name))); + click(pane, "Stop preview"); + } + + private void reopen(String form, String saved) throws Exception { + click(pane, "Save"); + await(() -> Files.readString(Path.of(file.getPath())).contains(saved)); + edt( + () -> { + FileEditorManager.getInstance(project).closeFile(file); + return null; + }); + open(form); + if (!source().contains(saved)) throw new AssertionError("Reopened " + form); + } + + private void inspector(boolean expanded) throws Exception { + fx( + () -> { + var panel = + (TitledPane) + pane.lookupAll(".titled-pane").stream() + .filter(n -> n instanceof TitledPane t && t.getText().equals("Bindings")) + .findFirst() + .orElseThrow(); + panel.setAnimated(false); + panel.setExpanded(expanded); + var tabs = (TabPane) panel.getContent(); + tabs.getSelectionModel() + .select( + tabs.getTabs().stream() + .filter(t -> t.getText().equals("DataGrid / Docking")) + .findFirst() + .orElseThrow()); + pane.applyCss(); + pane.layout(); + return null; + }); + } + + private void select(String name, String id) throws Exception { + fx( + () -> { + var tree = (TreeView) pane.lookup("#declaration-tree"); + for (int i = 0; i < tree.getExpandedItemCount(); i++) { + var item = tree.getTreeItem(i); + var e = item.getValue(); + String tag = e.getTagName(); + if ((tag.equals(name) || tag.endsWith("." + name)) + && (id.isEmpty() + || e.getAttribute("fx:id").equals(id) + || e.getAttribute("id").equals(id) + || e.getAttribute("destinationId").equals(id))) { + tree.getSelectionModel().select(item); + return null; + } + } + throw new AssertionError("Missing " + name + " " + id); + }); + } + + private void combo(String name, String text) throws Exception { + fx( + () -> { + var box = (ComboBox) pane.lookup("#" + name); + box.setValue(text); + return null; + }); + } + + private void edit(String button, String expected) throws Exception { + String before = source(); + click(pane, button); + await( + () -> { + String now = source(); + var msg = fx(() -> ((Label) pane.lookup("#declaration-message")).getText()); + if (!msg.isEmpty()) throw new AssertionError(msg); + return !now.equals(before) + && now.contains(expected) + && fx( + () -> + ((TextArea) pane.lookup("#fxml-source")) == null + || ((TextArea) pane.lookup("#fxml-source")).getText().equals(now)); + }); + fx(pane::flush).toCompletableFuture().get(); + step(button + " · " + expected); + } + + private void gridSet(String field, String value) throws Exception { + combo("declaration-property", field); + fx( + () -> { + ((ComboBox) pane.lookup("#declaration-value")).getEditor().setText(value); + return null; + }); + edit("Apply setting", field + "=\"" + value + "\""); + } +} diff --git a/scripts/check-ide-host.py b/scripts/check-ide-host.py index 1d76f1f..65a5401 100644 --- a/scripts/check-ide-host.py +++ b/scripts/check-ide-host.py @@ -26,13 +26,14 @@ p.add_argument("--archiver", type=Path, help="Qualify ArchiveWindow.fxml in a di forms = p.add_mutually_exclusive_group() forms.add_argument("--connection-form", action="store_true", help="Qualify the Archiver connection form") forms.add_argument("--grid-docking", type=Path, metavar="REFERENCE_FXML", help="Qualify the Archiver grid, dock layout and the supplied reference workspace") +forms.add_argument("--media-layout-grid", action="store_true", help="Verify media permissions, form destinations and grid setups in the Archiver") forms.add_argument("--management-readers", action="store_true", help="Verify account and trash commands and the five reader toolbars") forms.add_argument("--folder-actions", action="store_true", help="Check visual event references, folder search, selection and display profiles") forms.add_argument("--import-form", action="store_true", help="Check generic binding types and the Archiver import collision") forms.add_argument("--document-tabs", action="store_true", help="Qualify the production Archiver HTML document tabs") forms.add_argument("--saved-document", action="store_true", help="Open the Archiver saved HTML and tag example") args = p.parse_args() -if (args.connection_form or args.grid_docking or args.saved_document or args.document_tabs or args.import_form or args.folder_actions or args.management_readers) and not args.archiver: +if (args.connection_form or args.grid_docking or args.saved_document or args.document_tabs or args.import_form or args.folder_actions or args.management_readers or args.media_layout_grid) and not args.archiver: p.error("Selecting an Archiver view requires --archiver") if args.repeat < 1: p.error("--repeat must be positive") @@ -44,7 +45,7 @@ modes = ("classpath",) if args.archiver else (("classpath", "modulepath") if arg for run_number, mode in ((n, mode) for n in range(1, args.repeat + 1) for mode in modes): crashes = NativeCrashGuard(ROOT) launch = subprocess.run([sys.executable, ROOT / "scripts/run-fixture-host.py", "intellij", - "--check", *(["--management-readers"] if args.management_readers else []), *(["--folder-actions"] if args.folder_actions else []), *(["--import-form"] if args.import_form else []), *(["--document-tabs"] if args.document_tabs else []), *(["--saved-document"] if args.saved_document else []), *(["--grid-docking", str(args.grid_docking.resolve())] if args.grid_docking else []), *(["--connection-form"] if args.connection_form else []), *(["--archiver", str(args.archiver.resolve())] if args.archiver else []), "--mode", mode, "--java-home", args.java_home, + "--check", *(["--media-layout-grid"] if args.media_layout_grid else []), *(["--management-readers"] if args.management_readers else []), *(["--folder-actions"] if args.folder_actions else []), *(["--import-form"] if args.import_form else []), *(["--document-tabs"] if args.document_tabs else []), *(["--saved-document"] if args.saved_document else []), *(["--grid-docking", str(args.grid_docking.resolve())] if args.grid_docking else []), *(["--connection-form"] if args.connection_form else []), *(["--archiver", str(args.archiver.resolve())] if args.archiver else []), "--mode", mode, "--java-home", args.java_home, "--target-java-home", args.target_java_home, "--idea-home", args.idea_home], cwd=ROOT, text=True, capture_output=True, timeout=60) if launch.returncode: @@ -88,7 +89,7 @@ for run_number, mode in ((n, mode) for n in range(1, args.repeat + 1) for mode i shutil.copyfile(base / "intellij.png", output / (mode + ".png")) (evidence / "proof.json").write_text(json.dumps(proof, indent=2) + "\n") finally: - for name in ("reader-pdf.png", "reader-epub.png", "reader-slides.png", "reader-attachment.png", "management-accounts.png", "management-trash.png", "reader-icon.png", "folder-events.png", "folder-search.png", "folder-profile.png", "result-folder-actions", "result-detail-action", "details-invoice-tags.png", "details-delivery-tags.png", "details-invoice.png", "details-delivery.png", "details-readonly.png", "details-busy.png", "html-invoice.png", "html-delivery.png", "rechnung-zwei-tags.png", "import-collision.png", "import-accepted.png", "result-import-free", "result-import-busy", "result-import-collision", "result-import-grid", "SUCCESS.txt", "FAILURE.txt", "ui-state.txt", "launcher.log", "steps.txt", "target-error.txt", "preview-restored.png", "imap.png", "jmap.png", "invoice.png", "delivery.png", "saved-document-result", "saved-bindings.fxml", "binding-article.png", "binding-dynamic.png", "tags-Pr.png", "tags-Re.png", "tags-Li.png", "document-tabs-result", "rechnung-tab.png", "lieferschein-tab.png", "rechnung-tab-tags.png", "lieferschein-tab-tags.png", "folder.png", "right.png", "bottom.png", "result-folder", "result-right", "result-bottom", "intellij.png"): + for name in ("media-granted.png", "details-moved.png", "trash-split.png", "grid-group.png", "reader-pdf.png", "reader-epub.png", "reader-slides.png", "reader-attachment.png", "management-accounts.png", "management-trash.png", "reader-icon.png", "folder-events.png", "folder-search.png", "folder-profile.png", "result-folder-actions", "result-detail-action", "details-invoice-tags.png", "details-delivery-tags.png", "details-invoice.png", "details-delivery.png", "details-readonly.png", "details-busy.png", "html-invoice.png", "html-delivery.png", "rechnung-zwei-tags.png", "import-collision.png", "import-accepted.png", "result-import-free", "result-import-busy", "result-import-collision", "result-import-grid", "SUCCESS.txt", "FAILURE.txt", "ui-state.txt", "launcher.log", "steps.txt", "target-error.txt", "preview-restored.png", "imap.png", "jmap.png", "invoice.png", "delivery.png", "saved-document-result", "saved-bindings.fxml", "binding-article.png", "binding-dynamic.png", "tags-Pr.png", "tags-Re.png", "tags-Li.png", "document-tabs-result", "rechnung-tab.png", "lieferschein-tab.png", "rechnung-tab-tags.png", "lieferschein-tab-tags.png", "folder.png", "right.png", "bottom.png", "result-folder", "result-right", "result-bottom", "intellij.png"): if (base / name).exists(): shutil.copyfile(base / name, evidence / name) workers = descendant_workers(pid) diff --git a/scripts/run-fixture-host.py b/scripts/run-fixture-host.py index 02f4d60..c568ffb 100644 --- a/scripts/run-fixture-host.py +++ b/scripts/run-fixture-host.py @@ -22,13 +22,14 @@ p.add_argument("--archiver", type=Path, help="Use a disposable copy of the Archi forms = p.add_mutually_exclusive_group() forms.add_argument("--connection-form", action="store_true", help="Open and qualify the Archiver connection form") forms.add_argument("--grid-docking", type=Path, metavar="REFERENCE_FXML", help="Qualify the Archiver grid, dock layout and the supplied reference workspace") +forms.add_argument("--media-layout-grid", action="store_true", help="Verify media permissions, form destinations and grid setups in the Archiver") forms.add_argument("--management-readers", action="store_true", help="Verify account and trash commands and the five reader toolbars") forms.add_argument("--folder-actions", action="store_true", help="Check visual event references, folder search, selection and display profiles") forms.add_argument("--import-form", action="store_true", help="Check generic binding types and the Archiver import collision") forms.add_argument("--document-tabs", action="store_true", help="Qualify the production Archiver HTML document tabs") forms.add_argument("--saved-document", action="store_true", help="Open the Archiver saved HTML and tag example") args = p.parse_args() -if (args.connection_form or args.grid_docking or args.saved_document or args.document_tabs or args.import_form or args.folder_actions or args.management_readers) and not args.archiver: +if (args.connection_form or args.grid_docking or args.saved_document or args.document_tabs or args.import_form or args.folder_actions or args.management_readers or args.media_layout_grid) and not args.archiver: p.error("Selecting an Archiver view requires --archiver") base = Path(tempfile.mkdtemp(prefix="neitzel-designer-host-")).resolve() project = base / "project" @@ -39,6 +40,8 @@ if args.archiver: subprocess.run([sys.executable, ROOT / "scripts/configure-library-example.py", "--project", project, "--target-java-home", args.target_java_home], check=True) view = "ConnectionForm" if args.connection_form else "ArchiveWindow" + if args.media_layout_grid: + view = "HtmlDocument" if args.management_readers: view = "MailControls" if args.folder_actions: @@ -106,6 +109,8 @@ else: suite = "Connection" elif args.grid_docking: suite = "GridDock" + elif args.media_layout_grid: + suite = "MediaLayoutGrid" elif args.management_readers: suite = "ManagementReaders" elif args.folder_actions: @@ -118,7 +123,7 @@ else: suite = "SavedDocument" probe = f"{suite}WorkflowProbe" if args.archiver else "WorkflowProbe" files = [sources / "WorkflowProbe.java"] - if args.connection_form or args.saved_document or args.document_tabs or args.import_form or args.folder_actions or args.management_readers: + if args.connection_form or args.saved_document or args.document_tabs or args.import_form or args.folder_actions or args.management_readers or args.media_layout_grid: files.append(sources / "FormWorkflowProbe.java") if args.archiver: files.append(sources / f"{probe}.java")