Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 270962 - Changes to BorderedNodeFigure causes my border item to not show up
Summary: Changes to BorderedNodeFigure causes my border item to not show up
Status: RESOLVED DUPLICATE of bug 264587
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 critical
Target Milestone: ---   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-02 09:18 EDT by JSP CLA
Modified: 2010-07-19 12:27 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JSP CLA 2009-04-02 09:18:01 EDT
Build ID: M20090211-1700

Steps To Reproduce:
1.  Click on a node tool on the palette.
2.  Click on the canvas to create the node.
3.  The EditPart for my node extends the AbstractBorderedShapeEditPart.  It has a custom BorderItemLocator that always places its border item directly below the node.  The border item edit part extends LabelEditPart and the figure is a WrappingLabel.
4) The LabelEditPart does not show up until the region where it is located becomes dirty - usually by clicking where you expect the label to be.
5) Any other node that is dropped on the canvas and is  below existing nodes will have the same problem.
6) Any node that is dropped on the canvas and is above existing nodes will not have the problem. 


More information:
I upgraded from GMF 2.1.2 to GMF 2.1.3.

I tracked down the change that is causing my problem.

The layout() method of the BorderedNodeFigure changed from this:
protected void layout() {
if (!this.getBounds().equals(getMainFigure().getBounds())) {
getMainFigure().setBounds(this.getBounds().getCopy());
}
// When parent resizes, cause the border items to be relocated.
getBorderItemContainer().invalidateTree();
erase();
}

To this:
protected void layout() {
if (!this.getBounds().equals(getMainFigure().getBounds())) {
getMainFigure().setBounds(this.getBounds().getCopy());
getBorderItemContainer().invalidateTree();
erase();
}
}

Because my main figure is always the same size as my BorderNodeFigure, the invalidateTree() and erase() method were never being called.  This caused my border item (which is a WrappingLabel) to not be displayed until the region where the item is located becomes dirty - this can be done by clicking the location where you expect the border item to be.
Comment 1 Alex Shatalin CLA 2009-04-23 09:38:14 EDT
Looks like this problem was caused by a fix for bug 250018
Comment 2 Anthony Hunter CLA 2009-04-23 11:38:37 EDT
It is reported that the fix for "BorderedNodeFigure#layout() may cause infinite loop" causes this issue.
Comment 3 Alex Boyko CLA 2009-04-23 13:32:34 EDT
This is how repainting works in Draw2D. The region is repainted if it's dirty. So before the repaint of the the bordered node and its contents (icluding border items) were always repainted regardless whether the bounds of the node have changed or not while all other figures are repianted if bounds have changed (or colors opr any other visual attributes). I think the fix for 260018 should stand and instead a fix to border items is required.

Can you check whther the patch for  bug 264587 fixes your problem?

Thanks.
Comment 4 Alex Boyko CLA 2009-04-24 11:55:51 EDT
Assigned to myself. I'm 90% sure that it's a dup of 264587.
Comment 5 Alex Boyko CLA 2009-04-24 15:13:15 EDT
Yes, looks like a dup of 264587. Confirmed by toggling visibility of border item floating label.

*** This bug has been marked as a duplicate of bug 264587 ***
Comment 6 Eclipse Webmaster CLA 2010-07-19 12:27:21 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime Diagram was the original product and component for this bug