Hide BorderedNode when connected Edge is hidden or filtered [message #1818528] |
Wed, 18 December 2019 16:53 |
Konrad Jünemann Messages: 93 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 |
|
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 Canada
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 |
Konrad Jünemann Messages: 93 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03472 seconds