Resolve generic JavaFX binding targets and verify them in IntelliJ
This commit is contained in:
@@ -22,10 +22,11 @@ p.add_argument("--archiver", type=Path, help="Use a disposable copy of the Archi
|
||||
forms = p.add_mutually_exclusive_group()
|
||||
forms.add_argument("--connection-form", action="store_true", help="Open and qualify the Archiver connection form")
|
||||
forms.add_argument("--grid-docking", type=Path, metavar="REFERENCE_FXML", help="Qualify the Archiver grid, dock layout and the supplied reference workspace")
|
||||
forms.add_argument("--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) and not args.archiver:
|
||||
if (args.connection_form or args.grid_docking or args.saved_document or args.document_tabs or args.import_form) and not args.archiver:
|
||||
p.error("Selecting an Archiver view requires --archiver")
|
||||
base = Path(tempfile.mkdtemp(prefix="neitzel-designer-host-")).resolve()
|
||||
project = base / "project"
|
||||
@@ -40,6 +41,22 @@ if args.archiver:
|
||||
view = "FolderTab"
|
||||
shutil.copyfile(args.grid_docking, project / "src/main/resources/ReferenceWorkspace.fxml")
|
||||
file = project / f"src/main/resources/de/neitzel/archiver/ui/{view}.fxml"
|
||||
if args.import_form:
|
||||
file = file.with_name("ConnectionForm.fxml")
|
||||
if args.check:
|
||||
# Author two shipped bindings again in the disposable copy. One deliberately
|
||||
# untyped selector exercises the diagnostic without changing the product form.
|
||||
for form, declaration in [
|
||||
(file.with_name("ImportForm.fxml"), '<DirectBinding control="folders" property="value" path="folder" direction="both"/>'),
|
||||
(file.with_name("FolderTab.fxml"), '<DirectBinding control="grid" property="items" path="rows" direction="view"/>'),
|
||||
]:
|
||||
source = form.read_text()
|
||||
if source.count(declaration) != 1:
|
||||
raise ValueError(f"Expected the shipped binding in {form.name}")
|
||||
source = "".join(line for line in source.splitlines(keepends=True) if line.strip() != declaration)
|
||||
if form.name == "FolderTab.fxml":
|
||||
source = source.replace("</VBox>", '<ComboBox fx:id="untypedPick" visible="false" managed="false"/></VBox>')
|
||||
form.write_text(source)
|
||||
if args.saved_document:
|
||||
file = project / "src/designer/resources/de/neitzel/archiver/preview/SavedDocument.fxml"
|
||||
if args.check:
|
||||
@@ -81,13 +98,15 @@ else:
|
||||
suite = "Connection"
|
||||
elif args.grid_docking:
|
||||
suite = "GridDock"
|
||||
elif args.import_form:
|
||||
suite = "Import"
|
||||
elif args.document_tabs:
|
||||
suite = "DocumentTabs"
|
||||
elif args.saved_document:
|
||||
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:
|
||||
if args.connection_form or args.saved_document or args.document_tabs or args.import_form:
|
||||
files.append(sources / "FormWorkflowProbe.java")
|
||||
if args.archiver:
|
||||
files.append(sources / f"{probe}.java")
|
||||
|
||||
Reference in New Issue
Block a user