|
|
|
|
|
Re: GEF5 Add multiple parts to Group [message #1803280 is a reply to message #1803197] |
Tue, 26 February 2019 04:19   |
Eclipse User |
|
|
|
Hello,
The parent/child relation between boxes and ports should do what you want. In our diagram we have three levels of parts: boxes/groups/ports where our boxes are your Group and our ports are your IO (in our model, groups are drawn to show synchronization between input ports streams).
- when selecting a box, all children (groups and ports) follow the move
- when selecting a group, all ports inside the group of ports follow the move (and with coordinate constraint stay inside the box
- and finally, ports can be moved inside their parent group of ports
Children follow mouse drag of their parent even if they are not selected. Another solution would be to use anchored/anchorage mechanism.
In the configure method of the module we call bind methods for each level:
bindNodePartAdapters(AdapterMaps.getAdapterMapBinder(binder(), NodePart.class);
bindPortGroupPartAdapters(AdapterMaps.getAdapterMapBinder(binder(), PortGroupPart.class));
bindPortPartAdapters(AdapterMaps.getAdapterMapBinder(binder(), PortPart.class));
then, in these methods we decide to add or not bindings to Policies, for example, Nodes (the boxes) are deletable (DeletionPolicy), moveable (TransformPolicy), resizeable (ResizePolicy) when groups of ports are not moveable nor resizeable (they follow the parent box) and ports are only moveable inside their parent group of ports.

[Updated on: Tue, 26 February 2019 04:37] by Moderator
|
|
|
|
|
|
|
Re: GEF5 Add multiple parts to Group [message #1803390 is a reply to message #1803358] |
Wed, 27 February 2019 14:10  |
Eclipse User |
|
|
|
Hi Joao,
it might be working already, but by returning the parent as the host, you basically take out the child's transform policy. If you would not bind it in the first place, you would (most probably) get the same behavior.
I have to say I really like the explanations given by Patrick, so I encourage you to try a simpler setup inspired by those, e.g. have the ports immoveable by omitting TransformPolicy from ChildPart.
However, maybe it does make sense to revisit this later-on after working more with different handlers.
Best regards,
Matthias
|
|
|
Powered by
FUDForum. Page generated in 0.08003 seconds