Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Changing Font type of NatTable header dynamically(MakingFont type of NatTable header as BOLD and NON-BOLD dynamically)
Changing Font type of NatTable header dynamically [message #1810189] Fri, 02 August 2019 14:03 Go to next message
Sharmila Naik is currently offline Sharmila NaikFriend
Messages: 6
Registered: May 2019
Junior Member
Hi Dirk,

We are using NatTable to display table header and table data.
Our requirement is to change the font type of NATTable heder dynamically based on user's selection.

For instance, NATTable header for one of the columns is as "System\Sub-system\Component" . User clicks on some menu in the application and selects option as "System". Then the NatTable header for this column should show System (BOLD FONT)\Sub-system\Component. Likewise if user selects value as "Component" then the header should display only Component in bold for string : "System\Sub-system\Component.

So value of header should change dynamically depending upon user selection.

Will this be possible to achieve using RichTextCellPainter?

Thanks & Regards,
Sharmila
Re: Changing Font type of NatTable header dynamically [message #1810191 is a reply to message #1810189] Fri, 02 August 2019 15:41 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2814
Registered: July 2012
Senior Member
If you want to show different fonts in one cell, then you either use the RichTextCellPainter or you create a custom painter that supports this.
Re: Changing Font type of NatTable header dynamically [message #1810224 is a reply to message #1810191] Mon, 05 August 2019 10:15 Go to previous messageGo to next message
Sharmila Naik is currently offline Sharmila NaikFriend
Messages: 6
Registered: May 2019
Junior Member
Hi Dirk,
Thank you for your reply.

1) I tried with custom painter with graphics object to paint the string in required format. Example : system/sub-system/component.
But the string remains in this format for few seconds then comes back to its normal plain format. I could not figure out why is it reverting back to plain format.
2) I also tried using RichTextCellPainter. But for me it displayed the string with html tags. May be I am missing something in the implementation which I need to check.

Also, I want to ask few questions,
1) When we register the style to text , it is applied to the entire cell. How do we define that one style for specific text and other style for rest of the text within the same cell?
2) Also, in our case the text to be shown bold is not pre-defined. This is decided at runtime depending upon the user's selection. We define cell attributes using IConfigRegistry.
Can we re-configure the cell attributes at run time?

Please provide your valuable inputs.
Thanks,
Sharmila

Re: Changing Font type of NatTable header dynamically [message #1810236 is a reply to message #1810224] Mon, 05 August 2019 15:43 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2814
Registered: July 2012
Senior Member
If you see html tags you probably haven't registered the RichTextCellPainter correctly.
Yes you can change configuration attributes at runtime.
And I would suggest to register a display converter that adds the html tags at runtime based on the user selection. We do the same in the single field search example.
Re: Changing Font type of NatTable header dynamically [message #1810270 is a reply to message #1810236] Tue, 06 August 2019 10:02 Go to previous message
Sharmila Naik is currently offline Sharmila NaikFriend
Messages: 6
Registered: May 2019
Junior Member
Hi Dirk,
Thank you so much for your guidance.

It worked with custom painter and re-configuring attributes at run time.
Thanks again!

Regards,
Sharmila
Previous Topic:SelectAll does not select all rows [solved]
Next Topic:Focus next widget below NatTable
Goto Forum:
  


Current Time: Sun Jun 20 08:10:14 GMT 2021

Powered by FUDForum. Page generated in 0.02012 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top