Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 294024 - BasicMarkerSupport - Marker decorations are not cleared when ridget is rebound
Summary: BasicMarkerSupport - Marker decorations are not cleared when ridget is rebound
Status: RESOLVED FIXED
Alias: None
Product: Riena
Classification: RT
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.1.0.M1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-03 03:02 EST by Holger Hoch CLA
Modified: 2012-05-21 06:35 EDT (History)
1 user (show)

See Also:


Attachments
snippet with sample code (7.25 KB, application/octet-stream)
2009-11-03 03:04 EST, Holger Hoch CLA
no flags Details
steps to reproduce behaviour (25.39 KB, image/png)
2009-11-03 03:06 EST, Holger Hoch CLA
no flags Details
Snippet to reproduce issue (5.21 KB, application/octet-stream)
2010-02-26 19:30 EST, Elias Volanakis CLA
no flags Details
Snippet to reproduce issue (2.86 KB, application/octet-stream)
2010-02-26 19:30 EST, Elias Volanakis CLA
no flags Details
Snippet to reproduce issue (3.02 KB, text/plain)
2010-02-26 19:39 EST, Elias Volanakis CLA
no flags Details
fix + test (11.58 KB, patch)
2012-03-28 12:02 EDT, Nobody - feel free to take it CLA
christian.campo: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Hoch CLA 2009-11-03 03:02:29 EST
User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)
Build Identifier: 20090621-0832

For controls on a composite that is scrollable (like the CompositeTable) the user can easily achieve that error marlers are drawn outside the cmoposite by scrolling the error marked widgets nea the left border. Error markers drawn in this situation do not get cleared when scrolling back and other actions that require redrawing. see screenshots and snippet.

Reproducible: Always

Steps to Reproduce:
see code and screenshots attached
Comment 1 Holger Hoch CLA 2009-11-03 03:04:17 EST
Created attachment 151162 [details]
snippet with sample code
Comment 2 Holger Hoch CLA 2009-11-03 03:06:28 EST
Created attachment 151163 [details]
steps to reproduce behaviour
Comment 3 Elias Volanakis CLA 2009-11-03 18:10:17 EST
Spend a few minutes with the example. I believe that this is due to a limitation of JFace's ControlDecoration class. See also Bug #208397 which is seems related. Need to spend an hour to look into it properly.
Comment 4 Elias Volanakis CLA 2010-02-26 19:28:25 EST
He, he, this is an interesting one. In CompositeTable the widget to ridget binding changes when the Table is scrolled or resized. This is not the problem yet. 

The problem is that we don't clear and re-apply the ControlDecoration when the control is unbound. 

See attached MarkerBug002 for a demo. I'll experiment to find out how we can fix this.
Comment 5 Elias Volanakis CLA 2010-02-26 19:30:12 EST
Created attachment 160386 [details]
Snippet to reproduce issue
Comment 6 Elias Volanakis CLA 2010-02-26 19:30:37 EST
Created attachment 160387 [details]
Snippet to reproduce issue
Comment 7 Elias Volanakis CLA 2010-02-26 19:37:14 EST
This affects more that the ControlDecoration. Also foreground and background are affected.
Comment 8 Elias Volanakis CLA 2010-02-26 19:39:10 EST
Created attachment 160388 [details]
Snippet to reproduce issue
Comment 9 Elias Volanakis CLA 2010-07-15 18:02:49 EDT
When the decorated control is moved one has to repaint both the old border position (was not done - will remove border) and the new border position (was done).

Fixed in HEAD.
Comment 10 Elias Volanakis CLA 2010-07-15 18:03:32 EDT
Oops, wrong bug.
Comment 11 Elias Volanakis CLA 2011-08-03 14:36:56 EDT
Reassigning to default assignee.
Comment 12 Nobody - feel free to take it CLA 2012-03-28 12:02:43 EDT
Created attachment 213297 [details]
fix + test

Elias thanks for the Snippet. The problem here is that the error decoration object (in this case ControlDecoration) inside the MarkerSupport is always associated with the control, passed to its constructor.

The first time an error marker is set, a ControlDecoration object is created, cached, and used for all subsequent error markers for this _ridget_.

	if (errorDecoration == null) {
		errorDecoration = createErrorDecoration(control);
	}

But if we set a new UI control to this ridget, the cached error decorator must be reset too. This was not the case.

In the proposed fix (see patch) I moved the cache to the UI control object using setData(key, errorDecoration)

	if (control.setData(ERROR_DECORATION_FOR_CONTROL_KEY) == null) {
		control.setData(ERROR_DECORATION_FOR_CONTROL_KEY, createErrorDecoration(control));
	}
Comment 13 Nobody - feel free to take it CLA 2012-04-04 10:04:23 EDT
pushed to git