Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368124

Summary: ConnectionDecorator with Text causes problems
Product: [Modeling] Graphiti Reporter: Benjamin Schmeling <Benjamin.Schmeling>
Component: CoreAssignee: Project Inbox <graphiti-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.gorning, michael.wenz
Version: 0.8.0Flags: matthias.gorning: juno+
Target Milestone: 0.9.0   
Hardware: All   
OS: All   
Whiteboard: Juno M7 Theme_bugs
Attachments:
Description Flags
An AddFeature to reproduce problem none

Description Benjamin Schmeling CLA 2012-01-09 04:13:10 EST
ConnectionDecorator with Text as GraphicsAlgorithm causes problems with positioning. Firstly, the text is only visible if the decorator is active (for non-text algorithms non-active decorators seem to be no problem). Secondly, the positioning of text decorator (when moving the connection) behaves differently from positioning of non-text decorator. Consequently, if you have a combination of Text and Symbols as connection decorator they cannot be laid out properly.
Comment 1 Michael Wenz CLA 2012-01-11 07:38:01 EST
Do you have a running example of the second issue that we can use to easily reproduce?
Comment 2 Benjamin Schmeling CLA 2012-01-12 05:20:57 EST
Created attachment 209359 [details]
An AddFeature to reproduce problem

The problem occurs only with Manhattan connections. When then connections is plain everything looks fine but when the Manhattan connections starts to relayout, e.g. when you are moving the target or source around the text behaves differently compared to the arrows which stay aligned.
Comment 3 Matthias Gorning CLA 2012-04-11 08:52:25 EDT
The text is now visible even if you use a passive connection decorator.

Is the positioning of this passive text decorator OK for you?



commit 41bf531bd9869c3f175e29db96155035fa498a1e
Author: mgorning <matthias.gorning@sap.com> 2012-04-11 14:39:03
Committer: mgorning <matthias.gorning@sap.com> 2012-04-11 14:45:21
Parent: 9e459608b59c7bd180014e5811a32272c5f0b572 (Bug 375497 - Finalization)
Branches: bug368124, origin/master
Comment 4 Benjamin Schmeling CLA 2012-04-11 10:14:13 EDT
Hi,

thanks! For my example a passive decorator should be sufficient. However, I cannot manage to set the location for my passive text decorator. I am using a relative decorator and want to position the text above my connection. Before making the decorator passive I used ga.setLocation(txt, 0, -22) to achieve this; this has no effect anymore.

Regards,

Benjamin
Comment 5 Matthias Gorning CLA 2012-04-11 10:30:06 EDT
Why has ga.setLocation() no effect?
Comment 6 Benjamin Schmeling CLA 2012-04-11 10:42:30 EDT
I think because of this code block in PictogramElementDelegate (line 1337):

// special handling if a text is used in a passive connection decorator
// in this case simply set the size and return
if (figure instanceof GFText && (pe instanceof ConnectionDecorator) && !pe.isActive()) {
	GFText text = (GFText) figure;
	text.setSize(dimension);
	return;
}
		
If my decorator is not active then only the text size is set. The code dealing with location is called after this block and never reached because of the return statement.
Comment 7 Matthias Gorning CLA 2012-04-12 07:13:31 EDT
The location of the graphics algorithm will now used for the calculation of the correct location of the text decorator.

This is done in the class FlexibleRotatableLocator.

commit 525d4347b2c6b561dbccb6c28640a6d24cb514c7
Author: mgorning <matthias.gorning@sap.com> 2012-04-12 13:02:20
Committer: mgorning <matthias.gorning@sap.com> 2012-04-12 13:03:44
Parent: 4a0325c3b0a048379a49dcb7b660c634f064b772 (copyright)
Branches: bug368124, origin/master, master
Comment 8 Benjamin Schmeling CLA 2012-04-13 03:53:25 EDT
Hi Matthias,

now it is almost perfect!!! Thank you very much. However, there is still one difference between polygons and text as decorators. Polygons will be rotated depending on the routing of the manhattan connection, texts are not yet rotated. Could you fix that ?

Best,

Benjamin
Comment 9 Matthias Gorning CLA 2012-04-16 08:47:14 EDT
It's done. The text is now rendered with the correct rotation angle.

But currently we are facing some problems with rotated text objects. See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=375922

We will address these problems at the beginning of the Kepler release.

I hope the current implementation will work for you.

commit 11437b102fc96b6e1b897f3c09cc274850f05f47
Author: mgorning <matthias.gorning@sap.com> 2012-04-16 14:33:47
Committer: mgorning <matthias.gorning@sap.com> 2012-04-16 14:33:47
Parent: a5faa2014090eaa0aa2ad677d5f6a1f48191d507 (Bug 372753 - save shouldn't (necessarily) flush the command stack)
Branches: bug368124, origin/master
Comment 10 Benjamin Schmeling CLA 2012-04-17 05:34:21 EDT
Hi, 

thanks for the commit. Does this bug cause the text to appear at the wrong location after the rotation? Because of the wrong rotation point? After this update the text is rotated but it is not at the right location anymore. You can see this if you are using both a polygon and a passive text decorator for the same connection. The requirement is that both text and polygon are always aligned independently of the routing of manhattan connections....

Best,

Benjamin
Comment 11 Matthias Gorning CLA 2012-04-24 07:47:55 EDT
That's right. We also have problems with the rotation point.

This is especially visible in your scenario, with a combination of passive polygon and text decorators. 

As I said earlier, we hope to solve these problems at the beginning of the next release. Currently we have no capacity to work on this bug.

BR,
Matthias
Comment 12 Michael Wenz CLA 2012-06-29 04:23:54 EDT
Part of Graphiti 0.9.0 (Eclipse Juno)