|
Re: adaptViewNodeSizeWithLabel result over written [message #1822916 is a reply to message #1822876] |
Mon, 16 March 2020 16:47 |
|
Hello,
I think that you also need to change the node to keep it in sync, but I have not made these kind of customization in a while. For your information, when you select a node, there is a button "Auto size" in the tabbar that will resize the node to have the label visible. There is also an alternative where in your odesign instead of a node mapping, you use a container mapping where the width is "-1" so it will also resize automatically.
Best regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: adaptViewNodeSizeWithLabel result over written [message #1822956 is a reply to message #1822916] |
Tue, 17 March 2020 10:48 |
Simon Castle Messages: 6 Registered: June 2019 |
Junior Member |
|
|
Thanks for your comments Steve.
But calling setWidth() on the node results in
java.lang.IllegalStateException: Cannot modify resource set without a write transaction
I have simplified my real situation to highlight the problem in isolation from any other potential issues, in the example I have a simple square style on the node.
In reality I have a CustomEditPart which extends LozengeEditPart and a CustomFigure extending LozengeFigure which then draws its own shape.
This all appears to work, display and resize correctly.
The main issue is that the custom style only has a single SizeComputationExpression which doesnt fit my needs as I need my shapes to be wider than its height due to its label. When it is created.
It would be sufficient to issue the AutoSize command on creation of the new Node but I think this will also end up in the wrong transaction stack.
I have experimented with points 4/5 here https://wiki.eclipse.org/Sirius/Cookbook which did allow me to size the first container but the situation is more complex as the node in question is a subnode of a container. So in my odesign ContainerCreator, I made the container (CreateView) and its sub node (CreateView) and passed them both into a service where I tried to set some layout hints, but only managed to get it to work for the outer container. I may look into this again and try to figure out what the SiriusLayoutDataManager needs.
I have also tried to issue SetBoundsCommand() on the EditingDomain of the Part but again I end up in a ReadOnlyTransaction.
I have spent some days on this already, so my just live with it for now, may be the solution will revel itself later with more experience.
But if anyone has an idea how I may size this node correctly after its created I would be grateful.
Thanks.
.... Simon
[Updated on: Tue, 17 March 2020 10:58] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03704 seconds