Merge Archiver designer workflows and IntelliJ qualification
This commit is contained in:
@@ -75,7 +75,7 @@ python3 scripts/run-fixture-host.py intellij --archiver ../Archiver \
|
||||
--idea-home "$IDEA_HOME" --java-home "$JAVA_HOME" --target-java-home "$JAVA_HOME"
|
||||
```
|
||||
|
||||
Open `ArchiveWindow.fxml` in **Neitzel Designer**, choose **Build and Refresh** and start **Interactive preview** with **Beispielarchiv**. The open menu command enables the trash button. Under **Bindings → Command bindings** select `open`, change its path to `openReadOnly`, apply and restart the preview. The status bar identifies the read-only example. **Discover / Validate Commands** lists public getters returning a NeitzelLib `Command`, including the Command exposed by an `AsyncCommand`. The Problems view navigates to an invalid declaration. To repeat the automated acceptance, use the same arguments with `python3 scripts/check-ide-host.py --archiver ../Archiver` (omit the `intellij` positional argument).
|
||||
Open `ArchiveWindow.fxml` in **Neitzel Designer**, choose **Build and Refresh** and start **Interactive preview** with **Beispielarchiv**. Open the sample archive and select an entry in the example document. The entry, selected folder and scan state control the same 22 command permissions as the application. Opening read-only disables import and account management. The trash button opens the populated session-local trash, and closing the archive disables it. Under **Bindings → Command bindings** select `open`, change its path to `openReadOnly`, apply and restart the preview. The status bar identifies the read-only example. **Discover / Validate Commands** lists public getters returning a NeitzelLib `Command`, including the Command exposed by an `AsyncCommand`. The Problems view navigates to an invalid declaration. To repeat the automated acceptance, use the same arguments with `python3 scripts/check-ide-host.py --archiver ../Archiver` (omit the `intellij` positional argument).
|
||||
|
||||
Add `--connection-form` to open or qualify `ConnectionForm.fxml`. After **Build and Refresh**, choose **Form preview** and select **IMAP · Beispielkonto** or **JMAP · Beispielkonto**. The full image comes from the target application at the selected width and height. **Interactive preview** opens a separate, editable instance of the selected example.
|
||||
|
||||
@@ -95,6 +95,10 @@ 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.
|
||||
|
||||
Use `--document-tabs` with the Archiver host check to open the production archive window and select **Archiver · HTML-Dokumenttabs**. The check also opens the production HTML and details FXML files directly, edits the assigned-tag Component and the input prompt through the visual inspector, and reopens the saved files. In the archive window it adds a second tag to the invoice, switches to the delivery note and back, removes the selected tag, and checks each WebView and suggestion popup. Direct examples cover read-only and busy states.
|
||||
@@ -107,6 +111,10 @@ Worker startup cancellation and ready-preview cleanup are covered by the [native
|
||||
|
||||
These graphical checks require a macOS desktop session; other platforms are not qualified. See [workflow limits](docs/first-connected-workflow.md#limits-and-next-stage) before using arbitrary application documents.
|
||||
|
||||
In Archiver `HtmlDocument.fxml`, **Form controls** offers `HtmlMediaButton` in the palette. Select its **viewer** property, choose an earlier `HtmlViewer` with an `fx:id` and click **Set property**. **Reset property** clears the reference. **Bindings → Structure → Rename identifier** updates the reference when renaming the target. The `--viewer-import` IntelliJ qualification uses the local-image reference example and the real import dialog with a controlled file error and retry.
|
||||
|
||||
Use `--reader-states` with the Archiver IntelliJ host check for the direct `DocumentTag.fxml` example, binary attachment export and HTML load error with recovery. The test saves a chip style in the disposable project and checks the styled chips in the archive window.
|
||||
|
||||
## Implementation references
|
||||
|
||||
- [Lombok adoption](docs/lombok-adoption.md): scope, API preservation and build/host validation.
|
||||
|
||||
@@ -2,6 +2,7 @@ package de.neitzel.fxdesigner.build;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.*;
|
||||
|
||||
/** Detects transient changes and overflow in addition to pre/post hashes and file attributes. */
|
||||
@@ -13,18 +14,32 @@ final class SourceWatch implements AutoCloseable {
|
||||
SourceWatch(Path root) throws IOException {
|
||||
this.root = root;
|
||||
watch = root.getFileSystem().newWatchService();
|
||||
try (var dirs = Files.walk(root)) {
|
||||
for (Path dir :
|
||||
dirs.filter(Files::isDirectory)
|
||||
.filter(p -> InputTree.included(root, root.relativize(p)))
|
||||
.toList())
|
||||
keys.put(
|
||||
dir.register(
|
||||
watch,
|
||||
StandardWatchEventKinds.ENTRY_CREATE,
|
||||
StandardWatchEventKinds.ENTRY_DELETE,
|
||||
StandardWatchEventKinds.ENTRY_MODIFY),
|
||||
dir);
|
||||
try {
|
||||
Files.walkFileTree(
|
||||
root,
|
||||
new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
|
||||
throws IOException {
|
||||
if (!InputTree.included(root, root.relativize(dir)))
|
||||
return FileVisitResult.SKIP_SUBTREE;
|
||||
keys.put(
|
||||
dir.register(
|
||||
watch,
|
||||
StandardWatchEventKinds.ENTRY_CREATE,
|
||||
StandardWatchEventKinds.ENTRY_DELETE,
|
||||
StandardWatchEventKinds.ENTRY_MODIFY),
|
||||
dir);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
} catch (IOException | RuntimeException failure) {
|
||||
try {
|
||||
watch.close();
|
||||
} catch (IOException cleanup) {
|
||||
failure.addSuppressed(cleanup);
|
||||
}
|
||||
throw failure;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package de.neitzel.fxdesigner.build;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.PosixFilePermissions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
class SourceWatchTest {
|
||||
@Test
|
||||
void registeringBuildInputsNeverTraversesSnapshotContents(@TempDir Path project)
|
||||
throws Exception {
|
||||
assumeTrue(project.getFileSystem().supportedFileAttributeViews().contains("posix"));
|
||||
var snapshot = Files.createDirectories(project.resolve(".neitzel-fx-designer/snapshots"));
|
||||
Files.createFile(snapshot.resolve("state.tmp"));
|
||||
var permissions = Files.getPosixFilePermissions(snapshot);
|
||||
try {
|
||||
Files.setPosixFilePermissions(snapshot, PosixFilePermissions.fromString("---------"));
|
||||
assumeTrue(!Files.isReadable(snapshot));
|
||||
try (var watch = new SourceWatch(project)) {
|
||||
assertFalse(watch.changed());
|
||||
}
|
||||
} finally {
|
||||
Files.setPosixFilePermissions(snapshot, permissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.*;
|
||||
@@ -67,6 +68,22 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
|
||||
.componentAttributes(id)
|
||||
.forEach(
|
||||
(name, value) -> {
|
||||
if (name.equals("viewer")
|
||||
&& projection
|
||||
.components()
|
||||
.get(id)
|
||||
.equals("de.neitzel.archiver.ui.HtmlMediaButton")) {
|
||||
var edit = new Button("Choose HtmlViewer");
|
||||
edit.setOnAction(
|
||||
e -> {
|
||||
var panel = (TitledPane) lookup("#form-controls-inspector");
|
||||
panel.setExpanded(true);
|
||||
formEditor.selectIndex(projection.sourceIndex(id));
|
||||
formEditor.selectViewerField();
|
||||
});
|
||||
componentInspector.getChildren().add(new HBox(4, new Label(name), edit));
|
||||
return;
|
||||
}
|
||||
var field = new TextField(value);
|
||||
field.setId("component-property-" + name);
|
||||
field.setOnAction(
|
||||
@@ -172,7 +189,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(),
|
||||
@@ -472,6 +497,7 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
|
||||
bindingEditor.editProperty(values);
|
||||
});
|
||||
var formPane = new TitledPane("Form controls", formEditor);
|
||||
formPane.setId("form-controls-inspector");
|
||||
formPane.setExpanded(false);
|
||||
formPane
|
||||
.expandedProperty()
|
||||
|
||||
@@ -9,19 +9,22 @@ import org.w3c.dom.*;
|
||||
* Visual form operations use ranges from the current source so bindings keep their original text.
|
||||
*/
|
||||
final class FormDocument {
|
||||
static final String VIEWER_REFERENCE = "HtmlViewer reference";
|
||||
private static final String MEDIA_BUTTON = "HtmlMediaButton";
|
||||
static final Map<String, String> TYPES = new TreeMap<>();
|
||||
|
||||
static {
|
||||
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");
|
||||
register(
|
||||
"de.neitzel.fx.control",
|
||||
"StatusBar ToolBarPane AutoCompleteTextField TagChip NonNegativeIntegerSpinner HtmlViewer");
|
||||
register("de.neitzel.archiver.ui", MEDIA_BUTTON);
|
||||
register("de.neitzel.fx.view", "DataGrid Table");
|
||||
register("de.neitzel.fx.docking", "DockPane");
|
||||
}
|
||||
@@ -62,10 +65,14 @@ final class FormDocument {
|
||||
final List<Slot> slots = new ArrayList<>();
|
||||
private final Map<String, String> imports = new HashMap<>();
|
||||
private final Set<String> packages = new HashSet<>();
|
||||
private final Set<String> ids = new HashSet<>();
|
||||
private final Set<String> ids = new HashSet<>(), duplicateIds = new HashSet<>();
|
||||
|
||||
FormDocument(String text) throws Exception {
|
||||
xml = new BindingDocument(text);
|
||||
this(new BindingDocument(text));
|
||||
}
|
||||
|
||||
FormDocument(BindingDocument xml) {
|
||||
this.xml = xml;
|
||||
for (Node n = xml.document.getFirstChild(); n != null; n = n.getNextSibling()) {
|
||||
if (n instanceof ProcessingInstruction pi && pi.getTarget().equals("import")) {
|
||||
String type = pi.getData().trim();
|
||||
@@ -76,7 +83,7 @@ final class FormDocument {
|
||||
for (int i = 0; i < xml.elements.size(); i++) {
|
||||
var e = xml.elements.get(i);
|
||||
String id = e.getAttributeNS(BindingDocument.FX, "id");
|
||||
if (!id.isEmpty()) ids.add(id);
|
||||
if (!id.isEmpty() && !ids.add(id)) duplicateIds.add(id);
|
||||
String tag = e.getTagName();
|
||||
if (BindingDocument.FX.equals(e.getNamespaceURI()) && e.getLocalName().equals("root"))
|
||||
tag = e.getAttribute("type");
|
||||
@@ -88,6 +95,56 @@ final class FormDocument {
|
||||
}
|
||||
}
|
||||
|
||||
List<String> palette() {
|
||||
boolean mediaButtonInDocument = items.stream().anyMatch(i -> i.type().equals(MEDIA_BUTTON));
|
||||
return TYPES.keySet().stream()
|
||||
.filter(type -> !type.equals("ContextMenu"))
|
||||
.filter(
|
||||
type ->
|
||||
!type.equals(MEDIA_BUTTON)
|
||||
|| mediaButtonInDocument
|
||||
|| resolves(MEDIA_BUTTON, TYPES.get(MEDIA_BUTTON)))
|
||||
.toList();
|
||||
}
|
||||
|
||||
List<String> viewerTargets(Item item) {
|
||||
var owner = element(item);
|
||||
return xml.elements.subList(0, item.index()).stream()
|
||||
.filter(
|
||||
e ->
|
||||
isViewer(e)
|
||||
&& (e.compareDocumentPosition(owner) & Node.DOCUMENT_POSITION_CONTAINED_BY)
|
||||
== 0)
|
||||
.map(e -> e.getAttributeNS(BindingDocument.FX, "id"))
|
||||
.filter(id -> !id.isEmpty() && !duplicateIds.contains(id))
|
||||
.map(id -> "$" + id)
|
||||
.toList();
|
||||
}
|
||||
|
||||
private boolean isViewer(Element e) {
|
||||
String tag =
|
||||
BindingDocument.FX.equals(e.getNamespaceURI()) && "root".equals(e.getLocalName())
|
||||
? e.getAttribute("type")
|
||||
: e.getTagName();
|
||||
return resolves(tag, TYPES.get("HtmlViewer"));
|
||||
}
|
||||
|
||||
List<String> viewerReferenceErrors() {
|
||||
var errors = new ArrayList<String>();
|
||||
for (var item : items) {
|
||||
if (!item.type().equals(MEDIA_BUTTON)) continue;
|
||||
String value = element(item).getAttribute("viewer");
|
||||
if (!value.isEmpty() && !value.startsWith("${") && !viewerTargets(item).contains(value))
|
||||
errors.add(viewerReferenceError(value));
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
private static String viewerReferenceError(String value) {
|
||||
return "HtmlMediaButton.viewer requires a unique HtmlViewer fx:id declared before the button: "
|
||||
+ value;
|
||||
}
|
||||
|
||||
private boolean resolves(String tag, String type) {
|
||||
if (tag.contains(".")) return tag.equals(type);
|
||||
if (imports.containsKey(tag)) return type.equals(imports.get(tag));
|
||||
@@ -112,7 +169,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 +273,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 +311,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, "");
|
||||
@@ -283,7 +346,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.");
|
||||
if (!palette().contains(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<Replacement>();
|
||||
@@ -298,6 +361,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 +435,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");
|
||||
@@ -430,6 +502,7 @@ final class FormDocument {
|
||||
.contains(item.type())) field(fields, "editable", "Boolean", "true");
|
||||
if (Set.of("Label", "Button", "CheckBox", "TextArea").contains(item.type()))
|
||||
field(fields, "wrapText", "Boolean", "false");
|
||||
if (item.type().equals(MEDIA_BUTTON)) field(fields, "viewer", VIEWER_REFERENCE, "none");
|
||||
if (item.type().equals("HtmlViewer")) {
|
||||
field(fields, "html", "String", "");
|
||||
field(fields, "mediaButtonVisible", "Boolean", "true");
|
||||
@@ -561,6 +634,10 @@ final class FormDocument {
|
||||
}
|
||||
if (!reset) {
|
||||
switch (field.type()) {
|
||||
case VIEWER_REFERENCE -> {
|
||||
if (!viewerTargets(item).contains(input))
|
||||
throw new IllegalArgumentException(viewerReferenceError(input));
|
||||
}
|
||||
case "Boolean" -> {
|
||||
if (!Set.of("true", "false").contains(input))
|
||||
throw new IllegalArgumentException("Choose true or false.");
|
||||
|
||||
@@ -14,6 +14,7 @@ final class FormEditor extends VBox {
|
||||
private final Spinner<Integer> position = new Spinner<>(0, 0, 0);
|
||||
private final ComboBox<FormDocument.Item> selected = combo("form-control");
|
||||
private final ComboBox<FormDocument.Field> field = combo("form-property");
|
||||
private final ComboBox<String> viewers = combo("form-viewer-reference");
|
||||
private final ComboBox<String> handlers = combo("form-event-handlers");
|
||||
private Optional<List<String>> verifiedHandlers = Optional.empty();
|
||||
private final TextArea value = new TextArea();
|
||||
@@ -29,8 +30,6 @@ final class FormEditor extends VBox {
|
||||
Consumer<BindingDocument.Values> bind) {
|
||||
super(5);
|
||||
this.submit = submit;
|
||||
palette.getItems().setAll(FormDocument.TYPES.keySet());
|
||||
palette.setValue("Label");
|
||||
position.setId("form-position");
|
||||
position.setPrefWidth(74);
|
||||
handlers.setPromptText("Choose controller method");
|
||||
@@ -40,6 +39,9 @@ final class FormEditor extends VBox {
|
||||
e -> {
|
||||
if (handlers.getValue() != null) value.setText(handlers.getValue());
|
||||
});
|
||||
viewers.setPromptText("Choose HtmlViewer");
|
||||
viewers.managedProperty().bind(viewers.visibleProperty());
|
||||
value.managedProperty().bind(value.visibleProperty());
|
||||
value.setId("form-value");
|
||||
value.setPrefRowCount(2);
|
||||
details.setId("form-field-type");
|
||||
@@ -91,6 +93,7 @@ final class FormEditor extends VBox {
|
||||
position.getValue())))),
|
||||
row(new Label("Property"), field, details),
|
||||
handlers,
|
||||
viewers,
|
||||
value,
|
||||
row(
|
||||
button(
|
||||
@@ -107,7 +110,12 @@ final class FormEditor extends VBox {
|
||||
+ " for ActionEvent. Choose a listed method with no"
|
||||
+ " argument or a compatible event argument.");
|
||||
return form.set(
|
||||
selected.getValue(), field.getValue(), value.getText(), false);
|
||||
selected.getValue(),
|
||||
field.getValue(),
|
||||
viewers.isVisible()
|
||||
? Objects.toString(viewers.getValue(), "")
|
||||
: value.getText(),
|
||||
false);
|
||||
})),
|
||||
button(
|
||||
"Reset property",
|
||||
@@ -160,6 +168,13 @@ final class FormEditor extends VBox {
|
||||
}
|
||||
}
|
||||
|
||||
void selectViewerField() {
|
||||
field.getItems().stream()
|
||||
.filter(property -> property.type().equals(FormDocument.VIEWER_REFERENCE))
|
||||
.findFirst()
|
||||
.ifPresent(field::setValue);
|
||||
}
|
||||
|
||||
void selectIndex(Integer index) {
|
||||
if (form == null || index == null || loading) return;
|
||||
form.items.stream()
|
||||
@@ -213,6 +228,11 @@ final class FormEditor extends VBox {
|
||||
handlers.getSelectionModel().clearSelection();
|
||||
var f = field.getValue();
|
||||
var item = selected.getValue();
|
||||
boolean viewerReference = f != null && f.type().equals(FormDocument.VIEWER_REFERENCE);
|
||||
viewers.setVisible(viewerReference);
|
||||
value.setVisible(!viewerReference);
|
||||
viewers.getItems().clear();
|
||||
viewers.setValue(null);
|
||||
if (form == null || item == null || f == null) {
|
||||
details.setText("");
|
||||
value.clear();
|
||||
@@ -227,8 +247,17 @@ final class FormEditor extends VBox {
|
||||
? "bind to a model list"
|
||||
: f.editable() ? "editable" : "read only"));
|
||||
if (eventSelected()) showHandlerStatus();
|
||||
String current = form.value(item, f);
|
||||
if (viewerReference) {
|
||||
viewers.getItems().setAll(form.viewerTargets(item));
|
||||
if (viewers.getItems().contains(current)) viewers.setValue(current);
|
||||
else if (!current.isEmpty())
|
||||
details.setText("Unresolved or incompatible HtmlViewer target " + current);
|
||||
else if (viewers.getItems().isEmpty())
|
||||
details.setText("No HtmlViewer with an earlier fx:id.");
|
||||
}
|
||||
value.setEditable(f.editable());
|
||||
value.setText(form.value(item, f));
|
||||
value.setText(current);
|
||||
}
|
||||
|
||||
String load(String source, boolean writable) {
|
||||
@@ -243,6 +272,9 @@ final class FormEditor extends VBox {
|
||||
loading = true;
|
||||
try {
|
||||
form = new FormDocument(source);
|
||||
String paletteType = palette.getValue();
|
||||
palette.getItems().setAll(form.palette());
|
||||
palette.setValue(palette.getItems().contains(paletteType) ? paletteType : "Label");
|
||||
selected.getItems().setAll(form.items);
|
||||
destination.getItems().setAll(form.slots);
|
||||
selected.setValue(
|
||||
|
||||
@@ -104,7 +104,7 @@ final class GridDockDocument {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Element property(Element e, String name) {
|
||||
static Element property(Element e, String name) {
|
||||
var list = children(e).stream().filter(c -> c.getTagName().equals(name)).toList();
|
||||
if (list.size() > 1) throw new IllegalArgumentException("Multiple declarations of " + name);
|
||||
return list.isEmpty() ? null : list.getFirst();
|
||||
@@ -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(
|
||||
@@ -232,6 +310,59 @@ final class GridDockDocument {
|
||||
xml.elements.indexOf(map), Collections.singletonMap(key, remove ? null : encoded));
|
||||
}
|
||||
|
||||
// DataGridColumn defaults in the target library. The Kit does not load target classes.
|
||||
static final Map<String, String> COLUMN_WIDTHS =
|
||||
Map.of("minimumWidth", "80", "width", "150", "maximumWidth", "1200");
|
||||
|
||||
private record ColumnWidth(String description, Double literal) {
|
||||
static ColumnWidth read(Element column, String name, String edited, String proposed) {
|
||||
String text = column.getAttribute(name);
|
||||
if (name.equals(edited)) text = proposed;
|
||||
else {
|
||||
var nested = property(column, name);
|
||||
if (nested != null) {
|
||||
if (!children(nested).isEmpty()) return new ColumnWidth(name + "=<nested FXML>", null);
|
||||
text = nested.getTextContent().strip();
|
||||
}
|
||||
}
|
||||
boolean useDefault = text.isEmpty();
|
||||
if (useDefault) text = COLUMN_WIDTHS.get(name);
|
||||
String label = name + "=" + text;
|
||||
if (reference(text) || text.startsWith("#")) {
|
||||
if (name.equals(edited))
|
||||
throw new IllegalArgumentException("Enter a literal pixel width for " + name);
|
||||
return new ColumnWidth(label + " (resolved at runtime)", null);
|
||||
}
|
||||
double pixels;
|
||||
try {
|
||||
pixels = Double.parseDouble(text);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new IllegalArgumentException("Expected a pixel width for " + label);
|
||||
}
|
||||
if (!Double.isFinite(pixels) || pixels <= 0)
|
||||
throw new IllegalArgumentException("Expected a finite, positive pixel width for " + label);
|
||||
return new ColumnWidth(label + (useDefault ? " (default)" : ""), pixels);
|
||||
}
|
||||
|
||||
boolean exceeds(ColumnWidth other) {
|
||||
return literal != null && other.literal != null && literal > other.literal;
|
||||
}
|
||||
}
|
||||
|
||||
private static void validateColumnWidths(Element column, String edited, String proposed) {
|
||||
var minimum = ColumnWidth.read(column, "minimumWidth", edited, proposed);
|
||||
var width = ColumnWidth.read(column, "width", edited, proposed);
|
||||
var maximum = ColumnWidth.read(column, "maximumWidth", edited, proposed);
|
||||
if (minimum.exceeds(width) || width.exceeds(maximum) || minimum.exceeds(maximum))
|
||||
throw new IllegalArgumentException(
|
||||
"Expected minimumWidth ≤ width ≤ maximumWidth: "
|
||||
+ minimum.description()
|
||||
+ ", "
|
||||
+ width.description()
|
||||
+ ", "
|
||||
+ maximum.description());
|
||||
}
|
||||
|
||||
List<Replacement> set(Element e, String field, String value) {
|
||||
if (!SETTINGS.getOrDefault(type(e), List.of()).contains(field)
|
||||
|| Set.of("items", "source", "groupLabels").contains(field))
|
||||
@@ -239,7 +370,7 @@ final class GridDockDocument {
|
||||
if (property(e, field) != null)
|
||||
throw new IllegalArgumentException(
|
||||
"The property has a nested declaration. Edit it in Source.");
|
||||
if (e.getAttribute(field).matches("^[%$#].*"))
|
||||
if (reference(e.getAttribute(field)) || e.getAttribute(field).startsWith("#"))
|
||||
throw new IllegalArgumentException("This property is a reference. Edit it in Source.");
|
||||
boolean required =
|
||||
field.equals("id") || field.equals("destinationId") || field.equals("header");
|
||||
@@ -248,7 +379,9 @@ final class GridDockDocument {
|
||||
var opts = options(field);
|
||||
if (!value.isEmpty() && !opts.isEmpty() && !opts.contains(value))
|
||||
throw new IllegalArgumentException("Choose one of " + opts);
|
||||
if (!value.isEmpty()
|
||||
if (type(e).equals("DataGridColumn") && COLUMN_WIDTHS.containsKey(field)) {
|
||||
validateColumnWidths(e, field, value);
|
||||
} else if (!value.isEmpty()
|
||||
&& Set.of(
|
||||
"width",
|
||||
"minimumWidth",
|
||||
|
||||
@@ -250,8 +250,33 @@ final class GridDockEditor extends VBox {
|
||||
default -> "";
|
||||
}
|
||||
: "";
|
||||
if (doc.type(e).equals("DataGridColumn") && GridDockDocument.COLUMN_WIDTHS.containsKey(field)) {
|
||||
hint =
|
||||
GridDockDocument.property(e, field) == null
|
||||
? "Default: " + GridDockDocument.COLUMN_WIDTHS.get(field) + " px"
|
||||
: "Nested FXML value";
|
||||
value.setTooltip(
|
||||
new Tooltip(
|
||||
"minimumWidth ≤ width ≤ maximumWidth. FXML references are resolved at runtime."));
|
||||
} else value.setTooltip(null);
|
||||
value.setPromptText(hint);
|
||||
value.getItems().setAll(GridDockDocument.options(field));
|
||||
if ("attribute".equals(field) || "groupAttribute".equals(field)) {
|
||||
var columns = doc.branches(doc.parentOfType(e, "DataGrid"));
|
||||
value
|
||||
.getItems()
|
||||
.setAll(
|
||||
columns.stream()
|
||||
.map(
|
||||
column ->
|
||||
column.getAttribute(
|
||||
column.hasAttribute("attribute") ? "attribute" : "id"))
|
||||
.filter(name -> !name.isBlank())
|
||||
.distinct()
|
||||
.toList());
|
||||
value.setTooltip(
|
||||
new Tooltip(
|
||||
"Row attributes used by this grid. You can also enter another row attribute."));
|
||||
} else value.getItems().setAll(GridDockDocument.options(field));
|
||||
value.setValue(e.getAttribute(field));
|
||||
value.getEditor().setText(e.getAttribute(field));
|
||||
}
|
||||
|
||||
@@ -401,6 +401,7 @@ final class ReferenceDocument {
|
||||
&& a.getNodeName().equals("source")) id = a.getNodeValue();
|
||||
if (id != null && !available.contains(id)) result.add("Unresolved FXML reference: " + id);
|
||||
}
|
||||
result.addAll(new FormDocument(xml).viewerReferenceErrors());
|
||||
return List.copyOf(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,11 @@ class FormDocumentTest {
|
||||
@Test
|
||||
void emptyGridAndNamedListsKeepReferencesAndRejectCycles() throws Exception {
|
||||
assertEquals(
|
||||
9, FormDocument.TYPES.values().stream().filter(n -> n.startsWith("de.neitzel.")).count());
|
||||
9,
|
||||
doc().palette().stream()
|
||||
.map(FormDocument.TYPES::get)
|
||||
.filter(n -> n.startsWith("de.neitzel."))
|
||||
.count());
|
||||
for (String type :
|
||||
List.of(
|
||||
"Label",
|
||||
@@ -168,4 +172,34 @@ class FormDocumentTest {
|
||||
assertEquals(2, doc().size(slot("", "items")));
|
||||
assertFalse(source.contains("<items>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void mediaReferenceChecksTypeAndDeclarationOrderAndPreservesHtmlBinding() throws Exception {
|
||||
source =
|
||||
"""
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import de.neitzel.archiver.ui.HtmlMediaButton?>
|
||||
<?import de.neitzel.fx.control.HtmlViewer?>
|
||||
<?import de.neitzel.fx.view.*?>
|
||||
<HBox xmlns:fx="http://javafx.com/fxml/1">
|
||||
<fx:define><BindingList><DirectBinding control="article" property="html" path="html" direction="view"/></BindingList></fx:define>
|
||||
<HtmlViewer fx:id="article"/>
|
||||
<Label fx:id="unrelated"/>
|
||||
<HtmlMediaButton fx:id="media" viewer="$unrelated"/>
|
||||
<HtmlViewer fx:id="later"/>
|
||||
</HBox>
|
||||
""";
|
||||
assertTrue(doc().palette().contains("HtmlMediaButton"));
|
||||
assertEquals(List.of("$article"), doc().viewerTargets(item("media")));
|
||||
assertTrue(new ReferenceDocument(source).referenceErrors().getFirst().contains("$unrelated"));
|
||||
assertThrows(IllegalArgumentException.class, () -> set("media", "viewer", "$later"));
|
||||
assertThrows(IllegalArgumentException.class, () -> set("media", "viewer", "$missing"));
|
||||
set("media", "viewer", "$article");
|
||||
assertTrue(new ReferenceDocument(source).referenceErrors().isEmpty());
|
||||
assertTrue(
|
||||
source.contains(
|
||||
"<DirectBinding control=\"article\" property=\"html\" path=\"html\""
|
||||
+ " direction=\"view\"/>"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,33 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class GridDockDocumentTest {
|
||||
@Test
|
||||
void columnBoundsIncludeDefaultsResetsAndKnownPartsOfDynamicWidths() throws Exception {
|
||||
var doc =
|
||||
new GridDockDocument(
|
||||
"<?import de.neitzel.fx.view.*?><DataGridColumn width='230' minimumWidth='200'/>");
|
||||
var col = doc.xml.elements.getFirst();
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "width", ""));
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "minimumWidth", "300"));
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "maximumWidth", "100"));
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "width", "%size"));
|
||||
assertDoesNotThrow(() -> doc.set(col, "maximumWidth", "230"));
|
||||
assertDoesNotThrow(() -> doc.set(col, "minimumWidth", ""));
|
||||
var dynamic =
|
||||
new GridDockDocument(
|
||||
"<?import de.neitzel.fx.view.*?><DataGridColumn width='%start' maximumWidth='200'/>");
|
||||
var bound = dynamic.xml.elements.getFirst();
|
||||
assertTrue(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> dynamic.set(bound, "minimumWidth", "201"))
|
||||
.getMessage()
|
||||
.contains("%start (resolved at runtime)"));
|
||||
assertEquals(
|
||||
dynamic.xml.text.replace("200", "210"),
|
||||
dynamic.xml.source.apply(dynamic.set(bound, "maximumWidth", "210")));
|
||||
assertThrows(IllegalArgumentException.class, () -> dynamic.set(bound, "width", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
void dockMinimaAllowZeroWithoutChangingGridColumnRules() throws Exception {
|
||||
var source =
|
||||
@@ -49,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 =
|
||||
|
||||
@@ -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,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
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ In **Form controls**, choose **Tab** from the palette and **TabPane / tabs** as
|
||||
|
||||
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.
|
||||
|
||||
Set the column widths so that `minimumWidth ≤ width ≤ maximumWidth`. Clearing a field restores its default (80, 150 and 1200 pixels respectively). The inspector checks the remaining literal bounds when a sibling value is supplied by an FXML reference.
|
||||
|
||||
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**.
|
||||
|
||||
### Dock group size, splitting and persistence
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package qualification;
|
||||
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.control.*;
|
||||
@@ -42,10 +43,32 @@ public final class ArchiveTargetProbe {
|
||||
}
|
||||
}
|
||||
|
||||
static void verify(
|
||||
String state,
|
||||
String expected,
|
||||
Map<String, MenuItem> commands,
|
||||
Button trash,
|
||||
StringBuilder evidence) {
|
||||
var active = new TreeSet<String>();
|
||||
commands.forEach(
|
||||
(name, item) -> {
|
||||
if (!item.isDisable()) active.add(name);
|
||||
});
|
||||
if (!trash.isDisabled()) active.add("trash");
|
||||
if (commands.size() != 21 || !active.equals(Set.of(expected.trim().split(" +"))))
|
||||
throw new AssertionError(state + " expected [" + expected + "] actual " + active);
|
||||
evidence.append(state).append(" · enabled ").append(active).append("\n");
|
||||
}
|
||||
|
||||
static boolean inspect(Path directory) throws Exception {
|
||||
var stage =
|
||||
Window.getWindows().stream()
|
||||
.filter(Window::isShowing)
|
||||
.filter(
|
||||
w ->
|
||||
w.isShowing()
|
||||
&& w.getOpacity() > 0
|
||||
&& w instanceof javafx.stage.Stage s
|
||||
&& Objects.toString(s.getTitle(), "").startsWith("Neitzel preview"))
|
||||
.filter(w -> w.getScene().lookup("#trash-button") instanceof Button)
|
||||
.findFirst();
|
||||
if (stage.isEmpty()) return false;
|
||||
@@ -73,11 +96,23 @@ public final class ArchiveTargetProbe {
|
||||
trash.fire();
|
||||
if (!status.getText().equals("Vorschau · Bereit"))
|
||||
throw new AssertionError("Disabled command ran");
|
||||
if (((TreeView<?>) root.lookup("#folders")).getRoot() == null
|
||||
|| root.lookup("#dockPane").lookupAll(".label").stream()
|
||||
.noneMatch(
|
||||
n -> n instanceof Label l && l.getText().equals("Dokument im Beispielarchiv")))
|
||||
if (root.lookup("#dockPane").lookupAll(".label").stream()
|
||||
.noneMatch(n -> n instanceof Label l && l.getText().equals("Dokument im Beispielarchiv")))
|
||||
return false;
|
||||
var commands = new LinkedHashMap<String, MenuItem>();
|
||||
for (var group : ((MenuBar) root.lookup(".menu-bar")).getMenus()) {
|
||||
for (var item : group.getItems()) {
|
||||
if (!(item instanceof Menu) && item.getOnAction() != null)
|
||||
commands.put(item == open ? "open" : item.getId(), item);
|
||||
}
|
||||
}
|
||||
var evidence = new StringBuilder();
|
||||
String idle = "open openReadOnly overview preferences";
|
||||
String ready = idle + " closeArchive refresh rebuild trash find slideshow";
|
||||
String write = " importFile singleFile naming pending manageMail";
|
||||
String readEntry = " showFile showPlace openFile";
|
||||
String editEntry = " tags move duplicate";
|
||||
verify("closed", idle, commands, trash, evidence);
|
||||
open.fire();
|
||||
String afterOpen = status.getText();
|
||||
if (trash.isDisabled() || !afterOpen.endsWith(" · 1")) throw new AssertionError(afterOpen);
|
||||
@@ -85,6 +120,57 @@ public final class ArchiveTargetProbe {
|
||||
String afterTrash = status.getText();
|
||||
if (!afterTrash.equals("Vorschau · Beispielpapierkorb geöffnet · 2"))
|
||||
throw new AssertionError(afterTrash);
|
||||
var dialog =
|
||||
Window.getWindows().stream()
|
||||
.filter(w -> w.isShowing() && w.getScene().lookup("#archive-trash") != null)
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
var content = dialog.getScene().getRoot();
|
||||
var items = (TableView<?>) content.lookup("#trash-items");
|
||||
String summary = ((Label) content.lookup("#summary")).getText();
|
||||
boolean writable = afterOpen.equals("Vorschau · Beispielarchiv geöffnet · 1");
|
||||
if (items.getItems().size() != 2
|
||||
|| !summary.contains("3 Dateien")
|
||||
|| ((Button) content.lookup("#trash-delete")).isDisabled() == writable)
|
||||
throw new AssertionError(summary);
|
||||
((Button) ((DialogPane) content).lookupButton(ButtonType.CLOSE)).fire();
|
||||
if (dialog.isShowing()) throw new AssertionError("Trash dialog did not close");
|
||||
evidence.append(summary).append("\n");
|
||||
var folders = (TreeView<?>) root.lookup("#folders");
|
||||
var entries = (ChoiceBox<?>) root.lookup("#example-entry");
|
||||
var phase = (ChoiceBox<?>) root.lookup("#example-activity");
|
||||
String mode = writable ? "writable" : "read-only";
|
||||
String opened = writable ? ready + write : ready;
|
||||
verify(mode, opened, commands, trash, evidence);
|
||||
folders.getSelectionModel().select(0);
|
||||
entries.getSelectionModel().select(0);
|
||||
String selected = opened + " rules" + readEntry + (writable ? editEntry : "");
|
||||
verify(mode + ", invoice selected", selected, commands, trash, evidence);
|
||||
entries.getSelectionModel().select(1);
|
||||
verify("server-bound mail", selected.replace(" move", ""), commands, trash, evidence);
|
||||
entries.getSelectionModel().select(0);
|
||||
phase.getSelectionModel().select(1);
|
||||
verify("initial scan", "slideshow" + readEntry, commands, trash, evidence);
|
||||
phase.getSelectionModel().select(2);
|
||||
verify("background scan", "find slideshow" + readEntry, commands, trash, evidence);
|
||||
phase.getSelectionModel().select(3);
|
||||
verify("busy", "find", commands, trash, evidence);
|
||||
commands.get("importFile").fire();
|
||||
if (!status.getText().equals(afterTrash)) throw new AssertionError("Blocked import executed");
|
||||
phase.getSelectionModel().select(4);
|
||||
verify("foreground read", selected.replace(" closeArchive", ""), commands, trash, evidence);
|
||||
phase.getSelectionModel().select(0);
|
||||
entries.getSelectionModel().clearSelection();
|
||||
folders.getSelectionModel().clearSelection();
|
||||
verify("selection cleared", opened, commands, trash, evidence);
|
||||
commands.get("closeArchive").fire();
|
||||
verify("archive closed", idle, commands, trash, evidence);
|
||||
String closedStatus = status.getText();
|
||||
trash.fire();
|
||||
if (!status.getText().equals(closedStatus) || folders.getRoot() != null)
|
||||
throw new AssertionError(closedStatus);
|
||||
commands.get("openReadOnly").fire();
|
||||
verify("read-only reopened", ready, commands, trash, evidence);
|
||||
String run = Files.readString(directory.resolve("attempt")).trim();
|
||||
var image = root.snapshot(null, null);
|
||||
int width = (int) image.getWidth(), height = (int) image.getHeight();
|
||||
@@ -108,7 +194,7 @@ public final class ArchiveTargetProbe {
|
||||
screenshot, "png", directory.resolve("preview-" + run + ".png").toFile());
|
||||
Files.writeString(
|
||||
directory.resolve("result-" + run),
|
||||
afterOpen + "\n" + afterTrash + "\n" + ProcessHandle.current().pid());
|
||||
afterOpen + "\n" + afterTrash + "\n" + evidence + ProcessHandle.current().pid());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public final class DocumentTabsTargetProbe {
|
||||
Thread.ofPlatform().daemon().start(() -> Probe.run(Path.of(dir)));
|
||||
}
|
||||
|
||||
private static final class Probe {
|
||||
static final class Probe {
|
||||
private static <T> T fx(Callable<T> task) throws Exception {
|
||||
var future = new FutureTask<>(task);
|
||||
Platform.runLater(future);
|
||||
@@ -80,7 +80,8 @@ public final class DocumentTabsTargetProbe {
|
||||
} else {
|
||||
result = checkDetails(dir, root, id);
|
||||
}
|
||||
Files.writeString(dir.resolve("result-" + id), result);
|
||||
var completed = Files.writeString(dir.resolve("result-" + id + ".tmp"), result);
|
||||
Files.move(completed, dir.resolve("result-" + id), StandardCopyOption.ATOMIC_MOVE);
|
||||
} catch (Throwable error) {
|
||||
var trace = new java.io.StringWriter();
|
||||
error.printStackTrace(new java.io.PrintWriter(trace));
|
||||
@@ -180,7 +181,7 @@ public final class DocumentTabsTargetProbe {
|
||||
popup(input, "Beleg geprüft", dir.resolve("rechnung-tab-tags.png"));
|
||||
}
|
||||
|
||||
private static Node select(TabPane group, String name) throws Exception {
|
||||
static Node select(TabPane group, String name) throws Exception {
|
||||
var tab =
|
||||
fx(
|
||||
() -> {
|
||||
@@ -198,7 +199,7 @@ public final class DocumentTabsTargetProbe {
|
||||
return fx(tab::getContent);
|
||||
}
|
||||
|
||||
private static void checkHtml(Node root, String heading, String text) throws Exception {
|
||||
static void checkHtml(Node root, String heading, String text) throws Exception {
|
||||
await(
|
||||
heading,
|
||||
() -> {
|
||||
@@ -242,13 +243,13 @@ public final class DocumentTabsTargetProbe {
|
||||
return named;
|
||||
}
|
||||
|
||||
private static void requireChips(Node root, String... expected) throws Exception {
|
||||
static void requireChips(Node root, String... expected) throws Exception {
|
||||
var actual = chips(root).keySet();
|
||||
if (!actual.equals(Set.of(expected)))
|
||||
throw new AssertionError("Assigned tags " + actual + " vs " + Arrays.toString(expected));
|
||||
}
|
||||
|
||||
private static Button removeButton(Node root, String text) throws Exception {
|
||||
static Button removeButton(Node root, String text) throws Exception {
|
||||
return (Button)
|
||||
Objects.requireNonNull(chips(root).get(text), text).lookup(".tag-chip-remove");
|
||||
}
|
||||
@@ -260,29 +261,25 @@ public final class DocumentTabsTargetProbe {
|
||||
long activateAfter = 0;
|
||||
while (System.nanoTime() < deadline) {
|
||||
if (System.nanoTime() >= activateAfter
|
||||
&& !fx(field::isFocused)
|
||||
&& !fx(() -> field.isFocused() && field.getScene().getWindow().isFocused())
|
||||
&& System.getProperty("os.name").startsWith("Mac")) {
|
||||
String activate =
|
||||
"ObjC.import('AppKit');"
|
||||
+ " $.NSRunningApplication.runningApplicationWithProcessIdentifier("
|
||||
+ ProcessHandle.current().pid()
|
||||
+ ").activateWithOptions(2)";
|
||||
new ProcessBuilder("/usr/bin/osascript", "-l", "JavaScript", "-e", activate)
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
.waitFor(5, TimeUnit.SECONDS);
|
||||
var desktop = java.awt.Desktop.getDesktop();
|
||||
if (desktop.isSupported(java.awt.Desktop.Action.APP_REQUEST_FOREGROUND)) {
|
||||
// Request activation from the preview process itself, which owns the FX stage.
|
||||
desktop.requestForeground(true);
|
||||
}
|
||||
activateAfter = System.nanoTime() + TimeUnit.SECONDS.toNanos(3);
|
||||
}
|
||||
boolean matched =
|
||||
fx(
|
||||
() -> {
|
||||
var stage = (Stage) field.getScene().getWindow();
|
||||
if (!field.isFocused()) {
|
||||
if (!stage.isFocused() || !field.isFocused()) {
|
||||
stage.toFront();
|
||||
stage.requestFocus();
|
||||
field.requestFocus();
|
||||
}
|
||||
if (!field.isFocused()) return false;
|
||||
if (!stage.isFocused() || !field.isFocused()) return false;
|
||||
if (!suggestions(field).contains(suggestion))
|
||||
throw new AssertionError(
|
||||
"Missing " + suggestion + " in catalogue " + suggestions(field));
|
||||
@@ -315,6 +312,10 @@ public final class DocumentTabsTargetProbe {
|
||||
+ field.isFocused()
|
||||
+ ", stage focused="
|
||||
+ field.getScene().getWindow().isFocused()
|
||||
+ ", focus owner="
|
||||
+ field.getScene().getFocusOwner()
|
||||
+ ", field bounds="
|
||||
+ field.localToScreen(field.getBoundsInLocal())
|
||||
+ ", catalogue="
|
||||
+ suggestions(field)
|
||||
+ ", windows="
|
||||
|
||||
@@ -7,6 +7,7 @@ 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.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javafx.embed.swing.SwingFXUtils;
|
||||
import javafx.scene.control.*;
|
||||
@@ -24,17 +25,24 @@ public final class DocumentTabsWorkflowProbe extends FormWorkflowProbe {
|
||||
"AutoCompleteTextField #input",
|
||||
"promptText",
|
||||
"Belegtag wählen");
|
||||
build(4);
|
||||
for (String id :
|
||||
new String[] {"details-invoice", "details-delivery", "details-readonly", "details-busy"})
|
||||
preview(id);
|
||||
qualify("details-invoice", "details-delivery", "details-readonly", "details-busy");
|
||||
open(project, "HtmlDocument");
|
||||
build(2);
|
||||
preview("html-invoice");
|
||||
preview("html-delivery");
|
||||
qualify("html-invoice", "html-delivery");
|
||||
open(project, "ArchiveWindow");
|
||||
build(2);
|
||||
preview("archive-window-documents");
|
||||
qualify("archive-window-documents");
|
||||
var ids = fx(this::available);
|
||||
if (!ids.contains("archive-window-media"))
|
||||
throw new AssertionError("Missing media example: " + ids);
|
||||
try {
|
||||
awaitExamples(List.of("missing-required-example"));
|
||||
throw new AssertionError("Missing descriptor was accepted");
|
||||
} catch (IllegalStateException expected) {
|
||||
String diagnostic = expected.getMessage();
|
||||
if (!diagnostic.contains(
|
||||
"ArchiveWindow.fxml · required [missing-required-example] · available " + ids))
|
||||
throw expected;
|
||||
step(diagnostic);
|
||||
}
|
||||
Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt")));
|
||||
}
|
||||
|
||||
@@ -65,32 +73,84 @@ public final class DocumentTabsWorkflowProbe extends FormWorkflowProbe {
|
||||
step("Saved and reopened " + control + "." + property + " = " + value);
|
||||
}
|
||||
|
||||
private void build(int examples) throws Exception {
|
||||
private List<String> available() {
|
||||
return ((ComboBox<?>) pane.lookup("#preview-example"))
|
||||
.getItems().stream().map(Example.class::cast).map(Example::id).toList();
|
||||
}
|
||||
|
||||
private String state() {
|
||||
return ((Label) pane.lookup("#preview-state")).getText();
|
||||
}
|
||||
|
||||
private boolean failed() {
|
||||
String state = state();
|
||||
return state.startsWith("Preview failed")
|
||||
|| state.startsWith("Preview blocked")
|
||||
|| state.startsWith("Preview unavailable")
|
||||
|| state.contains("correct the build");
|
||||
}
|
||||
|
||||
private String diagnostic(List<String> required) {
|
||||
return file.getName()
|
||||
+ " · required "
|
||||
+ required
|
||||
+ " · available "
|
||||
+ available()
|
||||
+ " · "
|
||||
+ state();
|
||||
}
|
||||
|
||||
private void awaitExamples(List<String> required) throws Exception {
|
||||
try {
|
||||
// Discovery publishes the complete list at once. Additional providers may extend it.
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() ->
|
||||
failed()
|
||||
|| state().contains("register an example")
|
||||
|| !state().startsWith("Building") && !available().isEmpty()));
|
||||
} catch (AssertionError timeout) {
|
||||
throw new AssertionError(fx(() -> diagnostic(required)), timeout);
|
||||
}
|
||||
if (!fx(() -> !failed() && available().containsAll(required)))
|
||||
throw new IllegalStateException(fx(() -> diagnostic(required)));
|
||||
}
|
||||
|
||||
private void qualify(String... examples) throws Exception {
|
||||
var required = List.of(examples);
|
||||
click(pane, "Form preview");
|
||||
click(pane, "Build and Refresh");
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() ->
|
||||
((ComboBox<?>) pane.lookup("#preview-example")).getItems().size() == examples));
|
||||
awaitExamples(required);
|
||||
step(file.getName() + " · available " + fx(this::available));
|
||||
for (String id : required) preview(id);
|
||||
}
|
||||
|
||||
private void preview(String id) throws Exception {
|
||||
choose("preview-example", id);
|
||||
String label =
|
||||
fx(() -> ((Example) ((ComboBox<?>) pane.lookup("#preview-example")).getValue()).label());
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() -> {
|
||||
String 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);
|
||||
return ((ImageView) pane.lookup("#full-preview-image")).getImage() != null
|
||||
&& state.contains(label);
|
||||
}));
|
||||
fx(
|
||||
() -> {
|
||||
var choices = (ComboBox<Example>) pane.lookup("#preview-example");
|
||||
var selected =
|
||||
choices.getItems().stream()
|
||||
.filter(example -> example.id().equals(id))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException(diagnostic(List.of(id))));
|
||||
choices.getSelectionModel().select(selected);
|
||||
return selected.label();
|
||||
});
|
||||
try {
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() ->
|
||||
failed()
|
||||
|| ((ImageView) pane.lookup("#full-preview-image")).getImage() != null
|
||||
&& state().contains(label)));
|
||||
} catch (AssertionError timeout) {
|
||||
throw new AssertionError(fx(() -> diagnostic(List.of(id))), timeout);
|
||||
}
|
||||
if (fx(this::failed)) throw new AssertionError(fx(() -> diagnostic(List.of(id))));
|
||||
fx(
|
||||
() -> {
|
||||
var frame = ((ImageView) pane.lookup("#full-preview-image")).getImage();
|
||||
|
||||
@@ -19,14 +19,14 @@ public final class FolderActionsTargetProbe {
|
||||
Thread.ofPlatform().daemon().start(() -> Worker.run(Path.of(dir)));
|
||||
}
|
||||
|
||||
private static final class Worker {
|
||||
private static <T> T fx(Callable<T> action) throws Exception {
|
||||
static final class Worker {
|
||||
static <T> T fx(Callable<T> action) throws Exception {
|
||||
var task = new FutureTask<>(action);
|
||||
Platform.runLater(task);
|
||||
return task.get(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private static void await(String description, Callable<Boolean> test) throws Exception {
|
||||
static void await(String description, Callable<Boolean> test) throws Exception {
|
||||
long end = System.nanoTime() + TimeUnit.SECONDS.toNanos(22);
|
||||
while (System.nanoTime() < end) {
|
||||
if (fx(test)) return;
|
||||
@@ -35,34 +35,38 @@ public final class FolderActionsTargetProbe {
|
||||
throw new AssertionError(description);
|
||||
}
|
||||
|
||||
private static void require(boolean value, String message) {
|
||||
static void require(boolean value, String message) {
|
||||
if (!value) throw new AssertionError(message);
|
||||
}
|
||||
|
||||
static Stage previewStage() throws Exception {
|
||||
Stage stage = null;
|
||||
while (stage == null) {
|
||||
Thread.sleep(120);
|
||||
try {
|
||||
stage =
|
||||
fx(
|
||||
() ->
|
||||
Window.getWindows().stream()
|
||||
.filter(
|
||||
w ->
|
||||
w instanceof Stage s
|
||||
&& s.isShowing()
|
||||
&& s.getOpacity() > 0
|
||||
&& s.getTitle() != null
|
||||
&& s.getTitle().startsWith("Neitzel preview"))
|
||||
.map(Stage.class::cast)
|
||||
.findFirst()
|
||||
.orElse(null));
|
||||
} catch (IllegalStateException starting) {
|
||||
}
|
||||
}
|
||||
return stage;
|
||||
}
|
||||
|
||||
private static void run(Path dir) {
|
||||
try {
|
||||
Stage stage = null;
|
||||
while (stage == null) {
|
||||
Thread.sleep(120);
|
||||
try {
|
||||
stage =
|
||||
fx(
|
||||
() ->
|
||||
Window.getWindows().stream()
|
||||
.filter(
|
||||
w ->
|
||||
w instanceof Stage s
|
||||
&& s.isShowing()
|
||||
&& s.getOpacity() > 0
|
||||
&& s.getTitle() != null
|
||||
&& s.getTitle().startsWith("Neitzel preview"))
|
||||
.map(Stage.class::cast)
|
||||
.findFirst()
|
||||
.orElse(null));
|
||||
} catch (IllegalStateException starting) {
|
||||
}
|
||||
}
|
||||
Stage shown = stage;
|
||||
Stage shown = previewStage();
|
||||
var root =
|
||||
fx(
|
||||
() -> {
|
||||
@@ -106,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))
|
||||
@@ -140,7 +144,7 @@ public final class FolderActionsTargetProbe {
|
||||
.orElseThrow();
|
||||
}
|
||||
|
||||
private static boolean visible(Node grid, String column) throws Exception {
|
||||
static boolean visible(Node grid, String column) throws Exception {
|
||||
return (boolean)
|
||||
grid.getClass().getMethod("isColumnVisible", String.class).invoke(grid, column);
|
||||
}
|
||||
@@ -283,7 +287,7 @@ public final class FolderActionsTargetProbe {
|
||||
+ " Dateityp; Kurzansicht restored hidden Dateityp.");
|
||||
}
|
||||
|
||||
private static void image(Node node, Path path) throws Exception {
|
||||
static void image(Node node, Path path) throws Exception {
|
||||
var img = node.snapshot(null, null);
|
||||
int w = (int) img.getWidth(), h = (int) img.getHeight();
|
||||
var out = new java.awt.image.BufferedImage(w, h, java.awt.image.BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
package qualification;
|
||||
|
||||
import static qualification.FolderActionsTargetProbe.Worker.*;
|
||||
|
||||
import java.nio.file.*;
|
||||
import java.time.*;
|
||||
import java.time.format.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.stage.Window;
|
||||
|
||||
/** Checks rendered folder rows and the ordinary modal profile dialogs in the preview worker. */
|
||||
public final class FolderProfilesTargetProbe {
|
||||
public static void premain(String directory) {
|
||||
if (System.getProperty("sun.java.command", "")
|
||||
.startsWith("de.neitzel.fxdesigner.target.WorkerMain "))
|
||||
Thread.ofPlatform().daemon().start(() -> Checks.run(Path.of(directory)));
|
||||
}
|
||||
|
||||
private static final class Checks {
|
||||
private static void run(Path dir) {
|
||||
try {
|
||||
var stage = previewStage();
|
||||
var root =
|
||||
fx(
|
||||
() -> {
|
||||
stage.setWidth(1360);
|
||||
stage.setHeight(700);
|
||||
var r = stage.getScene().getRoot();
|
||||
r.applyCss();
|
||||
r.layout();
|
||||
return r;
|
||||
});
|
||||
var attempt = Files.readString(dir.resolve("layout-case"));
|
||||
var result =
|
||||
switch (attempt) {
|
||||
case "profiles", "readonly", "rebound" -> profiles(root, attempt);
|
||||
case "metadata", "renamed", "recovered" -> metadata(root, attempt, dir);
|
||||
default -> throw new AssertionError(attempt);
|
||||
};
|
||||
Files.writeString(dir.resolve("result-" + attempt), result);
|
||||
} catch (Throwable failure) {
|
||||
var trace = new java.io.StringWriter();
|
||||
failure.printStackTrace(new java.io.PrintWriter(trace));
|
||||
try {
|
||||
Files.writeString(dir.resolve("target-error.txt"), trace.toString());
|
||||
} catch (Exception error) {
|
||||
error.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static DialogPane dialog(String title) {
|
||||
return Window.getWindows().stream()
|
||||
.filter(javafx.stage.Stage.class::isInstance)
|
||||
.map(javafx.stage.Stage.class::cast)
|
||||
.filter(s -> s.isShowing() && title.equals(s.getTitle()))
|
||||
.map(s -> (DialogPane) s.getScene().getRoot())
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
private static Button change(DialogPane d) {
|
||||
return (Button)
|
||||
d.lookupButton(
|
||||
d.getButtonTypes().stream()
|
||||
.filter(t -> t.getButtonData() == ButtonBar.ButtonData.OTHER)
|
||||
.findFirst()
|
||||
.orElseThrow());
|
||||
}
|
||||
|
||||
private static void toggle(Node grid, String header) {
|
||||
var menu = (MenuButton) grid.lookup(".data-grid-column-menu");
|
||||
menu.show();
|
||||
var item =
|
||||
(CheckMenuItem)
|
||||
menu.getItems().stream()
|
||||
.filter(i -> header.equals(i.getText()))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
item.setSelected(!item.isSelected());
|
||||
item.fire();
|
||||
menu.hide();
|
||||
}
|
||||
|
||||
private static String profiles(Parent root, String attempt) throws Exception {
|
||||
var grid = fx(() -> root.lookup("#grid"));
|
||||
var profiles = fx(() -> (ComboBox<String>) root.lookup("#folder-view-profile"));
|
||||
var save = fx(() -> (Button) root.lookup("#save-folder-view-profile"));
|
||||
var clear = fx(() -> (Button) root.lookup("#clear-folder-view-layout"));
|
||||
var manage = fx(() -> (Button) root.lookup("#manage-folder-view-profiles"));
|
||||
boolean readonly = attempt.equals("readonly"), rebound = attempt.equals("rebound");
|
||||
await(
|
||||
"Initial profile",
|
||||
() -> !manage.isDisabled() && profiles.isDisabled() == readonly && clear.isDisabled());
|
||||
String name = readonly ? "Metadaten" : "Prüfprofil";
|
||||
fx(
|
||||
() -> {
|
||||
require(
|
||||
!profiles.getItems().contains("Prüfprofil"),
|
||||
"New session inherited previous profile");
|
||||
if (!readonly) profiles.getEditor().setText(name);
|
||||
require(readonly == save.isDisabled(), "Save availability");
|
||||
if (!readonly && !rebound) {
|
||||
save.fire();
|
||||
require(profiles.getItems().contains(name), "Profile not saved");
|
||||
}
|
||||
toggle(grid, "Dateityp");
|
||||
return null;
|
||||
});
|
||||
await("Changed local layout", () -> !clear.isDisabled() && !visible(grid, "type"));
|
||||
fx(
|
||||
() -> {
|
||||
clear.fire();
|
||||
return null;
|
||||
});
|
||||
await("Restored local layout", () -> clear.isDisabled() && visible(grid, "type"));
|
||||
var openings = new AtomicInteger();
|
||||
String title = "Anzeigeprofile verwalten";
|
||||
ListChangeListener<Window> shown =
|
||||
changes -> {
|
||||
while (changes.next())
|
||||
for (Window w : changes.getAddedSubList())
|
||||
if (w instanceof javafx.stage.Stage s && title.equals(s.getTitle()))
|
||||
openings.incrementAndGet();
|
||||
};
|
||||
fx(
|
||||
() -> {
|
||||
Window.getWindows().addListener(shown);
|
||||
Platform.runLater((rebound ? save : manage)::fire);
|
||||
return null;
|
||||
});
|
||||
await("Profile manager opened", () -> dialog(title) != null);
|
||||
fx(
|
||||
() -> {
|
||||
var d = dialog(title);
|
||||
var list = (ListView<String>) d.lookup("#archive-display-profiles");
|
||||
if (rebound) require(!list.getItems().contains(name), "Old save handler also ran");
|
||||
else {
|
||||
list.getSelectionModel().select(name);
|
||||
var action = change(d);
|
||||
require(action.isDisabled() == readonly, "Profile deletion availability");
|
||||
if (!readonly) Platform.runLater(action::fire);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
if (!readonly && !rebound) {
|
||||
Callable<DialogPane> confirm =
|
||||
() ->
|
||||
Window.getWindows().stream()
|
||||
.filter(Window::isShowing)
|
||||
.map(w -> w.getScene().getRoot())
|
||||
.filter(DialogPane.class::isInstance)
|
||||
.map(DialogPane.class::cast)
|
||||
.filter(d -> d.getButtonTypes().contains(ButtonType.OK))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
await("Delete confirmation", () -> confirm.call() != null);
|
||||
fx(
|
||||
() -> {
|
||||
((Button) confirm.call().lookupButton(ButtonType.OK)).fire();
|
||||
return null;
|
||||
});
|
||||
await("Deleted own profile", () -> !profiles.getItems().contains(name));
|
||||
}
|
||||
fx(
|
||||
() -> {
|
||||
((Button) dialog(title).lookupButton(ButtonType.CLOSE)).fire();
|
||||
return null;
|
||||
});
|
||||
fx(
|
||||
() -> {
|
||||
Window.getWindows().removeListener(shown);
|
||||
require(
|
||||
openings.get() == 1 && dialog(title) == null,
|
||||
"Expected exactly one profile dialog: " + openings);
|
||||
return null;
|
||||
});
|
||||
if (rebound)
|
||||
return "Fresh session. Rebound Save opened exactly one management dialog, without saving a"
|
||||
+ " profile.";
|
||||
if (readonly)
|
||||
return "Read-only: archive save, selection and deletion disabled. Management and local"
|
||||
+ " layout change/reset succeeded.";
|
||||
return "Saved Prüfprofil, hid and restored Dateityp, deleted own profile after confirmation.";
|
||||
}
|
||||
|
||||
private static Label cell(Node grid, String text) {
|
||||
return grid.lookupAll(".label").stream()
|
||||
.filter(Label.class::isInstance)
|
||||
.map(Label.class::cast)
|
||||
.filter(l -> text.equals(l.getText()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new AssertionError(text));
|
||||
}
|
||||
|
||||
private static List<Label> row(Node grid, String file) {
|
||||
return cell(grid, file).getParent().getChildrenUnmodifiable().stream()
|
||||
.filter(Label.class::isInstance)
|
||||
.map(Label.class::cast)
|
||||
.toList();
|
||||
}
|
||||
|
||||
private static String date(String day) {
|
||||
return DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)
|
||||
.withZone(ZoneId.systemDefault())
|
||||
.format(Instant.parse(day + "T11:00:00Z"));
|
||||
}
|
||||
|
||||
private static void cells(Node grid, String file, String... expected) {
|
||||
var labels = row(grid, file);
|
||||
var actual = labels.stream().limit(10).map(Label::getText).toList();
|
||||
var values = new ArrayList<>(List.of(file));
|
||||
values.addAll(List.of(expected));
|
||||
require(actual.equals(values), file + " rendered " + actual + " expected " + values);
|
||||
require(
|
||||
labels.get(4).getPrefWidth() == 182 && labels.get(5).getPrefWidth() == 168,
|
||||
"Profile widths: " + labels.get(4).getPrefWidth() + ", " + labels.get(5).getPrefWidth());
|
||||
}
|
||||
|
||||
private static String metadata(Parent root, String attempt, Path dir) throws Exception {
|
||||
var grid = fx(() -> root.lookup("#grid"));
|
||||
var profiles = fx(() -> (ComboBox<String>) root.lookup("#folder-view-profile"));
|
||||
boolean renamed = !attempt.equals("metadata");
|
||||
String sent = renamed ? "versand" : "mailSent";
|
||||
await(
|
||||
"Loaded saved metadata profile",
|
||||
() -> visible(grid, sent) && visible(grid, "bookTitle") && !profiles.isDisabled());
|
||||
fx(
|
||||
() -> {
|
||||
require(
|
||||
"Metadaten".equals(profiles.getValue()), "Initial profile " + profiles.getValue());
|
||||
String january = "Z-Anfrage.eml", december = "A-Zusage.eml";
|
||||
cells(
|
||||
grid,
|
||||
january,
|
||||
"Anfrage",
|
||||
"ada@example.org",
|
||||
"archiv@example.org",
|
||||
"kopie@example.org",
|
||||
date("2026-01-01"),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"");
|
||||
cells(
|
||||
grid,
|
||||
december,
|
||||
"Zusage",
|
||||
"ada@example.org",
|
||||
"archiv@example.org",
|
||||
"kopie@example.org",
|
||||
date("2026-12-01"),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"");
|
||||
cells(
|
||||
grid,
|
||||
"Lesebuch.epub",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
renamed ? "Nordverlag" : "Das Lesebuch",
|
||||
"Ada Berg, Eva Tal",
|
||||
"Nordverlag",
|
||||
"de");
|
||||
cells(grid, "Notiz.txt", "", "", "", "", "", "", "", "", "");
|
||||
require(
|
||||
cell(grid, january).localToScene(0, 0).getY()
|
||||
< cell(grid, december).localToScene(0, 0).getY(),
|
||||
"Mail date sort order");
|
||||
var setup = grid.getClass().getMethod("snapshotSetup").invoke(grid);
|
||||
require(
|
||||
setup
|
||||
.getClass()
|
||||
.getMethod("sort")
|
||||
.invoke(setup)
|
||||
.toString()
|
||||
.contains(sent + ", direction=ASCENDING"),
|
||||
"Sort after restoration: " + setup);
|
||||
if (renamed) {
|
||||
cell(grid, "Buchverlag");
|
||||
require(
|
||||
root.lookupAll(".label").stream()
|
||||
.anyMatch(
|
||||
n -> n instanceof Label l && l.getText().contains("mailSent → versand")),
|
||||
"Missing profile mapping");
|
||||
image(root, dir.resolve("folder-metadata.png"));
|
||||
}
|
||||
profiles.getSelectionModel().select("\0STANDARD");
|
||||
return null;
|
||||
});
|
||||
await(
|
||||
"Standard hides metadata",
|
||||
() -> !visible(grid, sent) && !visible(grid, "mailCc") && !profiles.isDisabled());
|
||||
fx(
|
||||
() -> {
|
||||
profiles.getSelectionModel().select("\0EMAIL");
|
||||
return null;
|
||||
});
|
||||
await(
|
||||
"Email shows date and CC",
|
||||
() ->
|
||||
visible(grid, sent)
|
||||
&& visible(grid, "mailCc")
|
||||
&& !visible(grid, "bookTitle")
|
||||
&& !profiles.isDisabled());
|
||||
fx(
|
||||
() -> {
|
||||
profiles.getSelectionModel().select("Metadaten");
|
||||
return null;
|
||||
});
|
||||
await("Return to saved profile", () -> visible(grid, "bookTitle") && !profiles.isDisabled());
|
||||
return "Rendered two mails, EPUB and plain text. Nine metadata cells per row; sort "
|
||||
+ sent
|
||||
+ " ascending, CC 182 px, date 168 px. Standard → Email → Metadaten."
|
||||
+ (renamed ? " Retained date source and bookPublisher in Buchverlag." : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package qualification;
|
||||
|
||||
import static qualification.WorkflowProbe.*;
|
||||
|
||||
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;
|
||||
|
||||
/** Saves profile bindings and column declarations in the registered FolderTab editor. */
|
||||
public final class FolderProfilesWorkflowProbe extends DeclarationWorkflowProbe {
|
||||
@Override
|
||||
void verify(Project project) throws Exception {
|
||||
this.project = project;
|
||||
open("FolderTab");
|
||||
build("folder-actions");
|
||||
interactive("folder-actions", "profiles");
|
||||
interactive("folder-readonly", "readonly");
|
||||
interactive("folder-metadata", "metadata");
|
||||
for (var id : List.of("saveProfile", "clearLayout", "manageProfiles")) commands(id, id, 4);
|
||||
commands("saveProfile", "saveProfile", 4);
|
||||
click(pane, "Discover / Validate Commands");
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() ->
|
||||
((Label) pane.lookup("#command-status"))
|
||||
.getText()
|
||||
.contains("No detected binding errors.")));
|
||||
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)
|
||||
.filter(
|
||||
box ->
|
||||
box.getItems()
|
||||
.containsAll(List.of("manageProfiles", "saveProfile", "clearLayout")))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
choices.getSelectionModel().select("manageProfiles");
|
||||
return null;
|
||||
});
|
||||
click(pane, "Apply Command binding");
|
||||
String bound = "control=\"saveProfile\" path=\"manageProfiles\"";
|
||||
await(() -> source().contains(bound));
|
||||
inspector(true);
|
||||
select("DataGridColumn", "mailSent");
|
||||
applySetting("id", "versand");
|
||||
select("DataGridColumn", "bookTitle");
|
||||
combo("declaration-property", "attribute");
|
||||
choose("declaration-value", "bookPublisher");
|
||||
edit("Apply setting", "attribute=\"bookPublisher\"");
|
||||
applySetting("header", "Buchverlag");
|
||||
reopen("FolderTab", "header=\"Buchverlag\"");
|
||||
if (!source().contains(bound) || !source().contains("attribute=\"mailSent\""))
|
||||
throw new AssertionError(source());
|
||||
build("folder-actions");
|
||||
choose("preview-example", "folder-actions");
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() ->
|
||||
((Label) pane.lookup("#preview-state"))
|
||||
.getText()
|
||||
.contains("Suche und Anzeigeprofile")
|
||||
&& ((javafx.scene.image.ImageView) pane.lookup("#full-preview-image"))
|
||||
.getImage()
|
||||
!= null));
|
||||
commands("saveProfile", "manageProfiles", 4);
|
||||
fx(
|
||||
() -> {
|
||||
ImageIO.write(
|
||||
SwingFXUtils.fromFXImage(pane.snapshot(null, null), null),
|
||||
"png",
|
||||
output.resolve("intellij.png").toFile());
|
||||
return null;
|
||||
});
|
||||
interactive("folder-actions", "rebound");
|
||||
interactive("folder-metadata", "renamed");
|
||||
for (String invalid : List.of("keinFeld", "bookPublisher")) {
|
||||
inspector(true);
|
||||
select("DataGridColumn", "versand");
|
||||
applySetting("attribute", invalid);
|
||||
click(pane, "Form preview");
|
||||
click(pane, "Render drafts");
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() -> {
|
||||
var message = ((Label) pane.lookup("#preview-state")).getText();
|
||||
return message.contains("versand")
|
||||
&& message.contains(invalid)
|
||||
&& message.contains(
|
||||
invalid.equals("keinFeld") ? "unbekanntes Zeilenattribut" : "INTEGER");
|
||||
}));
|
||||
step("Preview diagnosed " + invalid + " on INTEGER column versand");
|
||||
click(pane, "Undo");
|
||||
await(() -> source().contains("attribute=\"mailSent\""));
|
||||
}
|
||||
interactive("folder-metadata", "recovered");
|
||||
Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt")));
|
||||
}
|
||||
}
|
||||
@@ -140,5 +140,38 @@ abstract class FormWorkflowProbe implements StartupActivity.DumbAware {
|
||||
});
|
||||
}
|
||||
|
||||
void commands(String control, String path, int count) throws Exception {
|
||||
fx(
|
||||
() -> {
|
||||
var group =
|
||||
(TitledPane)
|
||||
pane.lookupAll(".titled-pane").stream()
|
||||
.filter(n -> n instanceof TitledPane t && "Bindings".equals(t.getText()))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
group.setAnimated(false);
|
||||
group.setExpanded(true);
|
||||
var tabs = (TabPane) group.getContent();
|
||||
tabs.getSelectionModel()
|
||||
.select(
|
||||
tabs.getTabs().stream()
|
||||
.filter(t -> t.getText().equals("Command bindings"))
|
||||
.findFirst()
|
||||
.orElseThrow());
|
||||
pane.applyCss();
|
||||
pane.layout();
|
||||
var list = (ListView<?>) pane.lookup("#command-bindings");
|
||||
if (list.getItems().size() != count) throw new AssertionError(list.getItems());
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (list.getItems().get(i).toString().startsWith(control + " ←"))
|
||||
list.getSelectionModel().select(i);
|
||||
}
|
||||
if (!control.equals(((TextField) pane.lookup("#command-control")).getText())
|
||||
|| !path.equals(((TextField) pane.lookup("#command-path")).getText()))
|
||||
throw new AssertionError(control + " → " + path);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
abstract void verify(Project project) throws Exception;
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ import javax.imageio.ImageIO;
|
||||
public final class ImportWorkflowProbe extends FormWorkflowProbe {
|
||||
@Override
|
||||
void verify(Project project) throws Exception {
|
||||
open(project, "ConnectionForm", 2);
|
||||
open(project, "ConnectionForm");
|
||||
discover();
|
||||
target("securityChoices", "view", "security", "items", "COMPATIBLE");
|
||||
target("protocol", "both", "protocol", "value", "COMPATIBLE");
|
||||
target("security", "both", "security", "value", "COMPATIBLE");
|
||||
|
||||
open(project, "FolderTab", 2);
|
||||
open(project, "FolderTab");
|
||||
discover();
|
||||
target("view", "both", "view", "value", "COMPATIBLE");
|
||||
target("grouping", "both", "grouping", "value", "COMPATIBLE");
|
||||
@@ -31,20 +31,20 @@ public final class ImportWorkflowProbe extends FormWorkflowProbe {
|
||||
target("rows", "view", "clearLayout", "accessibleHelp", "INCOMPATIBLE");
|
||||
target("view", "both", "untypedPick", "value", "UNRESOLVED");
|
||||
target("rows", "view", "grid", "items", "COMPATIBLE");
|
||||
applyAndReopen(project, "FolderTab", 2, "grid", "items", "rows", "view");
|
||||
applyAndReopen(project, "FolderTab", "grid", "items", "rows", "view");
|
||||
preview("archive-folder", "import-grid");
|
||||
|
||||
open(project, "ImportForm", 3);
|
||||
open(project, "ImportForm");
|
||||
discover();
|
||||
target("folder", "both", "folders", "value", "COMPATIBLE");
|
||||
applyAndReopen(project, "ImportForm", 3, "folders", "value", "folder", "both");
|
||||
applyAndReopen(project, "ImportForm", "folders", "value", "folder", "both");
|
||||
preview("import-free", "import-free");
|
||||
preview("import-collision", "import-collision");
|
||||
preview("import-busy", "import-busy");
|
||||
Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt")));
|
||||
}
|
||||
|
||||
private void open(Project project, String form, int count) throws Exception {
|
||||
private void open(Project project, String form) throws Exception {
|
||||
var path =
|
||||
Path.of(project.getBasePath(), "src/main/resources/de/neitzel/archiver/ui", form + ".fxml");
|
||||
file = edt(() -> LocalFileSystem.getInstance().refreshAndFindFileByNioFile(path));
|
||||
@@ -52,8 +52,24 @@ public final class ImportWorkflowProbe extends FormWorkflowProbe {
|
||||
fx(pane::flush).toCompletableFuture().get(10, java.util.concurrent.TimeUnit.SECONDS);
|
||||
click(pane, "Form preview");
|
||||
click(pane, "Build and Refresh");
|
||||
var required =
|
||||
switch (form) {
|
||||
case "FolderTab" -> java.util.List.of("archive-folder", "folder-actions");
|
||||
case "ConnectionForm" -> java.util.List.of("connection-imap", "connection-jmap");
|
||||
case "ImportForm" -> java.util.List.of("import-free", "import-collision", "import-busy");
|
||||
default -> throw new IllegalArgumentException(form);
|
||||
};
|
||||
await(
|
||||
() -> fx(() -> ((ComboBox<?>) pane.lookup("#preview-example")).getItems().size() == count));
|
||||
() ->
|
||||
fx(
|
||||
() ->
|
||||
((ComboBox<?>) pane.lookup("#preview-example"))
|
||||
.getItems().stream()
|
||||
.map(
|
||||
de.neitzel.fxdesigner.workflow.DesignerWorkflow.Example.class::cast)
|
||||
.map(de.neitzel.fxdesigner.workflow.DesignerWorkflow.Example::id)
|
||||
.toList()
|
||||
.containsAll(required)));
|
||||
// The initial native document sync invalidates discovery while the first preview is loading.
|
||||
// Wait for the displayed revision before selecting a source in the inspector.
|
||||
await(
|
||||
@@ -73,7 +89,7 @@ public final class ImportWorkflowProbe extends FormWorkflowProbe {
|
||||
return ((ImageView) pane.lookup("#full-preview-image")).getImage() != null
|
||||
&& state.contains("revision");
|
||||
}));
|
||||
step("Opened " + form + " with " + count + " examples");
|
||||
step("Opened " + form + " with " + required);
|
||||
}
|
||||
|
||||
private void discover() throws Exception {
|
||||
@@ -161,7 +177,7 @@ public final class ImportWorkflowProbe extends FormWorkflowProbe {
|
||||
}
|
||||
|
||||
private void applyAndReopen(
|
||||
Project project, String form, int count, String id, String prop, String path, String dir)
|
||||
Project project, String form, String id, String prop, String path, String dir)
|
||||
throws Exception {
|
||||
click(pane, "Use selected target");
|
||||
if (!fx(
|
||||
@@ -188,7 +204,7 @@ public final class ImportWorkflowProbe extends FormWorkflowProbe {
|
||||
FileEditorManager.getInstance(project).closeFile(file);
|
||||
return null;
|
||||
});
|
||||
open(project, form, count);
|
||||
open(project, form);
|
||||
if (!source().contains(declaration)) throw new AssertionError("Binding was lost on reopen");
|
||||
step("Applied, saved and reopened " + declaration);
|
||||
}
|
||||
|
||||
@@ -106,38 +106,6 @@ public final class ManagementReadersWorkflowProbe extends FormWorkflowProbe {
|
||||
if (!source().contains(saved)) throw new AssertionError("Reopened " + form);
|
||||
}
|
||||
|
||||
private void commands(String control, String path, int count) throws Exception {
|
||||
fx(
|
||||
() -> {
|
||||
var group =
|
||||
(TitledPane)
|
||||
pane.lookupAll(".titled-pane").stream()
|
||||
.filter(n -> n instanceof TitledPane t && "Bindings".equals(t.getText()))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
group.setExpanded(true);
|
||||
var tabs = (TabPane) group.getContent();
|
||||
tabs.getSelectionModel()
|
||||
.select(
|
||||
tabs.getTabs().stream()
|
||||
.filter(t -> t.getText().equals("Command bindings"))
|
||||
.findFirst()
|
||||
.orElseThrow());
|
||||
pane.applyCss();
|
||||
pane.layout();
|
||||
var list = (ListView<?>) pane.lookup("#command-bindings");
|
||||
if (list.getItems().size() != count) throw new AssertionError(list.getItems());
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (list.getItems().get(i).toString().startsWith(control + " ←"))
|
||||
list.getSelectionModel().select(i);
|
||||
}
|
||||
if (!control.equals(((TextField) pane.lookup("#command-control")).getText())
|
||||
|| !path.equals(((TextField) pane.lookup("#command-path")).getText()))
|
||||
throw new AssertionError(control + " → " + path);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private void management(
|
||||
String form,
|
||||
String data,
|
||||
|
||||
@@ -284,6 +284,28 @@ public final class MediaLayoutGridTargetProbe {
|
||||
var cols = (List<?>) get(setup, "columns");
|
||||
var order = new ArrayList<String>();
|
||||
for (var col : cols) order.add((String) get(col, "id"));
|
||||
var labels =
|
||||
grid.lookupAll(".label").stream().map(Label.class::cast).map(Label::getText).toList();
|
||||
require(
|
||||
labels.containsAll(List.of("Musterrechnung.pdf", "Lieferbrief.txt")),
|
||||
"Example rows: " + labels);
|
||||
var widthType =
|
||||
Class.forName("de.neitzel.grid.ColumnWidth", true, grid.getClass().getClassLoader());
|
||||
var resize = grid.getClass().getMethod("setColumnWidth", String.class, widthType);
|
||||
var explicit =
|
||||
Class.forName(widthType.getName() + "$Explicit", true, widthType.getClassLoader())
|
||||
.getConstructor(double.class);
|
||||
var defaultWidth = get(cols.getFirst(), "width");
|
||||
require(
|
||||
order.getFirst().equals("path")
|
||||
&& defaultWidth.getClass().getSimpleName().equals("Default"),
|
||||
"Initial path column");
|
||||
require(
|
||||
resize.invoke(grid, "path", defaultWidth).equals(230d)
|
||||
&& resize.invoke(grid, "path", explicit.newInstance(50d)).equals(150d)
|
||||
&& resize.invoke(grid, "path", explicit.newInstance(600d)).equals(300d)
|
||||
&& resize.invoke(grid, "path", defaultWidth).equals(230d),
|
||||
"Rendered path column width limits");
|
||||
require(order.get(1).equals("folder"), "Column position");
|
||||
Collections.swap(order, 0, 1);
|
||||
try {
|
||||
@@ -344,7 +366,8 @@ public final class MediaLayoutGridTargetProbe {
|
||||
: "Missing definition migration"),
|
||||
"Wrong setup restore " + error);
|
||||
}
|
||||
return "Setup archiver-pruefung/2 · fremde ID und alte Version abgewiesen · folder fest an"
|
||||
return "path start 230 px, resize to 50/600 clamped to 150/300 px, reset 230 px · Setup"
|
||||
+ " archiver-pruefung/2 · fremde ID und alte Version abgewiesen · folder fest an"
|
||||
+ " Index 1 · Posteingang sichtbar, Gruppenschlüssel Post";
|
||||
}
|
||||
|
||||
|
||||
@@ -130,10 +130,67 @@ public final class MediaLayoutGridWorkflowProbe extends DeclarationWorkflowProbe
|
||||
interactive("archive-window-media", "media");
|
||||
}
|
||||
|
||||
private void columnWidths() throws Exception {
|
||||
select("DataGridColumn", "path");
|
||||
for (var pair : List.of(List.of("minimumWidth", "300"), List.of("maximumWidth", "100"))) {
|
||||
String before = source();
|
||||
combo("declaration-property", pair.getFirst());
|
||||
fx(
|
||||
() -> {
|
||||
((ComboBox<?>) pane.lookup("#declaration-value")).getEditor().setText(pair.getLast());
|
||||
return null;
|
||||
});
|
||||
click(pane, "Apply setting");
|
||||
var message = fx(() -> ((Label) pane.lookup("#declaration-message")).getText());
|
||||
if (!source().equals(before)
|
||||
|| !message.contains(pair.getFirst() + "=" + pair.getLast())
|
||||
|| !message.contains("width=230"))
|
||||
throw new AssertionError("Invalid width edit: " + message);
|
||||
if (!fx(
|
||||
() ->
|
||||
((javafx.scene.image.ImageView) pane.lookup("#full-preview-image")).getImage() != null
|
||||
&& ((Label) pane.lookup("#preview-state")).getText().contains("Beispieldateien")))
|
||||
throw new AssertionError("Lost the valid example preview");
|
||||
step("Rejected · valid FXML and example preview retained · " + message);
|
||||
}
|
||||
applySetting("minimumWidth", "150");
|
||||
applySetting("maximumWidth", "300");
|
||||
applySetting("width", "240");
|
||||
for (String field : List.of("width", "minimumWidth", "maximumWidth")) {
|
||||
String before = source();
|
||||
combo("declaration-property", field);
|
||||
fx(
|
||||
() -> {
|
||||
((ComboBox<?>) pane.lookup("#declaration-value")).getEditor().clear();
|
||||
return null;
|
||||
});
|
||||
click(pane, "Apply setting");
|
||||
await(() -> !source().equals(before));
|
||||
String reset = source();
|
||||
history(before, reset);
|
||||
click(pane, "Undo");
|
||||
await(() -> source().equals(before));
|
||||
fx(pane::flush).toCompletableFuture().get();
|
||||
}
|
||||
applySetting("width", "230");
|
||||
}
|
||||
|
||||
private void folder() throws Exception {
|
||||
open("FolderTab");
|
||||
build("archive-folder");
|
||||
choose("preview-example", "archive-folder");
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() ->
|
||||
((javafx.scene.image.ImageView) pane.lookup("#full-preview-image")).getImage()
|
||||
!= null
|
||||
&& ((Label) pane.lookup("#preview-state"))
|
||||
.getText()
|
||||
.contains("Beispieldateien")));
|
||||
inspector(true);
|
||||
var original = declarations();
|
||||
columnWidths();
|
||||
select("DataGrid", "grid");
|
||||
applySetting("setupId", "archiver-pruefung");
|
||||
applySetting("setupVersion", "2");
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
package qualification;
|
||||
|
||||
import static qualification.DocumentTabsTargetProbe.Probe.*;
|
||||
import static qualification.FolderActionsTargetProbe.Worker.*;
|
||||
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public final class ReaderStatesTargetProbe {
|
||||
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(1100);
|
||||
stage.setHeight(750);
|
||||
var content = stage.getScene().getRoot();
|
||||
content.applyCss();
|
||||
content.layout();
|
||||
return content;
|
||||
});
|
||||
var scenario = Files.readString(dir.resolve("layout-case"));
|
||||
var result =
|
||||
switch (scenario) {
|
||||
case "tag" -> fx(() -> tag(root, dir));
|
||||
case "attachment-save" -> fx(() -> attachment(root, dir));
|
||||
case "archive-error" -> archive(root, dir);
|
||||
default -> throw new AssertionError(scenario);
|
||||
};
|
||||
Files.writeString(dir.resolve("result-" + scenario), 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 logging) {
|
||||
logging.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Button button(Node root, String id) {
|
||||
return (Button) Objects.requireNonNull(root.lookup("#" + id), id);
|
||||
}
|
||||
|
||||
private static Label label(Node root, String id) {
|
||||
return (Label) Objects.requireNonNull(root.lookup("#" + id), id);
|
||||
}
|
||||
|
||||
private static String tag(Parent root, Path dir) throws Exception {
|
||||
var chip = (Region) root.lookup(".tag-chip");
|
||||
var remove = (Button) chip.lookup(".tag-chip-remove");
|
||||
var readonly = (CheckBox) root.lookup("#example-tag-readonly");
|
||||
var busy = (CheckBox) root.lookup("#example-tag-busy");
|
||||
var status = label(root, "example-tag-status");
|
||||
require(
|
||||
chip.getClass().getMethod("getText").invoke(chip).equals("Beleg offen"), "Model text");
|
||||
require(
|
||||
chip.getBackground().getFills().stream()
|
||||
.anyMatch(fill -> Color.web("#f2d58a").equals(fill.getFill())),
|
||||
"Reopened style");
|
||||
require(remove.isVisible() && !remove.isDisabled(), "Initial removal enabled");
|
||||
image(root, dir.resolve("tag-editable.png"));
|
||||
readonly.fire();
|
||||
require(!remove.isVisible() && !remove.isManaged() && !chip.isDisabled(), "Read-only");
|
||||
remove.fire();
|
||||
require(status.getText().equals("Beleg offen · zugewiesen"), "Read-only action rejected");
|
||||
image(root, dir.resolve("tag-readonly.png"));
|
||||
readonly.fire();
|
||||
busy.fire();
|
||||
require(chip.isDisabled() && remove.isVisible() && remove.isDisabled(), "Busy");
|
||||
remove.fire();
|
||||
require(status.getText().equals("Beleg offen · zugewiesen"), "Busy action rejected");
|
||||
image(root, dir.resolve("tag-busy.png"));
|
||||
busy.fire();
|
||||
remove.fire();
|
||||
require(
|
||||
status.getText().equals("Beleg offen · entfernt") && !chip.getParent().isVisible(),
|
||||
"Removed");
|
||||
return "DocumentTag · Reopened style and bound text; editable removed the assigned tag."
|
||||
+ " Read-only and busy retained it.";
|
||||
}
|
||||
|
||||
private static String attachment(Parent root, Path dir) throws Exception {
|
||||
var pick = (ComboBox<?>) root.lookup("#example-attachments");
|
||||
var open = button(root, "open-attachment");
|
||||
var save = button(root, "save-attachment");
|
||||
var result = label(root, "attachment-result");
|
||||
require(
|
||||
open.isDisabled() && save.isDisabled() && result.getUserData() == null, "No selection");
|
||||
pick.getSelectionModel().selectFirst();
|
||||
require(!open.isDisabled() && !save.isDisabled(), "Text attachment");
|
||||
save.fire();
|
||||
require(
|
||||
result.getText().equals("Gespeichert · Lieferschein.txt · LS-018 · Drei Archivkartons"),
|
||||
"Supported attachment can still be saved");
|
||||
var previous = result.getUserData();
|
||||
pick.getSelectionModel().select(1);
|
||||
require(open.isDisabled() && !save.isDisabled(), "Unknown attachment can only be saved");
|
||||
open.fire();
|
||||
require(Objects.equals(result.getUserData(), previous), "Open cannot run");
|
||||
save.fire();
|
||||
require(result.getUserData() instanceof Path, result.getText());
|
||||
var saved = (Path) result.getUserData();
|
||||
require(
|
||||
saved.getFileName().toString().equals("Messdaten.bin")
|
||||
&& Arrays.equals(Files.readAllBytes(saved), new byte[] {16, 0, 127, -1}),
|
||||
"Byte-for-byte export");
|
||||
image(root, dir.resolve("unknown-attachment.png"));
|
||||
pick.getSelectionModel().selectFirst();
|
||||
require(!open.isDisabled() && !save.isDisabled(), "Back to text attachment");
|
||||
open.fire();
|
||||
var opened = (Path) result.getUserData();
|
||||
require(
|
||||
opened.getFileName().toString().equals("Lieferschein.txt")
|
||||
&& Files.readString(opened).equals("LS-018 · Drei Archivkartons")
|
||||
&& result.getText().startsWith("Geöffnet"),
|
||||
"Correct text attachment opened: " + result.getText());
|
||||
return "AttachmentToolbar · No selection −/−, text +/+, binary −/+ (Open/Save). Saved"
|
||||
+ " Messdaten.bin with bytes 10 00 7F FF, then opened Lieferschein.txt (LS-018 ·"
|
||||
+ " Drei Archivkartons).";
|
||||
}
|
||||
|
||||
private static Object read(Node node, String method) throws Exception {
|
||||
return node.getClass().getMethod(method).invoke(node);
|
||||
}
|
||||
|
||||
private static boolean failureLabel(Node viewer, Throwable cause) {
|
||||
return viewer.lookupAll(".label").stream()
|
||||
.anyMatch(
|
||||
n ->
|
||||
n instanceof Label l
|
||||
&& l.isVisible()
|
||||
&& Objects.equals(l.getText(), cause.getMessage()));
|
||||
}
|
||||
|
||||
private static void fail(Node invoice, Node viewer, Path dir, boolean first) throws Exception {
|
||||
fx(
|
||||
() -> {
|
||||
button(invoice, "example-html-fail").fire();
|
||||
require(
|
||||
(boolean) read(viewer, "isLoading")
|
||||
&& read(viewer, "getError") == null
|
||||
&& label(invoice, "example-html-state").getText().equals("HTML wird geladen …")
|
||||
&& viewer.lookupAll(".progress-indicator").stream().anyMatch(Node::isVisible),
|
||||
"Loading state visible before completion");
|
||||
if (first) image(invoice, dir.resolve("html-load-started.png"));
|
||||
return null;
|
||||
});
|
||||
await(
|
||||
"Viewer error property and visible error",
|
||||
() -> {
|
||||
var error = read(viewer, "getError");
|
||||
return !(Boolean) read(viewer, "isLoading")
|
||||
&& error instanceof Throwable cause
|
||||
&& cause.getMessage().contains("32 MiB")
|
||||
&& failureLabel(viewer, cause)
|
||||
&& label(invoice, "example-html-state").getText().equals("Laden fehlgeschlagen");
|
||||
});
|
||||
fx(
|
||||
() -> {
|
||||
require(
|
||||
button(invoice, "external-media-load").isDisabled(),
|
||||
"Failed viewer cannot load media");
|
||||
if (first) image(invoice, dir.resolve("html-load-error.png"));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private static String archive(Parent root, Path dir) throws Exception {
|
||||
var group =
|
||||
fx(
|
||||
() ->
|
||||
root.lookupAll(".tab-pane").stream()
|
||||
.filter(
|
||||
n ->
|
||||
n instanceof TabPane t
|
||||
&& t.getTabs().stream()
|
||||
.anyMatch(tab -> tab.getText().equals("Rechnung.html")))
|
||||
.map(TabPane.class::cast)
|
||||
.findFirst()
|
||||
.orElseThrow());
|
||||
var invoice = select(group, "Rechnung.html");
|
||||
checkHtml(invoice, "Rechnung RE-042", "Büromaterial · 48,00 €");
|
||||
fx(
|
||||
() -> {
|
||||
requireChips(invoice, "Beleg offen");
|
||||
((TextField) invoice.lookup("#tag-input")).setText("Beleg geprüft");
|
||||
button(invoice, "add").fire();
|
||||
requireChips(invoice, "Beleg offen", "Beleg geprüft");
|
||||
return null;
|
||||
});
|
||||
var other = select(group, "Lieferschein.html");
|
||||
checkHtml(other, "Lieferschein LS-018", "Wareneingang · 3 Archivkartons");
|
||||
var deliveryViewer = fx(() -> other.lookup("#html-document"));
|
||||
fx(
|
||||
() -> {
|
||||
requireChips(other, "Beleg geprüft");
|
||||
require(
|
||||
!(Boolean) read(deliveryViewer, "isExternalImagesAllowed"),
|
||||
"Delivery initially offline");
|
||||
button(other, "external-media-load").fire();
|
||||
return null;
|
||||
});
|
||||
await(
|
||||
"Delivery media requested",
|
||||
() -> label(root, "status").getText().matches("Lokale Bildanfragen · [1-9][0-9]*"));
|
||||
select(group, "Rechnung.html");
|
||||
var viewer = fx(() -> invoice.lookup("#html-document"));
|
||||
fx(
|
||||
() -> {
|
||||
requireChips(invoice, "Beleg offen", "Beleg geprüft");
|
||||
return null;
|
||||
});
|
||||
fail(invoice, viewer, dir, true);
|
||||
select(group, "Lieferschein.html");
|
||||
checkHtml(other, "Lieferschein LS-018", "Wareneingang · 3 Archivkartons");
|
||||
fx(
|
||||
() -> {
|
||||
require(
|
||||
(Boolean) read(deliveryViewer, "isExternalImagesAllowed")
|
||||
&& read(deliveryViewer, "getError") == null,
|
||||
"Other tab unaffected by error");
|
||||
return null;
|
||||
});
|
||||
select(group, "Rechnung.html");
|
||||
fx(
|
||||
() -> {
|
||||
button(invoice, "example-html-recover").fire();
|
||||
require(read(viewer, "getError") == null, "Recovery clears previous error");
|
||||
return null;
|
||||
});
|
||||
checkHtml(invoice, "Rechnung RE-042", "Büromaterial · 48,00 €");
|
||||
await(
|
||||
"Valid document ready",
|
||||
() ->
|
||||
!(Boolean) read(viewer, "isLoading")
|
||||
&& read(viewer, "getError") == null
|
||||
&& label(invoice, "example-html-state").getText().equals("HTML bereit")
|
||||
&& viewer.lookupAll(".label").stream()
|
||||
.noneMatch(
|
||||
n ->
|
||||
n instanceof Label l
|
||||
&& l.isVisible()
|
||||
&& Objects.toString(l.getText(), "").contains("32 MiB")));
|
||||
fx(
|
||||
() -> {
|
||||
image(invoice, dir.resolve("html-load-recovered.png"));
|
||||
return null;
|
||||
});
|
||||
fail(invoice, viewer, dir, false);
|
||||
select(group, "Lieferschein.html");
|
||||
fx(
|
||||
() -> {
|
||||
require(
|
||||
(Boolean) read(deliveryViewer, "isExternalImagesAllowed")
|
||||
&& read(deliveryViewer, "getError") == null,
|
||||
"Other tab kept permission across second failure");
|
||||
return null;
|
||||
});
|
||||
return "Rechnung → Lieferschein → Rechnung retained two/one/two chips. HTML viewer reported"
|
||||
+ " loading → 32 MiB error → valid receipt → repeated error. Delivery kept its own"
|
||||
+ " media permission.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package qualification;
|
||||
|
||||
import static qualification.WorkflowProbe.*;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import java.nio.file.Files;
|
||||
import javafx.embed.swing.SwingFXUtils;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public final class ReaderStatesWorkflowProbe extends DeclarationWorkflowProbe {
|
||||
@Override
|
||||
void verify(Project project) throws Exception {
|
||||
this.project = project;
|
||||
open("DocumentTag");
|
||||
controls(true);
|
||||
choose("form-control", "TagChip #chip");
|
||||
String style = "-fx-background-color: #f2d58a;";
|
||||
set("style", style, style);
|
||||
reopen("DocumentTag", style);
|
||||
controls(true);
|
||||
choose("form-control", "TagChip #chip");
|
||||
choose("form-property", "style");
|
||||
fx(
|
||||
() -> {
|
||||
ImageIO.write(
|
||||
SwingFXUtils.fromFXImage(pane.snapshot(null, null), null),
|
||||
"png",
|
||||
output.resolve("intellij.png").toFile());
|
||||
return null;
|
||||
});
|
||||
controls(false);
|
||||
build("document-tag");
|
||||
interactive("document-tag", "tag");
|
||||
open("AttachmentToolbar");
|
||||
build("reader-attachment");
|
||||
interactive("reader-attachment", "attachment-save");
|
||||
open("ArchiveWindow");
|
||||
build("archive-window-html-error");
|
||||
interactive("archive-window-html-error", "archive-error");
|
||||
Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt")));
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package qualification;
|
||||
|
||||
import static qualification.FolderActionsTargetProbe.Worker.*;
|
||||
|
||||
import java.nio.file.*;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.stage.Window;
|
||||
import javafx.stage.WindowEvent;
|
||||
|
||||
public final class ViewerImportTargetProbe {
|
||||
public static void premain(String dir) {
|
||||
if (System.getProperty("sun.java.command", "")
|
||||
.startsWith("de.neitzel.fxdesigner.target.WorkerMain "))
|
||||
Thread.ofPlatform().daemon().start(() -> Check.verify(Path.of(dir)));
|
||||
}
|
||||
|
||||
private static final class Check {
|
||||
static void verify(Path dir) {
|
||||
try {
|
||||
var stage = previewStage();
|
||||
var root =
|
||||
fx(
|
||||
() -> {
|
||||
stage.setWidth(1050);
|
||||
stage.setHeight(650);
|
||||
var content = stage.getScene().getRoot();
|
||||
content.applyCss();
|
||||
content.layout();
|
||||
return content;
|
||||
});
|
||||
String scenario = Files.readString(dir.resolve("layout-case"));
|
||||
String result =
|
||||
switch (scenario) {
|
||||
case "article", "alternate", "removed", "renamed" -> media(root, dir, scenario);
|
||||
case "retry" -> retry(root, dir);
|
||||
case "collision" -> collision(root, dir);
|
||||
default -> throw new AssertionError(scenario);
|
||||
};
|
||||
Files.writeString(dir.resolve("result-" + scenario), 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 logging) {
|
||||
logging.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Object read(Node viewer, String getter) throws Exception {
|
||||
return viewer.getClass().getMethod(getter).invoke(viewer);
|
||||
}
|
||||
|
||||
private static String media(Parent root, Path dir, String scenario) throws Exception {
|
||||
var requests = fx(() -> (Label) root.lookup("#example-media-requests"));
|
||||
var existing = fx(() -> (Button) root.lookup("#external-media-load"));
|
||||
var article = fx(() -> root.lookup("#html-document"));
|
||||
var delivery =
|
||||
fx(() -> root.lookup(scenario.equals("renamed") ? "#deliveryViewer" : "#htmlViewer"));
|
||||
var added = fx(() -> (Button) root.lookup("#htmlMediaButton"));
|
||||
await(
|
||||
"Initial offline media",
|
||||
() ->
|
||||
requests.getText().endsWith("Rechnung 0 · Lieferschein 0")
|
||||
&& (Boolean) read(article, "isExternalImagesAvailable")
|
||||
&& (delivery == null || (Boolean) read(delivery, "isExternalImagesAvailable")));
|
||||
if (scenario.equals("removed")) {
|
||||
fx(
|
||||
() -> {
|
||||
require(
|
||||
read(existing, "getViewer") == null
|
||||
&& existing.isDisabled()
|
||||
&& existing.getTooltip().getText().isEmpty(),
|
||||
"Removed target must disable the button");
|
||||
require(
|
||||
read(added, "getViewer") == article && !added.isDisabled(),
|
||||
"Inserted button still works");
|
||||
return null;
|
||||
});
|
||||
return "Removed viewer reference disables only the original button; the inserted button"
|
||||
+ " still targets article.";
|
||||
}
|
||||
boolean invoice = scenario.equals("article");
|
||||
fx(
|
||||
() -> {
|
||||
require(
|
||||
read(existing, "getViewer") == (invoice ? article : delivery), "Correct instance");
|
||||
require(!existing.isDisabled(), "Viewer has external media");
|
||||
require(
|
||||
existing
|
||||
.getTooltip()
|
||||
.getText()
|
||||
.equals(
|
||||
invoice
|
||||
? "Externe Medien laden · Kontaktiert die Bildserver für diesen Tab."
|
||||
: "Lieferscheinbilder laden · Bildserver Lieferschein"),
|
||||
existing.getTooltip().getText());
|
||||
existing.fire();
|
||||
return null;
|
||||
});
|
||||
await(
|
||||
"Only the selected viewer requested its local image",
|
||||
() ->
|
||||
requests
|
||||
.getText()
|
||||
.matches(
|
||||
invoice
|
||||
? ".*Rechnung [1-9][0-9]* · Lieferschein 0"
|
||||
: ".*Rechnung 0 · Lieferschein [1-9][0-9]*"));
|
||||
if (!invoice) {
|
||||
fx(
|
||||
() -> {
|
||||
require(
|
||||
!(Boolean) read(article, "isExternalImagesAllowed")
|
||||
&& (Boolean) read(delivery, "isExternalImagesAllowed"),
|
||||
"Permissions must remain local to the referenced viewer");
|
||||
require(
|
||||
read(added, "getViewer") == article && !added.isDisabled(),
|
||||
"Inserted button targets article");
|
||||
require(
|
||||
existing.getTooltip().getText().startsWith("Lieferscheinbilder erneut laden"),
|
||||
"Reload tooltip");
|
||||
if (scenario.equals("renamed")) image(root, dir.resolve("viewer-target.png"));
|
||||
delivery
|
||||
.getClass()
|
||||
.getMethod("setHtml", String.class)
|
||||
.invoke(delivery, "<h2>Lieferschein ohne Medien</h2>");
|
||||
return null;
|
||||
});
|
||||
await(
|
||||
"Availability follows the assigned viewer",
|
||||
() ->
|
||||
existing.isDisabled()
|
||||
&& !added.isDisabled()
|
||||
&& existing.getTooltip().getText().equals("Lieferschein ohne Bilder"));
|
||||
}
|
||||
return scenario
|
||||
+ " · "
|
||||
+ fx(requests::getText)
|
||||
+ (invoice
|
||||
? ""
|
||||
: " · Selected viewer tooltip, permission and availability changed independently.");
|
||||
}
|
||||
|
||||
private static DialogPane importDialog() {
|
||||
return Window.getWindows().stream()
|
||||
.filter(Window::isShowing)
|
||||
.filter(
|
||||
w ->
|
||||
w.getScene() != null
|
||||
&& w.getScene().getRoot() instanceof DialogPane
|
||||
&& w.getScene().lookup("#example-import-run") != null)
|
||||
.map(w -> (DialogPane) w.getScene().getRoot())
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
}
|
||||
|
||||
private static String retry(Parent root, Path dir) throws Exception {
|
||||
var pane =
|
||||
fx(
|
||||
() -> {
|
||||
((Button) root.lookup("#example-import-open")).fire();
|
||||
return importDialog();
|
||||
});
|
||||
var submit = (Button) fx(() -> pane.lookupButton(pane.getButtonTypes().getFirst()));
|
||||
var cancel = (Button) fx(() -> pane.lookupButton(ButtonType.CANCEL));
|
||||
var name = fx(() -> (TextField) pane.lookup("#name"));
|
||||
var tags = fx(() -> (TextField) pane.lookup("#tags"));
|
||||
var status = fx(() -> (Label) pane.lookup("#status"));
|
||||
var inventory = fx(() -> (Label) root.lookup("#example-import-inventory"));
|
||||
var window = fx(() -> pane.getScene().getWindow());
|
||||
fx(
|
||||
() -> {
|
||||
name.setText("Wiederholung.md");
|
||||
tags.setText("Abnahme, Test");
|
||||
require(!submit.isDisabled(), "Valid draft");
|
||||
submit.fire();
|
||||
submit.fireEvent(new ActionEvent());
|
||||
cancel.fire();
|
||||
window.fireEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSE_REQUEST));
|
||||
require(
|
||||
window.isShowing()
|
||||
&& submit.isDisabled()
|
||||
&& cancel.isDisabled()
|
||||
&& name.isDisabled(),
|
||||
"Pending task must block Submit, Cancel and Close (showing="
|
||||
+ window.isShowing()
|
||||
+ ", submit disabled="
|
||||
+ submit.isDisabled()
|
||||
+ ", cancel disabled="
|
||||
+ cancel.isDisabled()
|
||||
+ ", draft disabled="
|
||||
+ name.isDisabled()
|
||||
+ ")");
|
||||
require(status.getText().equals("Datei wird abgelegt …"), status.getText());
|
||||
image(pane, dir.resolve("import-pending.png"));
|
||||
((Button) pane.lookup("#example-import-fail")).fire();
|
||||
return null;
|
||||
});
|
||||
await(
|
||||
"Import failure is shown and actions reenabled",
|
||||
() -> !submit.isDisabled() && !cancel.isDisabled());
|
||||
fx(
|
||||
() -> {
|
||||
require(window.isShowing() && !name.isDisabled(), "Dialog and editable draft survive");
|
||||
require(
|
||||
status.getText().contains("Quelldatei „Rechnung.md“ fehlt."),
|
||||
"Expected missing-source error, got " + status.getText());
|
||||
require(
|
||||
name.getText().equals("Wiederholung.md")
|
||||
&& tags.getText().equals("Abnahme, Test")
|
||||
&& ((Label) pane.lookup("#target")).getText().equals("Belege"),
|
||||
"Draft preserved");
|
||||
require(
|
||||
inventory.getText().equals("1 Beleg · Belege/Rechnung.md"), inventory.getText());
|
||||
image(pane, dir.resolve("import-failed.png"));
|
||||
submit.fire();
|
||||
((Button) pane.lookup("#example-import-run")).fire();
|
||||
return null;
|
||||
});
|
||||
await(
|
||||
"Successful retry adds one receipt",
|
||||
() ->
|
||||
!window.isShowing()
|
||||
&& inventory
|
||||
.getText()
|
||||
.equals(
|
||||
"2 Belege · Belege/Rechnung.md · Belege/Wiederholung.md [Abnahme,"
|
||||
+ " Test]"));
|
||||
fx(
|
||||
() -> {
|
||||
image(root, dir.resolve("import-retried.png"));
|
||||
return null;
|
||||
});
|
||||
return "Pending import blocked submit/cancel/close. Real missing-source error retained the"
|
||||
+ " draft and reenabled actions. Retry closed the dialog and added exactly"
|
||||
+ " Belege/Wiederholung.md [Abnahme, Test].";
|
||||
}
|
||||
|
||||
private static String collision(Parent root, Path dir) throws Exception {
|
||||
return fx(
|
||||
() -> {
|
||||
var name = (TextField) root.lookup("#name");
|
||||
var free = (Button) root.lookup("#useFreeName");
|
||||
var status = (Label) root.lookup("#status");
|
||||
require(
|
||||
name.getText().equals("Rechnung.md")
|
||||
&& free.isVisible()
|
||||
&& status.getText().contains("Dateiname belegt"),
|
||||
"Fresh archive has only the original collision");
|
||||
image(root, dir.resolve("import-new-session.png"));
|
||||
free.fire();
|
||||
require(
|
||||
name.getText().equals("Rechnung (2).md") && !free.isVisible(),
|
||||
"Accepted a free name");
|
||||
return "New session · Original Rechnung.md collision restored; accepted Rechnung"
|
||||
+ " (2).md.";
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package qualification;
|
||||
|
||||
import static qualification.WorkflowProbe.*;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import java.nio.file.Files;
|
||||
import javafx.embed.swing.SwingFXUtils;
|
||||
import javafx.scene.control.*;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public final class ViewerImportWorkflowProbe extends DeclarationWorkflowProbe {
|
||||
private static final String HTML_BINDING = "control=\"article\" property=\"html\" path=\"html\"";
|
||||
|
||||
@Override
|
||||
void verify(Project project) throws Exception {
|
||||
this.project = project;
|
||||
open("HtmlDocument");
|
||||
build("html-viewer-reference");
|
||||
interactive("html-viewer-reference", "article");
|
||||
controls(true);
|
||||
insert("HtmlViewer", "htmlViewer", 0);
|
||||
choose("form-control", "HtmlViewer #htmlViewer");
|
||||
set("prefWidth", "325", "prefWidth=\"325\"");
|
||||
set("prefHeight", "165", "prefHeight=\"165\"");
|
||||
set("mediaButtonVisible", "false", "<HtmlViewer fx:id=\"htmlViewer\"");
|
||||
set("mediaLoadText", "Lieferscheinbilder laden", "Lieferscheinbilder laden");
|
||||
set("mediaReloadText", "Lieferscheinbilder erneut laden", "Lieferscheinbilder erneut laden");
|
||||
set("mediaTooltipText", "Bildserver Lieferschein", "Bildserver Lieferschein");
|
||||
set("noExternalMediaText", "Lieferschein ohne Bilder", "Lieferschein ohne Bilder");
|
||||
insert("HtmlMediaButton", "htmlMediaButton", 2);
|
||||
target("media", "$article");
|
||||
assertRejected("$mediaToolbar");
|
||||
assertRejected("$fehlend");
|
||||
changeReference("$htmlViewer");
|
||||
target("htmlMediaButton", "");
|
||||
changeReference("$article");
|
||||
controls(false);
|
||||
interactive("html-viewer-reference", "alternate");
|
||||
controls(true);
|
||||
target("media", "$htmlViewer");
|
||||
String before = source();
|
||||
click(pane, "Reset property");
|
||||
await(() -> !source().contains("viewer=\"$htmlViewer\""));
|
||||
fx(pane::flush).toCompletableFuture().get();
|
||||
controls(false);
|
||||
interactive("html-viewer-reference", "removed");
|
||||
click(pane, "Undo");
|
||||
await(() -> source().equals(before));
|
||||
fx(pane::flush).toCompletableFuture().get();
|
||||
renameViewer();
|
||||
reopen("HtmlDocument", "viewer=\"$deliveryViewer\"");
|
||||
controls(true);
|
||||
target("media", "$deliveryViewer");
|
||||
fx(
|
||||
() -> {
|
||||
ImageIO.write(
|
||||
SwingFXUtils.fromFXImage(pane.snapshot(null, null), null),
|
||||
"png",
|
||||
output.resolve("intellij.png").toFile());
|
||||
return null;
|
||||
});
|
||||
if (!source().contains(HTML_BINDING)) throw new AssertionError("Model binding changed");
|
||||
controls(false);
|
||||
build("html-viewer-reference");
|
||||
interactive("html-viewer-reference", "renamed");
|
||||
open("ImportForm");
|
||||
build("import-retry");
|
||||
interactive("import-retry", "retry");
|
||||
interactive("import-collision", "collision");
|
||||
Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt")));
|
||||
}
|
||||
|
||||
private void insert(String type, String id, int position) throws Exception {
|
||||
choose("form-palette", type);
|
||||
choose("form-destination", "HBox #mediaToolbar / children");
|
||||
fx(
|
||||
() -> {
|
||||
((Spinner<Integer>) pane.lookup("#form-position")).getValueFactory().setValue(position);
|
||||
return null;
|
||||
});
|
||||
String before = source();
|
||||
click(pane, "Insert control");
|
||||
edited(before, "fx:id=\"" + id + "\"");
|
||||
}
|
||||
|
||||
private void target(String button, String current) throws Exception {
|
||||
choose("form-control", "HtmlMediaButton #" + button);
|
||||
choose("form-property", "viewer");
|
||||
fx(
|
||||
() -> {
|
||||
var targets = (ComboBox<?>) pane.lookup("#form-viewer-reference");
|
||||
if (targets.getItems().size() != 2
|
||||
|| !targets.getItems().contains("$article")
|
||||
|| !java.util.Objects.toString(targets.getValue(), "").equals(current))
|
||||
throw new AssertionError(targets.getItems() + " / " + targets.getValue());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private void assertRejected(String invalid) throws Exception {
|
||||
String before = source();
|
||||
fx(
|
||||
() -> {
|
||||
((ComboBox<String>) pane.lookup("#form-viewer-reference")).setValue(invalid);
|
||||
return null;
|
||||
});
|
||||
click(pane, "Set property");
|
||||
String diagnostic = fx(() -> ((Label) pane.lookup("#form-message")).getText());
|
||||
if (!before.equals(source())
|
||||
|| !diagnostic.contains("unique HtmlViewer")
|
||||
|| !diagnostic.contains(invalid)) throw new AssertionError(invalid + " " + diagnostic);
|
||||
step("Rejected " + invalid + " · " + diagnostic);
|
||||
}
|
||||
|
||||
private void changeReference(String target) throws Exception {
|
||||
choose("form-viewer-reference", target);
|
||||
String before = source();
|
||||
click(pane, "Set property");
|
||||
edited(before, "viewer=\"" + target + "\"");
|
||||
step("Viewer inspector · " + target);
|
||||
}
|
||||
|
||||
private void renameViewer() throws Exception {
|
||||
controls(false);
|
||||
fx(
|
||||
() -> {
|
||||
var bindings =
|
||||
(TitledPane)
|
||||
pane.lookupAll(".titled-pane").stream()
|
||||
.filter(n -> n instanceof TitledPane t && t.getText().equals("Bindings"))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
bindings.setAnimated(false);
|
||||
bindings.setExpanded(true);
|
||||
var tabs = (TabPane) bindings.getContent();
|
||||
tabs.getSelectionModel()
|
||||
.select(
|
||||
tabs.getTabs().stream()
|
||||
.filter(t -> t.getText().equals("Structure"))
|
||||
.findFirst()
|
||||
.orElseThrow());
|
||||
var nodes = (ListView<?>) pane.lookup("#structure-nodes");
|
||||
for (int i = 0; i < nodes.getItems().size(); i++) {
|
||||
if (nodes.getItems().get(i).toString().equals("htmlViewer : HtmlViewer"))
|
||||
nodes.getSelectionModel().select(i);
|
||||
}
|
||||
((TextField) pane.lookup("#structure-name")).setText("deliveryViewer");
|
||||
return null;
|
||||
});
|
||||
String before = source();
|
||||
click(pane, "Rename identifier");
|
||||
await(
|
||||
() ->
|
||||
source().contains("viewer=\"$deliveryViewer\"")
|
||||
&& source().contains("fx:id=\"deliveryViewer\""));
|
||||
String renamed = source();
|
||||
click(pane, "Undo");
|
||||
await(() -> source().equals(before));
|
||||
click(pane, "Redo");
|
||||
await(() -> source().equals(renamed));
|
||||
fx(pane::flush).toCompletableFuture().get();
|
||||
step("Renamed htmlViewer → deliveryViewer, including its reference; exact Undo and Redo");
|
||||
}
|
||||
}
|
||||
@@ -29,12 +29,16 @@ 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("--reader-states", action="store_true", help="Verify the Archiver tag template, attachment export and HTML recovery")
|
||||
forms.add_argument("--viewer-import", action="store_true", help="Verify HtmlViewer references and retry in the Archiver import dialog")
|
||||
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.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.reader_states or args.viewer_import 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")
|
||||
@@ -46,7 +50,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", *(["--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", *(["--reader-states"] if args.reader_states else []), *(["--viewer-import"] if args.viewer_import else []), *(["--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:
|
||||
@@ -90,7 +94,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 ("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 ("tag-editable.png", "tag-readonly.png", "tag-busy.png", "unknown-attachment.png", "html-load-error.png", "html-load-recovered.png", "html-load-started.png", "viewer-target.png", "import-pending.png", "import-failed.png", "import-retried.png", "import-new-session.png", "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)
|
||||
|
||||
@@ -25,12 +25,16 @@ 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("--reader-states", action="store_true", help="Verify the Archiver tag template, attachment export and HTML recovery")
|
||||
forms.add_argument("--viewer-import", action="store_true", help="Verify HtmlViewer references and retry in the Archiver import dialog")
|
||||
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.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.reader_states or args.viewer_import 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"
|
||||
@@ -41,10 +45,14 @@ 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:
|
||||
if args.media_layout_grid or args.reader_states or args.viewer_import:
|
||||
view = "HtmlDocument"
|
||||
if args.management_readers:
|
||||
view = "MailControls"
|
||||
if args.reader_states:
|
||||
view = "DocumentTag"
|
||||
if args.folder_profiles or args.row_menus:
|
||||
view = "FolderTab"
|
||||
if args.folder_actions:
|
||||
view = "DocumentDetails" if args.check else "FolderTab"
|
||||
if args.document_tabs and args.check:
|
||||
@@ -116,6 +124,14 @@ else:
|
||||
suite = "MediaLayoutGrid"
|
||||
elif args.management_readers:
|
||||
suite = "ManagementReaders"
|
||||
elif args.reader_states:
|
||||
suite = "ReaderStates"
|
||||
elif args.viewer_import:
|
||||
suite = "ViewerImport"
|
||||
elif args.row_menus:
|
||||
suite = "RowMenus"
|
||||
elif args.folder_profiles:
|
||||
suite = "FolderProfiles"
|
||||
elif args.folder_actions:
|
||||
suite = "FolderActions"
|
||||
elif args.import_form:
|
||||
@@ -126,9 +142,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.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.reader_states or args.viewer_import 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:
|
||||
if args.media_layout_grid or args.dock_rules or args.reader_states or args.viewer_import or args.row_menus or args.folder_profiles:
|
||||
files.append(sources / "DeclarationWorkflowProbe.java")
|
||||
if args.archiver:
|
||||
files.append(sources / f"{probe}.java")
|
||||
@@ -136,7 +152,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"], check=True)
|
||||
sources / f"{target_probe}.java", *([sources / "DocumentTabsTargetProbe.java"] if args.reader_states else []), *([sources / "FolderActionsTargetProbe.java"] if args.folder_profiles or args.reader_states or args.viewer_import 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")
|
||||
|
||||
Reference in New Issue
Block a user