Edit popup menu commands and literal DataGrid group keys

This commit is contained in:
2026-11-25 13:52:30 +01:00
parent 9c63b2dd0f
commit d99e2e69cd
14 changed files with 581 additions and 30 deletions
+2
View File
@@ -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 `--row-menus` to qualify menu labels and Command assignments on the Archiver folder and trash rows and group captions for paths and file types containing spaces. The DataGrid inspector preserves literal keys using the qualified target runtime.
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.
@@ -110,8 +110,12 @@ final class BindingDocument {
}
boolean named(Element e, String pkg, String type) {
if (e.getTagName().equals(pkg + type)) return true;
if (!e.getTagName().equals(type)) return false;
return resolves(e.getTagName(), pkg, type);
}
boolean resolves(String tag, String pkg, String type) {
if (tag.equals(pkg + type)) return true;
if (!tag.equals(type)) return false;
boolean own = imports.contains(pkg + type) || imports.contains(pkg + "*");
boolean other = imports.stream().anyMatch(i -> i.endsWith("." + type) && !i.equals(pkg + type));
return own && !other;
@@ -1,6 +1,7 @@
package de.neitzel.fxdesigner.kit;
import com.oracle.javafx.scenebuilder.kit.editor.panel.content.ContentPanelController;
import com.oracle.javafx.scenebuilder.kit.editor.panel.content.driver.AbstractDriver;
import com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.HierarchyPanelController;
import com.oracle.javafx.scenebuilder.kit.editor.panel.inspector.InspectorPanelController;
import com.oracle.javafx.scenebuilder.kit.fxom.*;
@@ -172,7 +173,15 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
this.file = file;
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
kit = new KitView(host);
content = new ContentPanelController(kit.editor());
content =
new ContentPanelController(kit.editor()) {
@Override
public AbstractDriver lookupDriver(FXOMObject object) {
// Popup menus have no editable Scene accessory or bounds on the form canvas.
if (object.getSceneGraphObject() instanceof ContextMenu) return null;
return super.lookupDriver(object);
}
};
design =
new SplitPane(
new HierarchyPanelController(kit.editor()).getPanelRoot(),
@@ -15,7 +15,7 @@ final class FormDocument {
register(
"javafx.scene.control",
"Label TextField TextArea PasswordField Button CheckBox ComboBox ToolBar Tab TabPane"
+ " ScrollPane SplitPane");
+ " ScrollPane SplitPane MenuItem ContextMenu");
register(
"javafx.scene.layout",
"GridPane VBox HBox StackPane AnchorPane FlowPane TilePane Pane BorderPane");
@@ -112,7 +112,7 @@ final class FormDocument {
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 "ContextMenu", "SplitPane", "ToolBarPane", "ToolBar" -> List.of("items");
case "StatusBar" -> List.of("leftItems", "rightItems");
default -> List.of();
};
@@ -216,6 +216,11 @@ final class FormDocument {
}
private void accept(String type, Slot slot, Element moving) {
if (type.equals("ContextMenu"))
throw new IllegalArgumentException("A ContextMenu belongs to its owning control.");
if (type.equals("MenuItem") != slot.owner().type().equals("ContextMenu"))
throw new IllegalArgumentException(
"A ContextMenu accepts MenuItems. Other destinations accept controls.");
if (type.equals("Tab") != slot.property().equals("tabs"))
throw new IllegalArgumentException(
slot.property().equals("tabs")
@@ -249,6 +254,7 @@ final class FormDocument {
if (container != null) return xml.append(container, snippet, "");
if ((single(slot) && members.isEmpty())
|| slot.owner().type().equals("StatusBar")
|| slot.owner().type().equals("ContextMenu")
|| (slot.owner().type().equals("ToolBarPane") && members.isEmpty()))
snippet = "<" + slot.property() + ">" + snippet + "</" + slot.property() + ">";
return xml.append(owner, snippet, "");
@@ -298,6 +304,7 @@ final class FormDocument {
String extra =
type.equals("Label")
|| type.equals("Button")
|| type.equals("MenuItem")
|| type.equals("TagChip")
|| type.equals("Tab")
? " text=\"" + type + "\""
@@ -371,6 +378,14 @@ final class FormDocument {
List<Field> fields(Item item) {
var e = element(item);
var fields = new LinkedHashMap<String, Field>();
if (item.type().equals("ContextMenu")) return withSourceFields(e, fields);
if (item.type().equals("MenuItem")) {
field(fields, "text", "String", "");
field(fields, "disable", "Boolean", "false");
field(fields, "visible", "Boolean", "true");
field(fields, "onAction", "Event handler", "");
return withSourceFields(e, fields);
}
if (item.type().equals("Tab")) {
field(fields, "text", "String", "");
field(fields, "closable", "Boolean", "true");
@@ -29,7 +29,12 @@ final class FormEditor extends VBox {
Consumer<BindingDocument.Values> bind) {
super(5);
this.submit = submit;
palette.getItems().setAll(FormDocument.TYPES.keySet());
palette
.getItems()
.setAll(
FormDocument.TYPES.keySet().stream()
.filter(type -> !type.equals("ContextMenu"))
.toList());
palette.setValue("Label");
position.setId("form-position");
position.setPrefWidth(74);
@@ -196,11 +196,44 @@ final class GridDockDocument {
if (attr.getNamespaceURI() == null
&& literalKey(attr.getNodeName())
&& !reference(attr.getNodeValue()))
names.put(attr.getNodeName(), attr.getNodeValue().replaceFirst("^\\\\", ""));
names.put(attr.getNodeName(), literal(attr.getNodeValue()));
}
for (var pair : labelPairs(column)) {
if (pair.hasAttribute("key")
&& pair.hasAttribute("value")
&& !reference(pair.getAttribute("key"))
&& !reference(pair.getAttribute("value"))) {
names.put(literal(pair.getAttribute("key")), literal(pair.getAttribute("value")));
}
}
return names;
}
private List<Element> labelPairs(Element column) {
return children(column).stream()
.filter(
child -> {
String tag = child.getTagName();
String suffix = ".groupLabel";
return tag.endsWith(suffix)
&& xml.resolves(
tag.substring(0, tag.length() - suffix.length()),
"de.neitzel.fx.view.",
"DataGridColumn");
})
.flatMap(child -> children(child).stream())
.filter(child -> xml.named(child, "javafx.util.", "Pair"))
.toList();
}
private static String literal(String value) {
return value.startsWith("\\") ? value.substring(1) : value;
}
private static String fxmlLiteral(String value) {
return reference(value) || value.startsWith("\\") ? "\\" + value : value;
}
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}_-]*")
@@ -213,17 +246,62 @@ final class GridDockDocument {
}
List<Replacement> 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 (!type(column).equals("DataGridColumn") || key.isEmpty())
throw new IllegalArgumentException("Enter a group key.");
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))))
if (map != null
&& literalKey(key)
&& (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;
String encoded = fxmlLiteral(label);
var pairs =
labelPairs(column).stream()
.filter(
pair ->
pair.hasAttribute("key")
&& !reference(pair.getAttribute("key"))
&& literal(pair.getAttribute("key")).equals(key))
.toList();
if (pairs.size() > 1
|| !pairs.isEmpty() && literalKey(key) && map != null && map.hasAttribute(key))
throw new IllegalArgumentException(
"Duplicate group key. Resolve the declarations in Source.");
if (!pairs.isEmpty()) {
var pair = pairs.getFirst();
if (!pair.hasAttribute("value")
|| reference(pair.getAttribute("value"))
|| !children(pair).isEmpty())
throw new IllegalArgumentException("This key is supplied by a nested value or reference.");
if (remove) {
var property = (Element) pair.getParentNode();
if (children(property).size() > 1) return List.of(replace(pair, ""));
var wrapper = tag(property);
var entry = tag(pair);
String remaining =
xml.text.substring(wrapper.openEnd(), entry.start())
+ xml.text.substring(entry.end(), wrapper.closeStart());
return List.of(replace(property, remaining.isBlank() ? "" : remaining));
}
return xml.source.attributes(xml.elements.indexOf(pair), Map.of("value", encoded));
}
if (remove && (map == null || !map.hasAttribute(key))) return List.of();
if (!literalKey(key)) {
String property = column.getTagName() + ".groupLabel";
String snippet =
"<"
+ property
+ "><javafx.util.Pair key=\""
+ XmlSource.escape(fxmlLiteral(key), '"')
+ "\" value=\""
+ XmlSource.escape(encoded, '"')
+ "\"/></"
+ property
+ ">";
return List.of(xml.append(column, snippet, ""));
}
if (map == null)
return List.of(
xml.append(
@@ -76,6 +76,47 @@ class GridDockDocumentTest {
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "fixedPosition", "2"));
}
@Test
void pathLabelsRoundTripWithoutChangingNeighbouringMapEntries() throws Exception {
String source =
"""
<?import de.neitzel.fx.view.*?>
<DataGridColumn><groupLabels Post='Alt' another="%reference"/><!-- keep --></DataGridColumn>
""";
for (String key : java.util.List.of("/", "Post/Eingang West", "Ohne Endung", "$path & more")) {
var doc = new GridDockDocument(source);
String edited =
doc.xml.source.apply(doc.groupLabel(doc.xml.elements.getFirst(), key, "%T & T", false));
var changed = new GridDockDocument(edited);
var col = changed.xml.elements.getFirst();
assertEquals("%T & T", changed.groupLabels(col).get(key));
assertTrue(edited.contains("<groupLabels Post='Alt' another=\"%reference\"/><!-- keep -->"));
String removed = changed.xml.source.apply(changed.groupLabel(col, key, "", true));
var restored = new GridDockDocument(removed);
assertEquals(
java.util.Map.of("Post", "Alt"), restored.groupLabels(restored.xml.elements.getFirst()));
assertTrue(removed.contains("<groupLabels Post='Alt' another=\"%reference\"/><!-- keep -->"));
}
}
@Test
void deletingAPairPreservesSiblingsAndReferences() throws Exception {
String source =
"""
<?import de.neitzel.fx.view.*?>
<DataGridColumn><DataGridColumn.groupLabel><!-- keep -->
<javafx.util.Pair key="/" value="Archiv"/><javafx.util.Pair key="Post/Eingang" value="%title"/>
</DataGridColumn.groupLabel></DataGridColumn>
""";
var doc = new GridDockDocument(source);
var col = doc.xml.elements.getFirst();
assertEquals(
source.replace("<javafx.util.Pair key=\"/\" value=\"Archiv\"/>", ""),
doc.xml.source.apply(doc.groupLabel(col, "/", "", true)));
assertThrows(
IllegalArgumentException.class, () -> doc.groupLabel(col, "Post/Eingang", "", true));
}
@Test
void implicitRowAttributeAndGroupingSurviveRename() throws Exception {
var source =
+4 -4
View File
@@ -2,9 +2,9 @@
"schemaVersion": 1,
"status": "verified-local-development-snapshot",
"sourceRepository": "ssh://git@gitea.neitzel.de:2222/konrad/NeitzelLib.git",
"sourceRevision": "e4f1fd3c96f79f22da8998f5a03d05363e30b1e2",
"sourceRevision": "2625616b2fa9f4bccb2f891b2b2ae60cafeccd3d",
"minimumReleasedVersion": null,
"requiredCapability": "managed-views-command-bindings-and-document-inputs",
"requiredCapability": "managed-views-command-bindings-document-inputs-and-group-label-entries",
"javaVersion": "25",
"javafxVersion": "27.0.1",
"testResults": {
@@ -21,7 +21,7 @@
"skipped": 0
},
"fx": {
"tests": 408,
"tests": 409,
"failures": 0,
"errors": 0,
"skipped": 12
@@ -110,7 +110,7 @@
"version": "1.0.6-SNAPSHOT",
"extension": "jar",
"repositoryPath": "de/neitzel/lib/fx/1.0.6-SNAPSHOT/fx-1.0.6-SNAPSHOT.jar",
"sha256": "6c1b95e963073ccca21bf2214ce33b9baf2fccae506b97e8215ef0130282b192"
"sha256": "626df132f37dcdc2da28ae0a2750ddf172a824c7b41058900cb1be18c0126a9a"
}
],
"generatedViewModelSupport": "stored-property-access-and-declarative-service-registry",
+1 -1
View File
@@ -1,6 +1,6 @@
# NeitzelLib development runtime
The IntelliJ Archiver preview uses `de.neitzel.lib:fx:1.0.6-SNAPSHOT` on JDK 25 and JavaFX 27.0.1. The target uses managed Views, CommandBindings and the direct `ViewLoader.loadComponent` entry point for fx:root previews. The Archiver document example uses the one-way HTML and observable suggestion-source inputs. The host uses JavaFX 26. Source revision, build timestamp, test totals and the nine installed POM/JAR checksums are in the [active manifest](neitzellib-baseline.json).
The IntelliJ Archiver preview uses `de.neitzel.lib:fx:1.0.6-SNAPSHOT` on JDK 25 and JavaFX 27.0.1. The target uses managed Views, CommandBindings and the direct `ViewLoader.loadComponent` entry point for fx:root previews. The Archiver document example uses the one-way HTML and observable suggestion-source inputs. The target also accepts literal group keys in DataGridColumn.groupLabel entries. The host uses JavaFX 26. Source revision, build timestamp, test totals and the nine installed POM/JAR checksums are in the [active manifest](neitzellib-baseline.json).
## Rebuild and verify
@@ -110,19 +110,19 @@ public final class FolderActionsTargetProbe {
}
}
private static List<?> rows(Node grid) throws Exception {
static List<?> rows(Node grid) throws Exception {
return (List<?>) grid.getClass().getMethod("getItems").invoke(grid);
}
private static String attr(Object row, String name) throws Exception {
static String attr(Object row, String name) throws Exception {
return (String) row.getClass().getMethod(name).invoke(row);
}
private static void select(Node grid, List<String> keys) throws Exception {
static void select(Node grid, List<String> keys) throws Exception {
grid.getClass().getMethod("selectKeys", Collection.class).invoke(grid, keys);
}
private static MenuItem move(Node grid, String file) {
static MenuItem move(Node grid, String file) {
Node anchor =
grid.lookupAll(".label").stream()
.filter(n -> n instanceof Label l && l.getText().equals(file))
@@ -0,0 +1,255 @@
package qualification;
import static qualification.FolderActionsTargetProbe.Worker.*;
import java.nio.file.*;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import javafx.collections.ListChangeListener;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.input.ContextMenuEvent;
import javafx.stage.Window;
public final class RowMenusTargetProbe {
public static void premain(String dir) {
if (System.getProperty("sun.java.command", "")
.startsWith("de.neitzel.fxdesigner.target.WorkerMain "))
Thread.ofPlatform().daemon().start(() -> Check.run(Path.of(dir)));
}
private static final class Check {
static void run(Path dir) {
try {
var stage = previewStage();
var root =
fx(
() -> {
stage.setWidth(1200);
stage.setHeight(660);
var r = stage.getScene().getRoot();
r.applyCss();
r.layout();
return r;
});
String which = Files.readString(dir.resolve("layout-case"));
String result =
switch (which) {
case "original", "edited" -> {
var grid = fx(() -> root.lookup("#grid"));
await(
"Folder sample rows",
() -> displays(grid, "Lieferbrief.md") && displays(grid, "Musterrechnung.pdf"));
yield fx(() -> folder(root, which.equals("edited")));
}
case "trash" -> fx(() -> trash(root));
case "groups" -> groups(root, dir);
default -> throw new AssertionError(which);
};
Files.writeString(dir.resolve("result-" + which), result);
} catch (Throwable ex) {
var trace = new java.io.StringWriter();
ex.printStackTrace(new java.io.PrintWriter(trace));
try {
Files.writeString(dir.resolve("target-error.txt"), trace.toString());
} catch (Exception failed) {
failed.printStackTrace();
}
}
}
static MenuItem item(ContextMenu menu, String label) {
return menu.getItems().stream()
.filter(i -> label.equals(i.getText()))
.findFirst()
.orElseThrow(
() ->
new AssertionError(
label + " in " + menu.getItems().stream().map(MenuItem::getText).toList()));
}
static String folder(Parent root, boolean edited) throws Exception {
var grid = root.lookup("#grid");
var feedback = (Label) root.lookup("#example-folder-result");
var keys = new HashMap<String, String>();
for (var row : rows(grid)) keys.put(attr(row, "path"), attr(row, "key"));
var letter = keys.get("Lieferbrief.md");
var invoice = keys.get("Musterrechnung.pdf");
select(grid, List.of(invoice));
var menu = move(grid, "Lieferbrief.md").getParentPopup();
require(
grid.getClass().getMethod("selectedKeysProperty").invoke(grid)
instanceof List<?> selection
&& selection.equals(List.of(letter)),
"Right-click outside selection");
String label = edited ? "Extern prüfen" : "Öffnen";
var open = item(menu, label);
open.fire();
require(
feedback.getText().equals((edited ? "Extern öffnen" : "Öffnen") + " · " + letter),
"Wrong row " + feedback.getText());
menu.hide();
require(open.getOnAction() == null, "Old action still owns row");
select(grid, List.of(invoice, letter));
var move = move(grid, "Musterrechnung.pdf");
var multi = move.getParentPopup();
item(multi, label).fire();
require(
feedback.getText().equals((edited ? "Extern öffnen" : "Öffnen") + " · " + invoice),
"Open on multi-selection");
move.fire();
String result = feedback.getText();
require(
result.startsWith("Verschieben · ")
&& Set.copyOf(Arrays.asList(result.substring("Verschieben · ".length()).split(", ")))
.equals(Set.of(invoice, letter)),
result);
multi.hide();
return label
+ " targets the clicked file (Lieferbrief, then Musterrechnung); move preserves both"
+ " selected keys.";
}
static ContextMenu popup(TableView<?> table, int index) {
table.applyCss();
table.layout();
var row =
table.lookupAll(".table-row-cell").stream()
.filter(n -> n instanceof TableRow<?> r && r.getIndex() == index && !r.isEmpty())
.findFirst()
.orElseThrow();
var point = row.localToScreen(3, 3);
row.fireEvent(
new ContextMenuEvent(
ContextMenuEvent.CONTEXT_MENU_REQUESTED,
3,
3,
point.getX(),
point.getY(),
false,
null));
return Window.getWindows().stream()
.filter(w -> w instanceof ContextMenu && w.isShowing())
.map(ContextMenu.class::cast)
.findFirst()
.orElseThrow();
}
static String trash(Parent root) {
var items = (TableView<?>) root.lookup("#trash-items");
var files = (TableView<?>) root.lookup("#trash-files");
var action = (Label) root.lookup("#example-trash-action");
var busy = (CheckBox) root.lookup("#example-trash-busy");
var readonly = (CheckBox) root.lookup("#example-trash-readonly");
require(items.getItems().size() == 2 && files.getItems().size() == 2, "Initial trash");
for (int index : List.of(1, 0)) {
var menu = popup(files, index);
var file = item(menu, "Diese Datei öffnen");
file.fire();
require(
action
.getText()
.equals("Öffnen · " + (index == 1 ? "Lieferschein.md" : "Rechnung.pdf")),
action.getText());
busy.fire();
require(file.isDisable(), "Busy file open");
file.fire();
busy.fire();
menu.hide();
require(file.getOnAction() == null, "File context retained");
}
for (var flag : List.of(busy, readonly)) {
flag.fire();
var menu = popup(items, 1);
var restore = item(menu, "Auswahl zurückholen");
require(restore.isDisable(), "Disabled restore");
restore.fire();
menu.hide();
flag.fire();
require(items.getItems().size() == 2, "Blocked restore ran");
}
var changes = new AtomicInteger();
items.getItems().addListener((ListChangeListener<Object>) c -> changes.incrementAndGet());
for (String name : List.of("Notiz.txt", "Belege")) {
int index = name.equals("Notiz.txt") ? 1 : 0;
var first = popup(items, index);
var retired = item(first, "Auswahl zurückholen");
first.hide();
var next = popup(items, index);
int before = changes.get();
require(retired.getOnAction() == null, "Retired action");
retired.fire();
require(changes.get() == before, "Retired menu ran");
var command =
item(next, name.equals("Notiz.txt") ? "Auswahl zurückholen" : "Wiederherstellen …");
require(!command.isDisable(), "Current restore");
command.fire();
next.hide();
require(
changes.get() == before + 1 && action.getText().equals("Wiederherstellen · " + name),
"Restore count/target: " + changes + " " + action.getText());
require(
items.getItems().size() == index && files.getItems().size() == (index == 1 ? 2 : 0),
"Remaining entries/files");
}
return "File menu opened Lieferschein.md and Rechnung.pdf; busy/read-only restore made no"
+ " change. Reopened menus restored Notiz.txt then Belege exactly once each (2"
+ " entries/3 files → 1/2 → 0/0).";
}
static Button heading(Node grid, String name) {
return grid.lookupAll(".group-heading").stream()
.map(Button.class::cast)
.filter(b -> b.getText().contains(": " + name + " — "))
.findFirst()
.orElseThrow(() -> new AssertionError("Heading " + name));
}
static boolean displays(Node grid, String name) {
return grid.lookupAll(".label").stream()
.anyMatch(n -> n instanceof Label l && name.equals(l.getText()));
}
static void fold(Node grid, String group, List<String> inside, String outside) {
var button = heading(grid, group);
require(inside.stream().allMatch(s -> displays(grid, s)), group + " initially expanded");
button.fire();
require(
inside.stream().noneMatch(s -> displays(grid, s)) && displays(grid, outside),
"Collapse " + group);
heading(grid, group).fire();
require(
inside.stream().allMatch(s -> displays(grid, s)) && displays(grid, outside),
"Expand " + group);
}
static String groups(Parent root, Path dir) throws Exception {
var grid = fx(() -> root.lookup("#grid"));
await("Four distinct folders", () -> grid.lookupAll(".group-heading").size() == 4);
fx(
() -> {
fold(grid, "Archivwurzel", List.of("README"), "Brief.txt");
fold(grid, "Eingangspost", List.of("Brief.txt"), "Antwort.txt");
fold(grid, "Westpost", List.of("Antwort.txt"), "Brief.txt");
fold(grid, "Postfach", List.of("Index"), "README");
image(root, dir.resolve("row-folders.png"));
var choice = (ChoiceBox<?>) root.lookup("#grouping");
int index =
choice.getItems().stream().map(Object::toString).toList().indexOf("Nach Dateityp");
choice.getSelectionModel().select(index);
return null;
});
await("Two type groups", () -> grid.lookupAll(".group-heading").size() == 2);
fx(
() -> {
fold(grid, "Endungslose Dateien", List.of("README", "Index"), "Brief.txt");
fold(grid, "Text", List.of("Brief.txt", "Antwort.txt"), "README");
image(root, dir.resolve("row-types.png"));
return null;
});
return "Collapsed/expanded / (README), Post/Eingang (Brief.txt), Post/Eingang West"
+ " (Antwort.txt), Post (Index). Ohne Endung grouped README and Index only; Text"
+ " kept both .txt files.";
}
}
}
@@ -0,0 +1,138 @@
package qualification;
import static qualification.WorkflowProbe.*;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project;
import java.nio.file.Files;
import java.util.List;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.control.*;
import javax.imageio.ImageIO;
/** Edit the production menu templates, then invoke them through their owning views. */
public final class RowMenusWorkflowProbe extends DeclarationWorkflowProbe {
@Override
void verify(Project project) throws Exception {
this.project = project;
open("FolderTab");
build("folder-actions");
interactive("folder-actions", "original");
// Reopen the owning form from disk after saving the external menu templates.
edt(
() -> {
FileEditorManager.getInstance(project).closeFile(file);
return null;
});
menu("FolderRowMenu", "open", "open", "openExternal", "Extern prüfen", 6);
menu("TrashRowMenu", "delete", "deleteSelection", "restoreSelection", "Auswahl zurückholen", 3);
menu("TrashFileMenu", "open", "open", "open", "Diese Datei öffnen", 1);
open("TrashPane");
build("trash-full");
interactive("trash-full", "trash");
open("FolderTab");
build("folder-actions");
interactive("folder-actions", "edited");
inspector(true);
select("DataGrid", "grid");
applySetting("groupBy", "folder");
for (var entry :
List.of(
List.of("folder", "Post", "Postfach"),
List.of("folder", "/", "Archivwurzel"),
List.of("folder", "Post/Eingang", "Eingangspost"),
List.of("folder", "Post/Eingang West", "Westpost"),
List.of("type", "Ohne Endung", "Endungslose Dateien"))) {
select("DataGridColumn", entry.get(0));
combo("declaration-property", "groupLabels");
fx(
() -> {
((ComboBox<?>) pane.lookup("#group-label-key")).getEditor().setText(entry.get(1));
((TextField) pane.lookup("#group-label-text")).setText(entry.get(2));
return null;
});
edit("Set group label", entry.get(2));
}
reopen("FolderTab", "Endungslose Dateien");
for (var entry :
List.of(
List.of("folder", "/"),
List.of("folder", "Post/Eingang"),
List.of("folder", "Post/Eingang West"),
List.of("type", "Ohne Endung"))) {
inspector(true);
select("DataGridColumn", entry.getFirst());
combo("declaration-property", "groupLabels");
choose("group-label-key", entry.getLast());
String before = source();
click(pane, "Remove group label");
await(() -> !source().contains("key=\"" + entry.getLast() + "\""));
click(pane, "Undo");
await(() -> source().equals(before));
fx(pane::flush).toCompletableFuture().get();
step("Reopened, removed and restored literal key [" + entry.getLast() + "]");
}
build("folder-groups");
interactive("folder-groups", "groups");
Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt")));
}
private void menu(
String name, String control, String oldPath, String path, String label, int count)
throws Exception {
open(name);
click(pane, "Form preview");
click(pane, "Build and Refresh");
await(
() ->
fx(
() ->
pane.lookupAll(".label").stream()
.anyMatch(n -> n instanceof Label l && "0 examples".equals(l.getText()))
|| ((Label) pane.lookup("#preview-state"))
.getText()
.startsWith("Select a preview example")));
commands(control, oldPath, count);
click(pane, "Discover / Validate Commands");
await(
() ->
fx(
() ->
((Label) pane.lookup("#command-status"))
.getText()
.contains("No detected binding errors.")));
if (!path.equals(oldPath)) {
fx(
() -> {
var choices =
pane.lookup("#command-path").getParent().getChildrenUnmodifiable().stream()
.filter(
n -> Integer.valueOf(1).equals(javafx.scene.layout.GridPane.getRowIndex(n)))
.filter(ComboBox.class::isInstance)
.map(ComboBox.class::cast)
.findFirst()
.orElseThrow();
if (!choices.getItems().contains(path)) throw new AssertionError(choices.getItems());
choices.getSelectionModel().select(path);
return null;
});
click(pane, "Apply Command binding");
await(() -> source().contains("control=\"" + control + "\" path=\"" + path + "\""));
}
controls(true);
choose("form-control", "MenuItem #" + control);
set("text", label, "text=\"" + label + "\"");
reopen(name, "text=\"" + label + "\"");
commands(control, path, count);
if (name.equals("TrashRowMenu"))
fx(
() -> {
ImageIO.write(
SwingFXUtils.fromFXImage(pane.snapshot(null, null), null),
"png",
output.resolve("intellij.png").toFile());
return null;
});
step(name + " reopened: " + label + " → " + path);
}
}
+4 -3
View File
@@ -29,13 +29,14 @@ forms.add_argument("--grid-docking", type=Path, metavar="REFERENCE_FXML", help="
forms.add_argument("--dock-rules", action="store_true", help="Verify group minima, split directions and persistence in the Archiver")
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("--row-menus", action="store_true", help="Edit Archiver row menu bindings and literal grid group labels")
forms.add_argument("--folder-profiles", action="store_true", help="Check the Archiver profile commands and metadata columns")
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.folder_profiles or args.management_readers or args.media_layout_grid or args.dock_rules) 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.row_menus or args.folder_profiles or args.management_readers or args.media_layout_grid or args.dock_rules) and not args.archiver:
p.error("Selecting an Archiver view requires --archiver")
if args.repeat < 1:
p.error("--repeat must be positive")
@@ -47,7 +48,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", *(["--folder-profiles"] if args.folder_profiles else []), *(["--dock-rules"] if args.dock_rules else []), *(["--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,
"--check", *(["--row-menus"] if args.row_menus else []), *(["--folder-profiles"] if args.folder_profiles else []), *(["--dock-rules"] if args.dock_rules else []), *(["--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:
@@ -91,7 +92,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 ("folder-metadata.png", "dock-horizontal.png", "dock-vertical.png", "dock-empty-kept.png", "dock-empty-removed.png", "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"):
for name in ("row-folders.png", "row-types.png", "folder-metadata.png", "dock-horizontal.png", "dock-vertical.png", "dock-empty-kept.png", "dock-empty-removed.png", "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)
+8 -5
View File
@@ -25,13 +25,14 @@ forms.add_argument("--grid-docking", type=Path, metavar="REFERENCE_FXML", help="
forms.add_argument("--dock-rules", action="store_true", help="Verify group minima, split directions and persistence in the Archiver")
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("--row-menus", action="store_true", help="Edit Archiver row menu bindings and literal grid group labels")
forms.add_argument("--folder-profiles", action="store_true", help="Check the Archiver profile commands and metadata columns")
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.folder_profiles or args.management_readers or args.media_layout_grid or args.dock_rules) 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.row_menus or args.folder_profiles or args.management_readers or args.media_layout_grid or args.dock_rules) and not args.archiver:
p.error("Selecting an Archiver view requires --archiver")
base = Path(tempfile.mkdtemp(prefix="neitzel-designer-host-")).resolve()
project = base / "project"
@@ -46,7 +47,7 @@ if args.archiver:
view = "HtmlDocument"
if args.management_readers:
view = "MailControls"
if args.folder_profiles:
if args.folder_profiles or args.row_menus:
view = "FolderTab"
if args.folder_actions:
view = "DocumentDetails" if args.check else "FolderTab"
@@ -119,6 +120,8 @@ else:
suite = "MediaLayoutGrid"
elif args.management_readers:
suite = "ManagementReaders"
elif args.row_menus:
suite = "RowMenus"
elif args.folder_profiles:
suite = "FolderProfiles"
elif args.folder_actions:
@@ -131,9 +134,9 @@ 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.folder_profiles or args.management_readers or args.media_layout_grid or args.dock_rules:
if args.connection_form or args.saved_document or args.document_tabs or args.import_form or args.folder_actions or args.row_menus or args.folder_profiles or args.management_readers or args.media_layout_grid or args.dock_rules:
files.append(sources / "FormWorkflowProbe.java")
if args.media_layout_grid or args.dock_rules or args.folder_profiles:
if args.media_layout_grid or args.dock_rules or args.row_menus or args.folder_profiles:
files.append(sources / "DeclarationWorkflowProbe.java")
if args.archiver:
files.append(sources / f"{probe}.java")
@@ -141,7 +144,7 @@ else:
agent_classes = base / "agent-classes"
agent_classes.mkdir()
subprocess.run([args.java_home / "bin/javac", "-cp", os.pathsep.join(map(str,jars)), "-d", agent_classes,
sources / f"{target_probe}.java", *([sources / "FolderActionsTargetProbe.java"] if args.folder_profiles else [])], check=True)
sources / f"{target_probe}.java", *([sources / "FolderActionsTargetProbe.java"] if args.folder_profiles or args.row_menus else [])], check=True)
agent = base / "archiver-ui-check.jar"
with zipfile.ZipFile(agent, "w") as archive:
archive.writestr("META-INF/MANIFEST.MF", f"Manifest-Version: 1.0\nPremain-Class: qualification.{target_probe}\n\n")