Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » label for a shape
label for a shape [message #633649] Mon, 18 October 2010 16:33 Go to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 261
Registered: July 2009
Senior Member
Hi all,

I'd like to attach a label to a shape. Is it necessary to have that
included in the visible area of the top level shape of this PE?

Or can I attach a label without being clipped away also outside this area?

Thanks,
Henrik
Re: label for a shape [message #633742 is a reply to message #633649] Tue, 19 October 2010 08:18 Go to previous messageGo to next message
Matthias Gorning is currently offline Matthias GorningFriend
Messages: 81
Registered: April 2010
Location: Germany
Member
Hi Henrik,

I am not sure what "attach a label to a shape" means.

Do you want attach a shape (with a text graphics algorithm) to another shape? In the same way as you can do it with ConnectionDecorators and Connections?

BR,
Matthias

Re: label for a shape [message #633770 is a reply to message #633742] Tue, 19 October 2010 11:21 Go to previous messageGo to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 261
Registered: July 2009
Senior Member
Hi Matthias,

I think it should be similar to a connection label, though not movable
by the user.

Regards,
Henrik

Am 19.10.2010 10:18, schrieb Matthias Gorning:
> Hi Henrik,
>
> I am not sure what "attach a label to a shape" means.
>
> Do you want attach a shape (with a text graphics algorithm) to another
> shape? In the same way as you can do it with ConnectionDecorators and
> Connections?
>
> BR,
> Matthias
>
>
Re: label for a shape [message #634035 is a reply to message #633770] Wed, 20 October 2010 10:34 Go to previous messageGo to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 261
Registered: July 2009
Senior Member
I can restate my question to:

At the moment I create an invisible rect which in turn contains my
actual figure plus a label. Both must be completely contained in the
invisible rect to be visible.

How can I have the label outside the top level GA (the invisible rect)
of my figure?

Thanks,
Henrik


Am 19.10.2010 13:21, schrieb Henrik Rentz-Reichert:
> Hi Matthias,
>
> I think it should be similar to a connection label, though not movable
> by the user.
>
> Regards,
> Henrik
>
> Am 19.10.2010 10:18, schrieb Matthias Gorning:
>> Hi Henrik,
>>
>> I am not sure what "attach a label to a shape" means.
>>
>> Do you want attach a shape (with a text graphics algorithm) to another
>> shape? In the same way as you can do it with ConnectionDecorators and
>> Connections?
>>
>> BR,
>> Matthias
>>
>>
Re: label for a shape [message #634347 is a reply to message #634035] Thu, 21 October 2010 11:21 Go to previous messageGo to next message
Ken Wenzel is currently offline Ken WenzelFriend
Messages: 51
Registered: July 2009
Member
Hallo,

I'm also interested in a solution to this problem.

Maybe a generalized class like ShapeDecorator implemented in the same way as the existing ConnectionDecorator would be a good solution?

We're currently also using an invisible rectangle as container:

   Invisible rectangle
  .-------------------.
  |      ,,---..      |
  |    ,'       `.    |
  |   /           \   |
  |   |Node shape |   |
  |   \           '   |
  |    `._     _,'    |
  |       `---'       |
  | This is a label.  |
  `-------------------'


A problem of this approach is, that the label size is always
bounded by the size of the outer invisible rectangle.
Another problem is concurrent movement/resizing of the node shape and the label. We've overriden IToolBehaviorProvider.getSelection(...) to always select the invisible rectangle that circumvents the latter problem.

A ShapeDecorator could decouple the node shape and the label and therefore eliminate movement and resizing issues.

Best regards,

Ken Wenzel
Re: label for a shape [message #634384 is a reply to message #633649] Thu, 21 October 2010 13:57 Go to previous messageGo to next message
Tim Kaiser is currently offline Tim KaiserFriend
Messages: 118
Registered: July 2009
Senior Member
Hi,

currently, there is no way showing something outside
the invisible container, the childs get clipped.

You could adopt the size of the invisible container in your
Layout Feature depending on the size required by its childs.

Does it solve the problem?

@Ken: sounds good...if you have concrete ideas how this could work you might open a bugzilla entry proposing a contribution.

Best, Tim

[Updated on: Thu, 21 October 2010 14:21]

Report message to a moderator

Re: label for a shape [message #634609 is a reply to message #634384] Fri, 22 October 2010 12:39 Go to previous messageGo to next message
Ken Wenzel is currently offline Ken WenzelFriend
Messages: 51
Registered: July 2009
Member
Hallo,

Quote:

You could adopt the size of the invisible container in your
Layout Feature depending on the size required by its childs.


We do the other way round. The user is only allowed to resize the invisible shape that is later used to recalculate the sizes of its children accordingly.
Unfortunately, this leads to the problem that the height of a multi-line text cannot be correctly computed by a layout feature since it would have to know if the text
will be wrapped or not.

Giving the user the abililty to resize/move the node shape would require specialized resize and move features. Another problem with this approach would be the mentioned clipping of children if e.g. a child is resized/moved beyond the bounds of its parent.

Quote:

@Ken: sounds good...if you have concrete ideas how this could work you might open a bugzilla entry proposing a contribution.


I don't know how much work would be required to implement such a feature. Would it be possible to refactor the interface ConnectionDecorator into a generic one like PictogramElementDecorator?

Best regards,
Ken

[Updated on: Sat, 23 October 2010 10:35]

Report message to a moderator

Re: label for a shape [message #634996 is a reply to message #633649] Mon, 25 October 2010 11:24 Go to previous message
Tim Kaiser is currently offline Tim KaiserFriend
Messages: 118
Registered: July 2009
Senior Member
Hi,

it is fine to use the resize on the invisible container only.
Still it might be possible to precalculate if the text needs to be wrapped and how much space it will take. Then you may answer true/false depending on the above results in the canResize method of the Resize Feature.

Also you might be interested in
GraphitiUi.getUiLayoutService().calculateTextSize()


Regarding your proposal, i think the interfaces are one side and your proposal sounds sensible but the real complications lie in the implementation of the rendering engine...that is,how would the new concept be mapped to GEF/Draw2d....i am reluctant to say how much work it would be...it would require a deep dive at least. If you really see a lot of added value in such a feature please open a bugzilla entry with type "enhancement request".

Best regards, Tim

[Updated on: Mon, 25 October 2010 11:24]

Report message to a moderator

Previous Topic:Rendering decorators for connections
Next Topic:Adding an action to context menu
Goto Forum:
  


Current Time: Thu Apr 25 16:16:07 GMT 2024

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

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

Back to the top