Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 297795 - DatePicker: stays visible when ridget is not visible
Summary: DatePicker: stays visible when ridget is not visible
Status: RESOLVED FIXED
Alias: None
Product: Riena
Classification: RT
Component: ridget (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 2.0.0.M6   Edit
Assignee: Elias Volanakis CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-14 21:40 EST by Elias Volanakis CLA
Modified: 2011-05-19 07:08 EDT (History)
1 user (show)

See Also:


Attachments
Patch that fixes the bug (5.16 KB, patch)
2010-01-19 07:19 EST, Yang Meyer CLA
elias: iplog+
Details | Diff
Test cases covering the changes introduced by previous attachment. (3.31 KB, text/plain)
2010-01-20 04:48 EST, Yang Meyer CLA
elias: iplog+
Details
Adds resetPropertyChangeEvents() calls to the end of problematic tests; also cleans up egregious assertEquals(true, ...) (3.87 KB, patch)
2010-01-20 11:49 EST, Yang Meyer CLA
christian.campo: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elias Volanakis CLA 2009-12-14 21:40:57 EST
To reproduce:

1. Marker Demo in SWT Playground
2. Check the "hidden" checkbox
Comment 1 Yang Meyer CLA 2010-01-19 07:19:17 EST
Created attachment 156492 [details]
Patch that fixes the bug

The date picker was not hidden completely because DateTextRidget's getUIControl() method always returned its Text widget. Therefore only the Text widget was hidden, but not the button for the dropdown calendar.

Simply overriding setVisible(boolean) in DateTextRidget does not work because setting a ridget's visibility in fact only sets a hidden marker. The visibility changes are applied in a second step, and here the ridget's getUIControl() is invoked to fetch the control to hide - see BasicMarkerSupport.updateUIControl().

The patch I am attaching addresses the issue as follows:

* TextRidget's existing getTextWidget() method is made protected (was private).
* DateTextRidget overrides this method, returning the Text widget contained in the DatePickerComposite.
* TextRidget uses getTextWidget() instead of getUIControl() wherever binding is concerned: forceTextToControl(String), [un]bindUIControl().

In effect, for binding concerns the Text widget is used, for other concerns (e.g. visibility) the ridget-wrapped control proper, i.e. Text for the TextRidget, DatePickerComposite for the DateTextRidget.

Hope this helps. Comments welcome.
Comment 2 Yang Meyer CLA 2010-01-20 04:48:23 EST
Created attachment 156614 [details]
Test cases covering the changes introduced by previous attachment.

The test cases require the patch to be applied first, because getTextWidget() originally is private.
Comment 3 Yang Meyer CLA 2010-01-20 09:48:49 EST
Just discovered that my fix breaks 2 tests in MarkableRidgetTest. I'm looking into it.
Comment 4 Yang Meyer CLA 2010-01-20 11:49:55 EST
Created attachment 156670 [details]
Adds resetPropertyChangeEvents() calls to the end of problematic tests; also cleans up egregious assertEquals(true, ...)

Turns out the new bug did NOT have anything to do with the previous patches.

Instead, an unrelated bugfix committed this morning (!) had not been mirrored to the pserver repository yet! The changes should have arrived on the pserver mirror by tomorrow, so I will check again then and report my findings here.

== Submitted patch =======
To avoid future problems with EasyMock still expecting certain method calls at tearDown(), I added a call to resetPropertyChangeEvents() to the end of the two failing tests in MarkableRidgetTest.

The patch also replaces some instances of incredible assertEquals(true, condition) calls with a proper asssertTrue(condition) ...
Comment 5 Yang Meyer CLA 2010-01-21 11:05:53 EST
(In reply to comment #4)

I re-checked, the tests pass, and everything looks fine.
Comment 6 Elias Volanakis CLA 2010-02-12 19:28:05 EST
Committed.

Thanks Yang!