Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » TableColumn and Table Fonts(How to change TableColumn Font without CSS)
TableColumn and Table Fonts [message #988909] Mon, 03 December 2012 11:32 Go to next message
John Gymer is currently offline John Gymer
Messages: 185
Registered: November 2012
Location: UK
Senior Member
I see that the .SetFont method is not available/implemented for TableColumn objects.

This is the same in SWT as RWT/RAP.

Ok, but in SWT, if I use .SetFont on the Table itself, that font is also used for the TableColumn headers. I would like to duplicate this behaviour in RWT/RAP, but presently the TableColumn header appears to be using the default theme font rather than honouring, or inheriting the Table's font.

Is this deliberate behaviour, or should the TableColumn inherit the Table's font?

As it is a difference between SWT vs RWT/RAP, it is not desirable, as I want to single-source my application for both targets.

I don't particularly want to resort to CSS theme in this instance, although I see that this is a possible solution - my application is structured such that programmatic setting of Table (and thus TableColumn) fonts is a requirement.

Is it a bug, deliberate, or just a planned difference?
Any ideas appreciated!
John



---
Just because you can doesn't mean you should
Re: TableColumn and Table Fonts [message #989226 is a reply to message #988909] Wed, 05 December 2012 04:52 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 355
Registered: July 2009
Senior Member
Hi.

Differences between SWT and RWT are rarely deliberate. Could you please
open an entry on the RAP Bugzilla for this? Thanks!

Also, what RAP version are you working on?

Greetings,
Tim


Am 03.12.2012 17:32, schrieb John Gymer:
> I see that the .SetFont method is not available/implemented for
> TableColumn objects.
>
> This is the same in SWT as RWT/RAP.
>
> Ok, but in SWT, if I use .SetFont on the Table itself, that font is also
> used for the TableColumn headers. I would like to duplicate this
> behaviour in RWT/RAP, but presently the TableColumn header appears to be
> using the default theme font rather than honouring, or inheriting the
> Table's font.
>
> Is this deliberate behaviour, or should the TableColumn inherit the
> Table's font?
>
> As it is a difference between SWT vs RWT/RAP, it is not desirable, as I
> want to single-source my application for both targets.
>
> I don't particularly want to resort to CSS theme in this instance,
> although I see that this is a possible solution - my application is
> structured such that programmatic setting of Table (and thus
> TableColumn) fonts is a requirement.
>
> Is it a bug, deliberate, or just a planned difference?
> Any ideas appreciated!
> John
>
>

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: TableColumn and Table Fonts [message #989229 is a reply to message #989226] Wed, 05 December 2012 05:03 Go to previous messageGo to next message
John Gymer is currently offline John Gymer
Messages: 185
Registered: November 2012
Location: UK
Senior Member
Thanks Tim... I'll see if I can figure out how to raise an issue in BugZilla for RAP.
I'm using RAP 2.0 M3.
John


---
Just because you can doesn't mean you should
Re: TableColumn and Table Fonts [message #989238 is a reply to message #989229] Wed, 05 December 2012 05:20 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1286
Registered: July 2009
Senior Member

> Thanks Tim... I'll see if I can figure out how to raise an issue in
> BugZilla for RAP.

See http://eclipse.org/rap/bugs/

Thanks, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: TableColumn and Table Fonts [message #989241 is a reply to message #989238] Wed, 05 December 2012 05:36 Go to previous messageGo to next message
John Gymer is currently offline John Gymer
Messages: 185
Registered: November 2012
Location: UK
Senior Member
Thanks Ralf... found it... raised!

Actually raised a couple of other points in there too (related under the same bug report), as my example highlighted some work-arounds that I've put in place to get around other differences... these are detailed in the bug report, but just for completeness I thought it may be useful to add them here too...

...
fontData = new FontData();
if (runningAsSWT)
	fontData.height = myFontSize;
else {
	fontData.setHeight(myFontSize+RWTFontAdjust);
}
fontData.setStyle(myFontStyle);
fontData.setName(myFontType);
font = new Font(display, fontData);
myTable.setFont(font);
...


Point 1: Note how with SWT I have to use the .height property, but with RWT/RAP I need to use the .setHeight() method (RWT will take exception if I try to use .height property).

Point 2: Note how I am adjusting the font size for RWT by adding a fixed amount (RWTFontAdjust variable) because SWT appears to use 'pt' and RWT appears to use 'px', which are not the same. My solution appears to be ok for some browsers and some DPIs, but not all... so it would be good to know if there is a better calculation to use here?

Thanks, John


---
Just because you can doesn't mean you should
Re: TableColumn and Table Fonts [message #989252 is a reply to message #989241] Wed, 05 December 2012 06:02 Go to previous messageGo to next message
John Gymer is currently offline John Gymer
Messages: 185
Registered: November 2012
Location: UK
Senior Member
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 in RWT. That's fine - I'll just use .setHeight() for everything!

---
Just because you can doesn't mean you should

[Updated on: Wed, 05 December 2012 06:04]

Report message to a moderator

Re: TableColumn and Table Fonts [message #989535 is a reply to message #989252] Thu, 06 December 2012 11:28 Go to previous message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1286
Registered: July 2009
Senior Member

On 12/05/2012 12:02 PM, John Gymer wrote:
> Actually, quite 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!

You should not use the height property in SWT as well. The JavaDoc
clearly states: "<b>IMPORTANT:</b> This field is <em>not</em> part of
the SWT public API ..."

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Hide Empty Submenus
Next Topic:RAP 2.0 tool issue
Goto Forum:
  


Current Time: Sat Apr 19 00:24:59 EDT 2014

Powered by FUDForum. Page generated in 0.01762 seconds