Recent posts

#11
Archi Development / Re: Custom Reports: Where do t...
Last post by yellek - January 14, 2025, 04:29:33 AM
Quote from: yellek on January 13, 2025, 22:33:01 PMFrom my testing and what I can see the only sub reports that are compiled and available from Archi are ones named the same as those for the Customisable Report and passed into the main report by Archi. If I'm NOT using the Customisable Report my workaround is to define sub reports with the same names as the Customisable Report (properties.jrxml for example) and use those (this seems to work).

If I put my own sub reports with my custom report, Archi throws an error saying it can't find them.

OK I figured it out and I'm leaving this here to guide others in the future:

The way that Archi compiles and processes Jasper sub reports is to pass compiled sub reports as a parameter to the main report. You can expect (and should declare) a parameter with a key that is the same as the name attribute of your sub report like the following:

<parameter name="properties_report" class="net.sf.jasperreports.engine.JasperReport"/>

You then call the sub report with an expression of the form:

<subreportExpression><![CDATA[$P{properties_report}]]></subreportExpression>

Which uses the compiled report passed in as a parameter.
#12
General Archi Discussion / Re: Cannot invoke due to "diag...
Last post by Xiaoqi - January 14, 2025, 01:45:03 AM
Thanks Phil for your quick checking and fixing.

In my original post, I've typo on the build date, it should be "Archi 5.5.0 (Build: 202412060902)".

While, I think the "zombie" diagram may be the ones of the diagram that still in tabs but the model has been closed (while not deleted I think).

I've now upgraded to your latest build: 202501131147, and will continue using and testing.

Thanks again,
Xiaoqi
#13
Archi Development / Re: Custom Reports: Where do t...
Last post by yellek - January 13, 2025, 22:33:01 PM
Is the answer to the rest of the question "dig around in the code and figure it out"? If so that shouldn't be a problem.

From my testing and what I can see the only sub reports that are compiled and available from Archi are ones named the same as those for the Customisable Report and passed into the main report by Archi. If I'm NOT using the Customisable Report my workaround is to define sub reports with the same names as the Customisable Report (properties.jrxml for example) and use those (this seems to work).

If I put my own sub reports with my custom report, Archi throws an error saying it can't find them.
#14
jArchi / Re: jArchi script debugger too...
Last post by raimondb - January 13, 2025, 19:28:39 PM
It would be awesome if we could attach a debugger from e.g vscode or another IDE.

Indeed currently using a lot of console.log but this can become tedious with larger and more complex scripts.

Also any approach to do some form of automated testing and linting for jarchi would be welcome as well.  ;D
#15
General Archi Discussion / Re: Cannot invoke due to "diag...
Last post by Phil Beauvoir - January 13, 2025, 12:21:14 PM
Hi, Xiaoqi

thanks for the report and the error log. With that I was able to find the problem. This is fixed in today's Early Access 5.5 build.

The cause depends on two things:

1. "Link to View" is on in the models tree
2. There is a "zombie" diagram editor part open

A "zombie" diagram editor part appears when you open Archi and the diagram editor part references a model file that has been deleted or renamed. Then you get the "This View is no longer available" message on the editor part. If "Link to View" is on then Archi will try to select elements in the zombie part that has no diagram model, and so this leads to a NullPointerException.

If you get those "zombie" editor parts, close them and the problem will not occur.

Anyway this is fixed in the latest 5.5 EA build.
#16
General Archi Discussion / Re: Cannot invoke due to "diag...
Last post by Xiaoqi - January 13, 2025, 06:34:12 AM
Additionally, here is the detail error log, for your troubleshooting reference:

!SESSION 2025-01-13 10:05:17.827 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.13
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -cleanConfig -eclipse.keyring @user.home/AppData/Roaming/Archi/secure_storage
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -cleanConfig -eclipse.keyring @user.home/AppData/Roaming/Archi/secure_storage

!ENTRY org.eclipse.jface 4 2 2025-01-13 10:21:43.061
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NullPointerException: Cannot invoke "com.archimatetool.model.IDiagramModel.eAllContents()" because "diagramModel" is null
at com.archimatetool.editor.model.DiagramModelUtils.findDiagramModelObjectsForElementByIterator(DiagramModelUtils.java:133)
at com.archimatetool.editor.model.DiagramModelUtils.findDiagramModelObjectsForElement(DiagramModelUtils.java:111)
at com.archimatetool.editor.model.DiagramModelUtils.findDiagramModelComponentsForArchimateConcept(DiagramModelUtils.java:91)
at com.archimatetool.editor.diagram.ArchimateDiagramEditor.selectObjects(ArchimateDiagramEditor.java:145)
at com.archimatetool.editor.views.tree.TreeSelectionSynchroniser.selectionChanged(TreeSelectionSynchroniser.java:188)
at org.eclipse.jface.viewers.Viewer$1.run(Viewer.java:151)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:148)
at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2132)
at org.eclipse.jface.viewers.ColumnViewer.updateSelection(ColumnViewer.java:1055)
at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1170)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1199)
at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:262)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:420)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4285)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1160)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4083)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3673)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
at com.archimatetool.editor.Application.start(Application.java:85)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
#17
General Archi Discussion / Cannot invoke due to "diagramM...
Last post by Xiaoqi - January 13, 2025, 02:29:28 AM
Hello,

I've used Archi 5.5.0 (Build: 202312060902), today when I click one element, a Problem Occurred dialog pop-up with following error message:

An error has occurred. See error log for more details.
Cannot invoke "com.archimatetool.model.IDiagramModel.eAllContents()" because "diagramModel" is null

After close this error dialog, the Archi is still working fine, would like that you can kindly check if there's anything wrong in backend.

Regards, Xiaoqi
#18
jArchi / Re: Issues with export fidelit...
Last post by Phil Beauvoir - January 10, 2025, 11:35:48 AM
Quote from: raimondb on January 10, 2025, 11:12:53 AMFurther, what is the kind of workaround that the textOffsetWorkaround is doing exactly?

It reduces the font height by 1 point, so a slightly smaller font should fit better.

Quote from: raimondb on January 10, 2025, 11:12:53 AMAlso I was wondering about the textAsShapes and Embedfonts. I am now using textAsShapes = true and EmbedFonts = false. But since I now installed the font, would it also work on all/most target platforms to have textAsShapes=false and EmbedFonts=true? Since my diagrams are now 2.6MB instead of around 330kb

I don't know. You'll have to experiment.

A general point on export to SVG/PDF. The code to do this is taken from an Eclipse project (see here). It has never been perfect and we've tried to workaround several issues with it. We have to live with its foibles (unless someone wants to take a look at it and contribute patches).
#19
jArchi / Re: Issues with export fidelit...
Last post by raimondb - January 10, 2025, 11:12:53 AM
Hi Phil,

Indeed in the mean time I found out the font was causing the issue since I did not have Segoe UI available in Linux, so I installed it, and that mostly fixed the issue  8) .

However I did notice the margin was a bit smaller, so instead of font size 18, I went with size 16 to make it fit the element box clean on both Windows and Linux.

Regarding the method you linked, it is unclear to me how the setViewBox is supposed to work, it seems to take some default, but does not work for big diagrams. I ended up to add some jArchi scripting to calculate the viewbox based on mix/max x/y of all the boxes on the diagram and specify the viewBoxBounds myself.

Further, what is the kind of workaround that the textOffsetWorkaround is doing exactly?

Also I was wondering about the textAsShapes and Embedfonts. I am now using textAsShapes = true and EmbedFonts = false. But since I now installed the font, would it also work on all/most target platforms to have textAsShapes=false and EmbedFonts=true? Since my diagrams are now 2.6MB instead of around 330kb :-)
#20
Archi Development / Re: Custom Reports: Where do t...
Last post by Phil Beauvoir - January 09, 2025, 14:08:17 PM
Any properties passed by Archi can be found in the source code here:

https://github.com/archimatetool/archi/blob/master/com.archimatetool.jasperreports/src/com/archimatetool/jasperreports/JasperReportsExporter.java

There are some properties that can be set by the customizable report. These are documented in the "Customisable Report" section of the Archi User Guide.

Others will be Jasper internal properties or those declared in the *.jrxml files.