Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Hide BorderedNode when connected Edge is hidden or filtered
Hide BorderedNode when connected Edge is hidden or filtered [message #1818528] Wed, 18 December 2019 16:53 Go to next message
Konrad Jünemann is currently offline Konrad JünemannFriend
Messages: 55
Registered: December 2018
Member
Hi,

I have a diagram that consists of connetec Containers. If two containers are connected, a BorderedNode is created for each of them and then those two BorderedNodes are connected by an edge.

I would now like to implement the following feature:
Whenever an edge is not shown, i.e., it is a) hidden manually by the user or b) filtered out by a filter, I would like to automatically hide both connected BorderedNodes as well.

How would I be able to achieve that?

I figure, in the Precondition Expression, I would have to check whether or not the connected edge is visible, but I don't know how exactly I would do that.

I tinkered around with something like this, without success:

aql:self.findMyEdge().visible


Any idea what I should try?
Re: Hide BorderedNode when connected Edge is hidden or filtered [message #1818545 is a reply to message #1818528] Thu, 19 December 2019 10:05 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 493
Registered: May 2011
Senior Member
Hello,

Considering your case, do you really need the border nodes where the edge connects the containers? The easiest solution here is to get rid of the boder node mapping. Note that you can change the edges end decorator and add labels add these ends if that is why you have border nodes.
If you want to keeps these border nodes, for the "a)" problem, you can add to the session event broker (org.eclipse.sirius.business.api.session.Session.getEventBroker()) a new ModelChangeTrigger (addLocalTrigger) with a notification filter scope set to listen to DiagramPackage.eINSTANCE.getHideFilter(). This way if the user hides the edge, the ModelChangeTrigger will also hide the connected border nodes.
For the "b)" problem, you just need to edit the filter to it will hide the edge mapping and the border node mapping.
I don't think you can fix your issue using the Precondition Expression as it is used for requests on the semantic elements where here the visibility status of an element is a graphical information.

Best Regards,
Steve


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Hide BorderedNode when connected Edge is hidden or filtered [message #1818690 is a reply to message #1818545] Mon, 23 December 2019 10:36 Go to previous messageGo to next message
Konrad Jünemann is currently offline Konrad JünemannFriend
Messages: 55
Registered: December 2018
Member
Hi Steve,

thanks for your reply. The b) answer is kinda obvious, now that I think about it (d'oh).

I know that I could add labels to the edge itself. However, I prefer the border nodes, as they always "stick" to the node, no matter the length and position of the edge. With edge labels, the user typically (i.e., in non-trivial graphs) has to rearrange the labels manually each time he repositions the labels in order to avoid confusion as to which edge exactly the label belongs. Is there a good solution for this problem? I guess other people just live with this inconvenience?

Thanks for the a) solution, though. Will this also work if the edge is not shown because of "transitively" hidden node, i.e., if the user does not the edge itself but the node on the other side of the edge?

Best Regards,
Konrad


Re: Hide BorderedNode when connected Edge is hidden or filtered [message #1818741 is a reply to message #1818690] Thu, 26 December 2019 12:35 Go to previous message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 493
Registered: May 2011
Senior Member
Hello,

Indeed, the labels at the end of an edge may require to be moved around by the user even though Sirius places them next to the end of the edge. This could be improved by having a custom style[1] on the edge mapping, but it is probably overkill in this context.
If you go with the a) solution with a model change trigger, it will be triggered with a notification. Therefore depending if the "Hide action" is executed on a Node or an edge, it will be the notifier. Your model change trigger will need to be able to process if it is an edge then it will need to hide 2 nodes. If it is a node, then it will need to hide the edge and the opposite node.

Best regards,
Steve

[1] https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_style.html


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Adding a Semantic Resource to the Session (SOLVED)
Next Topic:how to edit DDiagram element?
Goto Forum:
  


Current Time: Fri Dec 04 03:28:57 GMT 2020

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

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

Back to the top