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

Bug 395805

Summary: Inconsistent behavior between SWT vs RWT table header font
Product: [RT] RAP Reporter: John Gymer <jgymer>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: rsternberg
Version: 2.0   
Target Milestone: 2.0 M4   
Hardware: All   
OS: All   
Whiteboard:

Description John Gymer CLA 2012-12-05 05:24:06 EST
In SWT, setting a Table's font not only affects the font for data in the table, but also the TableColumn header text. However, in RWT, the TableColumn header text is not affected, and the only way to change a TableColumn's header font appears to be via the CSS and themes, not programatically.

This request is to make behaviour in RWT the same as SWT so that the TableColumn header can have its font set in the same way.

To reproduce, any Table can be used, setting font something like this:
...
fontData = new FontData();
if (runningAsSWT)
	fontData.height = myFontSize;
else {
	fontData.setHeight(myFontSize+myFontAdjustSizeForRWT);
}
fontData.setStyle(myFontStyle);
fontData.setName(myFontType);
font = new Font(display, fontData);
myTable.setFont(font);
...

As an aside, this example also highlights 2 additional differences (one of which I believe is already raised as a problem) between RWT vs SWT:
1) the .height property must be used for SWT and .setHeight() method must be used for RWT (I have not seen this problem raised elsewhere).
2) the RWT height must be adjusted because the values for font sizes are measured differently (px vs pt?), which is not ideal for single-sourcing, and may produce unexpected results on different browsers, or systems using different DPIs etc.

Using RAP 2.0 M3.
Comment 1 John Gymer CLA 2012-12-05 06:03:20 EST
Actually, quick amendment to Point 1... it seems that .setHeight() method works ok in SWT and RWT. It is only .height property that doesn't work. That's fine - I'll just use .setHeight() for everything!
Comment 2 Ivan Furnadjiev CLA 2012-12-06 05:06:59 EST
John, if you read the JavaDoc of the SWT "height" field you will find the following:
/**
* The height of the font data in points
* (Warning: This field is platform dependent)
* <p>
* <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
* public API. It is marked public only so that it can be shared
* within the packages provided by SWT. It is not available on all
* platforms and should never be accessed from application code.
* </p>
* 
* @noreference This field is not intended to be referenced by clients.
*/
FontData#setHeight is the correct way to go. That's why I think that p.1 is invalid. About your p.2 we have a separate bug opened - bug 309945.
The issue with TableColumn font derived from the Table itself is valid.
Comment 3 John Gymer CLA 2012-12-06 06:09:43 EST
Thanks Ivan.

Point taken on the .height vs .setHeight()... will take more notice of those JavaDocs in the future.

Thought I'd seen something about px vs pt somewhere - thanks for providing the link - makes sense.

How does the process of fixes work with RAP? Is the primary issue raised here (tablecolumn header text not inheriting table font) simple enough to be a quick fix, or will it be in RAP 2.0 M4..., or something else?

Just out of interest, who works on this code?  I know it is all open-source, but it seems that the reality is that there are just a handful of people (including yourself) who 'control' what actually happens, which is a good approach, as it avoids too many hands getting in each other's way.

I'm doing a lot of work right now on behalf of our company investigating use of RAP (and ultimately Tabris) in some products, and it would be useful to have an understanding about support, enhancements/fixes and future stability/commitment of RAP's (and Tabris') developers and sponsors...?  Probably not the place to ask these questions, so please PM me if you don't think it is appropriate to respond here.

Thanks, John
Comment 4 Ivan Furnadjiev CLA 2012-12-06 07:52:40 EST
(In reply to comment #3)
> How does the process of fixes work with RAP? Is the primary issue raised here
> (tablecolumn header text not inheriting table font) simple enough to be a quick
> fix, or will it be in RAP 2.0 M4..., or something else?
Fixed in master with commit 91e2642530d80e2d3a664ad668b0db898b14216d.
Comment 5 Ralf Sternberg CLA 2012-12-06 10:42:26 EST
(In reply to comment #3)
> Just out of interest, who works on this code?  I know it is all open-source,
> but it seems that the reality is that there are just a handful of people
> (including yourself) who 'control' what actually happens, which is a good
> approach, as it avoids too many hands getting in each other's way.
> 
> I'm doing a lot of work right now on behalf of our company investigating use
> of RAP (and ultimately Tabris) in some products, and it would be useful to
> have an understanding about support, enhancements/fixes and future
> stability/commitment of RAP's (and Tabris') developers and sponsors...? 
> Probably not the place to ask these questions, so please PM me if you don't
> think it is appropriate to respond here.

John,

thanks for your interest in RAP. A better place for questions or discussions that aren't related to an actual bug is the RAP forum [1]. You're right, RAP is mainly developed by a team at EclipseSource. As every project at Eclipse, we accept contributions, but reserve the responsibility for every bit that goes into the code base, to make sure that neither the stability nor the pedigree is put at risk. Professional services around RAP are available, see [2]. We're happy to hear from you!

[1] http://www.eclipse.org/forums/eclipse.technology.rap
[2] http://eclipse.org/rap/support/professional-services/
Comment 6 John Gymer CLA 2012-12-12 08:45:58 EST
Thanks Ralf.
I'm sure we'll be in touch over the coming months, particularly re Tabris.
Thanks for including the fix in Rap 2.0 M4 by the way. I'll look forward to getting that.
It isn't too urgent at the moment, but if I wanted to obtain and apply "commit 91e2642530d80e2d3a664ad668b0db898b14216d" now, how would I go about it? Sorry if I'm asking obvious questions, or questions that are answered elsewhere, but I've only been through the routes of obtaining milestone releases so far, and it would be interesting to understand the process required to obtain and apply fixes.
Thanks, John
Comment 7 Ralf Sternberg CLA 2012-12-12 09:22:17 EST
(In reply to comment #6)
John, you can also get the latest nightly build. See our download page [1] for the URLs.

[1] http://eclipse.org/rap/downloads/