Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355612 - [Table][TextSizeDetermination] Wrong itemHeight on the client in some cases
Summary: [Table][TextSizeDetermination] Wrong itemHeight on the client in some cases
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.5 M2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: sr141
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-24 04:20 EDT by Ivan Furnadjiev CLA
Modified: 2011-08-29 02:49 EDT (History)
1 user (show)

See Also:


Attachments
Patch (8.33 KB, patch)
2011-08-24 07:43 EDT, Ivan Furnadjiev CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.