Bug 464212 - Bordered Node overlaping parent Node complicates usage of WorkspaceImages
Summary: Bordered Node overlaping parent Node complicates usage of WorkspaceImages
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-04-08 17:50 EDT by Max Schettler CLA
Modified: 2015-04-28 03:45 EDT (History)
2 users (show)

See Also:


Attachments
Image illustrating the overlapping (3.47 KB, image/png)
2015-04-25 09:16 EDT, Max Schettler CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Max Schettler CLA 2015-04-08 17:50:26 EDT
The BorderedNode`s figure overlap their Parent.
This behaviour creates problems when using an WorkspaceImage or an self-built EditPart/Figure because one has to create the image/figure with this in mind. Also the overlaping amount is not fixed so it depends on the size of the node.
Comment 1 Pierre-Charles David CLA 2015-04-09 04:16:37 EDT
(In reply to Max Schettler from comment #0)
> Also the overlaping amount is not fixed so it depends on the size of the node.

It should normally be fixed (to 8 pixels, see http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/graphical/edit/styles/IBorderItemOffsets.java#n26). Do you have details on your use case where this is not the case?
Comment 2 Max Schettler CLA 2015-04-20 11:18:20 EDT
Sorry it took me so long...
It is fixed to 8 pixels, however due to this it is not possible to use a workspace image that is only displayed on the outside, because the image scales depending on the node`s size.
Comment 3 Pierre-Charles David CLA 2015-04-22 11:55:59 EDT
I'm not sure I understand what you mean by "a workspace image that is only displayed on the outside". Do you have a screenshot (or mockup) of the effect you want to obtain?
Comment 4 Max Schettler CLA 2015-04-25 09:16:07 EDT
Created attachment 252766 [details]
Image illustrating the overlapping

The attachment should illustrate the problem: Both bordered Nodes use the same WorkspaceImage (The EditPart is custom for rotating the image, but uses the Sirius SVGWorkspaceImageFigure). 
On the bigger one the line fits with the border of the container. On the smaller image it overlaps with the containers shape.
So I would have to create different images for all sizes, which also only works if the nodes are not resizable.
Another issue is, that the overlapping is also dependent on the side, the BorderedNode is attached to. When the big "connector" is on the bottom of the container, the line will also overlap.
Comment 5 Pierre-Charles David CLA 2015-04-27 10:41:15 EDT
Thanks for the illustration, I understand the problem now. This is indeed a restriction of how Sirius right now, and there is currently no direct way to disable that.

The only possible workarounds I see using the current code would be:
1. Disallow resizing of the bordered node in question.
2. Use the org.eclipse.sirius.diagram.ui.styleConfigurationProvider extension point to provide your own IBorderItemLocator via StyleConfiguration.getNameBorderItemLocator(). There is some documentation at https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_style.html but I'm not sure how up-to-date it is.
3. Given that you already provide a custom edit part, also provide a custom IFigure implementation programmed directly using Draw2D API, where you could probably determine programmatically the correct coordinates to pass to Graphics.drawLine() to make your figure connect exactly on the border.

I understand these are not real solutions, but maybe they can help for the time being. A real solution would be to allow this "inset" to be configured directly in the VSM instead of hard-coded to "8 pixels", but the exact shape of such an enhancement will require some thinking/specification to make sure it would interact correctly with all the other features of Sirius diagrams.

> Another issue is, that the overlapping is also dependent on the side,
> the BorderedNode is attached to. When the big "connector" is on the bottom
> of the container, the line will also overlap.

This is more suprising. I don't think we have anything in our code which treats the top and bottom side differently in this respect (but I could be wrong). Could this come from your custom code for the image rotation?
Comment 6 Max Schettler CLA 2015-04-28 03:45:28 EDT
Thanks for your reply. I think I will opt for the solution using the IBorderItemLocator as it seems to be the cleanest one.

I do not think that the differences depending on the side of the image come from my EditPart because it just listens for events indicating change of the layout, computes which side the figure is on and rotates it. Anyway I will look more deeply into my code, maybe I can spot something.