Archi Forum

Archi Plug-ins => jArchi => Topic started by: Thomas Rohde on October 22, 2022, 06:37:09 AM

Title: Snippet: Layout view using ELK/ElkJS
Post by: Thomas Rohde on October 22, 2022, 06:37:09 AM
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 (https://gist.github.com/ThomasRohde/c3b895a263b334b9e908d798802e1432)
Title: Re: Snippet: Layout view using ELK/ElkJS
Post by: Phil Beauvoir on October 22, 2022, 15:46:13 PM
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
Title: Re: Snippet: Layout view using ELK/ElkJS
Post by: Phil Beauvoir on October 22, 2022, 17:13:31 PM
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);