Need suggestion on programatically creating connection with diamond shape in between [message #996707] |
Wed, 02 January 2013 13:17  |
Eclipse User |
|
|
|
Hi,
I have programatically created a connection with diamond shape in between (image below). I have tired two approaches. The second one described below works, however I am not sure if it is correct. I would like to know if there is a better way to do it.
Initially, I tried creating the above in the feature that creates the connection (first connection from source object to the fixed_left_anchor on the diamond and second connection from the fixed_right_anchor to the object on the right), however I realized that I could only return a single connection object from the add() method, and I had created two connections. I looked at the "CompositeConnection" and I guess it won't work in my case.
As an alternative, I wrote a separate feature that creates the diamond shape and the connections (objectA->DiamonShape->objectB, here -> represents a connection from/to objectX to the fixed anchor on the diamond shape). However, I am not very confident with this approach. There are couple of issues like - connection delete only deletes the selected connection and not the whole (connections + diamond shape). Selection doesn't work as expected.
Couldn't find much help in the following threads,
http://www.eclipse.org/forums/index.php/t/391822/
http://www.eclipse.org/forums/index.php/t/392657/

Thanks in advance.
|
|
|
|
Re: Need suggestion on programatically creating connection with diamond shape in between [message #997201 is a reply to message #996707] |
Fri, 04 January 2013 07:49  |
Eclipse User |
|
|
|
Hi,
your approach appears to be valid, but as you already noticed it will need
much more adaptations of the Graphiti default behavior, e.g. you need to
adapt the default delete feature so that it deletes both connections and the
diamond shape when the user deletes one part of the connection.
Do you need the free movability of the diamond shape? In case not you may
also try to use a connection decorator that draws a diamond in the middle of
the connection. With that users will not be able to move the diamond to
another location on the connection or bend the connection by moving the
diamond, but it will mean much less effort for you. There's an example on
connection decorators in the tutorial (displaying the arrows on reference
connections).
Michael
|
|
|
Powered by
FUDForum. Page generated in 0.05826 seconds