Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Add LayoutAlgorithm in MinMap example
Add LayoutAlgorithm in MinMap example [message #1793713] Tue, 14 August 2018 13:28 Go to next message
João Pedro is currently offline João PedroFriend
Messages: 52
Registered: December 2014
Member
I've been trying for a while but couldn't do it.

Where, if possible, can I add a LayoutAlgorithm to the MinMap example? (https://www.itemis.com/en/gef/tutorials/part-2-gef-mvc/)

For example the SpringLayoutAlgorithm().
Re: Add LayoutAlgorithm in MinMap example [message #1793772 is a reply to message #1793713] Wed, 15 August 2018 13:26 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Joao,

the mind map tutorial should contain a chapter about layout integration IIRC.

I will have a closer look later today. Maybe I can give a minimal example.

Best regards,
Matthias

[Updated on: Wed, 15 August 2018 13:27]

Report message to a moderator

Re: Add LayoutAlgorithm in MinMap example [message #1794027 is a reply to message #1793772] Wed, 22 August 2018 15:46 Go to previous messageGo to next message
João Pedro is currently offline João PedroFriend
Messages: 52
Registered: December 2014
Member
I was trying to implement this using the "GraphPart()" and adding it to the module Bindings like this:

		adapterMapBinder.addBinding(AdapterKey.defaultRole())
		.to(LayoutContext.class);
		
		
		adapterMapBinder.addBinding(AdapterKey.defaultRole())
		.to(GraphLayoutBehavior.class);


but I noticed that the MindMap example does not have org.eclipse.gef.graph.Nodes or Edges.

I've been trying for hours but still didn't manage to populate a Graph so that I can:
1-Set a layout Algorithm to that Graph
2-Use ELK on the Nodes and Edges of my Part

What am I missing?
Re: Add LayoutAlgorithm in MinMap example [message #1803077 is a reply to message #1794027] Thu, 21 February 2019 21:24 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Joao,

sorry, for not coming back to this earlier.

The LayoutAlgorithm can be set as an attribute on the Graph object. In order to integrate ELK with current Zest defaults, you would need to implement an ILayoutAlgorithm that transforms the Graph, invokes ELK, and applies the results back. Using default LayoutBehaviors requires to read and write LayoutProperties[1].

However, you are not bound to conform to this mechanism. Maybe it is easier to create a LayoutPolicy that does not force a layout mechanism on to you but a transaction mechanism that enables you to undo/redo a layout. The main difference would be that a LayoutPolicy needs to be invoked explicitly while a LayoutBehavior will react on its own. The latter is good enough for most cases, but when seeking more control, replacing it with a passive component (Policy) is a viable approach.

[1] https://github.com/eclipse/gef/blob/6920fe104da1ae4b6b841e31850e7dc89d1ede57/org.eclipse.gef.layout/src/org/eclipse/gef/layout/LayoutProperties.java#L27

Best regards,
Matthias
Re: Add LayoutAlgorithm in MinMap example [message #1803382 is a reply to message #1803077] Wed, 27 February 2019 15:44 Go to previous messageGo to next message
João Pedro is currently offline João PedroFriend
Messages: 52
Registered: December 2014
Member
Dear Matthias,

I just want to apply different layout algorithms to my entire map (several Nodes + Connections). Is there any easy way of doing it and/or any example of toggling between different layout algorithms? Namely, how would you apply different layout algorithms to the MinMap example?

Thanks,

João

[Updated on: Wed, 27 February 2019 16:31]

Report message to a moderator

Re: Add LayoutAlgorithm in MinMap example [message #1833432 is a reply to message #1803382] Tue, 13 October 2020 05:28 Go to previous message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 157
Registered: February 2016
Senior Member
Hello João

The GEF Mindmap Tutorial contains an entire chapter about layouting:

Part VI Automatic layouting

Step 17: Automatic layouting via GEF layout
Step 18: Automatic layouting via Graphviz DOT
Step 19: Automatic layouting via the Eclipse Layout Kernel


See also https://blogs.itemis.com/en/getting-started-with-eclipse-gef-the-mindmap-tutorial

Hope that helps,
Tamás
Previous Topic:Snap To Object - GEF5
Next Topic:Advice for reordering tree items using AbstractTreeEditPart & policies??
Goto Forum:
  


Current Time: Fri Apr 19 15:07:49 GMT 2024

Powered by FUDForum. Page generated in 0.01969 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top