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

Bug 355612

Summary: [Table][TextSizeDetermination] Wrong itemHeight on the client in some cases
Product: [RT] RAP Reporter: Ivan Furnadjiev <ivan>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neubauer
Version: unspecified   
Target Milestone: 1.5 M2   
Hardware: All   
OS: All   
Whiteboard: sr141
Attachments:
Description Flags
Patch none

Description Ivan Furnadjiev CLA 2011-08-24 04:20:47 EDT
Reproducible with Controls Demo -> TableViewer Tab on first run (text estimation). 
1. Set a bigger font on the table - add in TableViewerTab (line 469):
viewer.getTable().setFont( Graphics.getFont( "Times", 22, SWT.BOLD | SWT.ITALIC ) );
2. Run the Controls Demo -> TableViewer tab
3. Enable cell editors
4. Click on the "Donald" - the cell editor for "Albert" appears and it is misaligned.
The reason for this issue is the following:
1. Table#getItemHeight is using Graphics#getCharHeight
2. The MeasurementOperator#readMeasuredFontProbeSizes is executed in two places - MeasurementListener#handleMeasurementResults and MeasurementListener#handleStartupProbeMeasurementResults
3. MeasurementListener#handleStartupProbeMeasurementResults is executed before the PREPARE_UI_ROOT phase ( *before* the "preserveValues" ) on *every* request (PREPARE_UI_ROOT phase exists in RWTLifeCycle#PHASE_ORDER_SUBSEQUENT). As a result, preserving a value, that depends on char height (measured font size) will not be rendered on the client. Client and server are out of sync.
Comment 1 Ivan Furnadjiev CLA 2011-08-24 04:57:23 EDT
Two questions come to my mind:
1. Do we really need a PREPARE_UI_ROOT phase in RWTLifeCycle#PHASE_ORDER_SUBSEQUENT?
2. Do we need to handle "handleStartupProbeMeasurementResults" separately from "handleMeasurementResults"? Is handleStartupProbeMeasurementResults really needed?
Comment 2 Ivan Furnadjiev CLA 2011-08-24 07:43:24 EDT
Created attachment 202075 [details]
Patch

After discussion with Frank, we agreed to introduce a boolean field ( isStartupProbeMeasurementPerformed ) in the MeasurementOperator that ensure that handleStartupProbeMeasurementResults is executed only once (in PREPARE_UI_ROOT phase of the first request only).
Comment 3 Ivan Furnadjiev CLA 2011-08-24 07:46:18 EDT
Applied patch to CVS HEAD.
Comment 4 Ivan Furnadjiev CLA 2011-08-24 12:58:59 EDT
Applied patch to v14_Maintenance branch too.