Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » adaptViewNodeSizeWithLabel result over written(adaptViewNodeSizeWithLabel returns to original size when moved)
adaptViewNodeSizeWithLabel result over written [message #1822876] Mon, 16 March 2020 09:47 Go to next message
Simon Castle is currently offline Simon CastleFriend
Messages: 6
Registered: June 2019
Junior Member
Im using Sirius 6.3 and have followed https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_style.html to implement a BorderItemLocatorProvider based on CenteredBorderItemLocator to place my connection nodes in the center of the edges. This all works fine so the basic extension etc is working fine.

The problem is when I adaptViewNodeSizeWithLabel() to get a better size for the node based on the label content, This initially resizes correctly as shown.
But when I move the node, it returns to its initial size.
It looks as if its only the Node bounds that are incorrect and not the actual content as the label still has its larger size as show in the second image.

Do I need to modify the passed in Node in addition to returning the desired size ?

Thank you.
... Simon

  • Attachment: qbf-0.jpg
    (Size: 57.03KB, Downloaded 51 times)
  • Attachment: qbf-1.jpg
    (Size: 56.62KB, Downloaded 42 times)

[Updated on: Mon, 16 March 2020 10:31]

Report message to a moderator

Re: adaptViewNodeSizeWithLabel result over written [message #1822916 is a reply to message #1822876] Mon, 16 March 2020 16:47 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
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 Go to previous message
Simon Castle is currently offline Simon CastleFriend
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

Previous Topic:Is there something like a file selector in Sirius?
Next Topic:Node label margin
Goto Forum:
  


Current Time: Fri Apr 19 22:08:54 GMT 2024

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

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

Back to the top