This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 121215

Summary: Labels Overlap
Product: platform Reporter: Trey Spiva <tspiva>
Component: GraphAssignee: t_h <t_h>
Status: VERIFIED FIXED    
Severity: blocker CC: anebuzelsky, t_h
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 105060    
Attachments: Overlapping Labels
Replacement for ConnectionWidgetLayout class
Updated version of the test which uses the new version of ConnectionWidgetLayout
Example of new stacking behavior
The test works for me, no overlapping labels
Demonstrates the overlapping label problem.

Description Trey Spiva 2007-11-05 19:06:12 UTC
When a ConnectionWidget owns two widgets that have the constraint at the same constraint the labels are drawn on top of each other.  The layout manager 
should make sure that all labels are visible.  Maybe a new layout manager will need to be created.

An example of the expected behavior would be if the edge is horizontal, and the labels have the constraint to be on top of the edge, the labels should be 
stacked vertically.
Comment 1 Trey Spiva 2007-11-05 19:07:25 UTC
Created attachment 52550 [details]
Overlapping Labels
Comment 2 David Kaspar 2007-11-06 12:52:04 UTC
It could be done seamlessly by introducing a new Layout. The only issue is how to resolve the new location of
overlapping widgets. If the Layout should be built-in the library, then it should have this location resolving customizable.
Comment 3 Trey Spiva 2007-11-26 20:27:12 UTC
I created a new example in the examples project that demonstrates this issue.  That way when the issue is fixed, we also have an example built.  The name of 
the example is test.connectionlabels.LabelsWithSameAnchorTest.
Comment 4 David Kaspar 2008-07-25 19:47:40 UTC
Created attachment 65667 [details]
Replacement for ConnectionWidgetLayout class
Comment 5 David Kaspar 2008-07-25 19:48:55 UTC
Created attachment 65668 [details]
Updated version of the test which uses the new version of ConnectionWidgetLayout
Comment 6 David Kaspar 2008-07-25 19:58:17 UTC
I have attached two files:
1) StackedConnectionWidgetLayout class is a new/rewritten version of ConnectionWidgetLayout class from the visual
library source code.
2) LabelsWithSameAnchorTest class is updated version of the original test class that uses the new
StackedConnectionWidgetLayout class.

This new StackedConnectionWidgetLayout is having a single boolean parameter. If it is false, then it behaves as original
implementation. If it is true, then the overlapping child-widgets are stacks vertically.

To integrate this into the library, I would recommend to:
1) replace original ConnectionWidgetLayout class implementation with the new one
2) LayoutFactory should have a new factory method with boolean parameter...
3) ConnectionWidget should have a new connectionWidgetLayoutPolicy property that would modify the "useStacking" field in
the new implementation since by default it has to behave as it behaving right now because of backward-compatibility.
Comment 7 David Kaspar 2008-08-18 10:24:24 UTC
Patch available.
Comment 8 t_h 2008-08-26 13:16:03 UTC
Patch integrated in 6dd4773a30a9. I think it is not necessary to keep defective behavior for backward compatibility, but
in case someone needs it please reopen this issue and I will add support for old behavior as David suggested.
Comment 9 Quality Engineering 2008-08-28 06:29:59 UTC
Integrated into 'main-golden', available in build *200808280201* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/6dd4773a30a9
User: Tomas Holy <t_h@netbeans.org>
Log: #121215: Labels Overlap
Comment 10 Trey Spiva 2008-09-10 17:59:57 UTC
This does not seem to have fixed our problem.  From looking at the diff it looks like the stacking should be on by default.   However as you can see from the 
image I am attaching it does not seem to be working.  As you can tell from the image there is enough space between the connection widget and the label for 
two labels, however they are stacked on top of each other. 

Also from Davids comments about how it is to be implemented I do not see a way to change the useStacking property.
Comment 11 Trey Spiva 2008-09-10 18:02:24 UTC
Created attachment 69557 [details]
Example of new stacking behavior
Comment 12 t_h 2008-09-16 10:19:31 UTC
Yes, there is only version with stacking support, no need to set any property. Can you please provide example where
stacking fails?
Comment 13 Trey Spiva 2008-09-17 17:40:49 UTC
Well one example is the UML I showed in the attached image.  If you want me to write a small example I will try to get that for you.
Comment 14 Trey Spiva 2008-09-17 22:30:38 UTC
I was able to reproduce the problem with one of the existing examples.

http://hg.netbeans.org/main/contrib/file/ee63cdc1f9df/visual.examples/src/test/connectionlabels/LabelsWithSameAnchorTest.java
Comment 15 t_h 2008-09-18 10:45:34 UTC
Created attachment 70084 [details]
The test works for me, no overlapping labels
Comment 16 t_h 2008-09-22 13:19:40 UTC
closing as works for me, please reopen with information how to reproduce
Comment 17 Trey Spiva 2008-09-23 21:21:40 UTC
The difference is that the example test case uses the connection widget layout alignment of CENTER_TOP.  However if you use a alignment of TOP_CENTER 
you will see the behavior that I described.  I am attaching a source file that demonstrates the behavior.
Comment 18 Trey Spiva 2008-09-23 21:23:21 UTC
Created attachment 70361 [details]
Demonstrates the overlapping label problem.
Comment 19 t_h 2008-09-24 14:30:50 UTC
de5680ad6416
Comment 20 Quality Engineering 2008-09-25 06:35:33 UTC
Integrated into 'main-golden', will be available in build *200809250201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/de5680ad6416
User: Tomas Holy <t_h@netbeans.org>
Log: #121215: Labels Overlap
Comment 21 Trey Spiva 2008-09-25 22:44:34 UTC
I have verified that is now working for my usecase.