Snippet: Layout view using ELK/ElkJS

Started by Thomas Rohde, October 22, 2022, 06:37:09 AM

Previous topic - Next topic

Thomas Rohde

As a follow up to my previous post on how to interact with the browser, here is a real application.

I've been trying to use ELK (the Eclipse Layout Kernel, see: https://www.eclipse.org/elk/) for some time, using both the Java libraries and the Javascript versions. However, none of it worked. I had it working outside Archi, using plain HTML files, so I reused that to create an ELK layouter that uses the Eclipse browser object to execute the ELK runtime. I works perfectly well.

To get it running, fetch 'elk.bundled.js' from a repo, e.g., https://unpkg.com/elkjs/lib/elk.bundled.js, and place it in your script library under '__DIR__/lib'.

Then fetch my script here: Gist snippet

Phil Beauvoir

Hi Thomas, thanks once again for sharing!

Actually, layout algorithms are of interest if they can be implemented in jArchi and operate on the Archi Views,

Regards,

Phil
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Phil Beauvoir

#2
I had to change line 173 to specify Edge Browser to get it to work on my System:

let browser = new Browser(newShell, SWT.EDGE);
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.