Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How check a cell which only display part of content?
How check a cell which only display part of content? [message #1725300] Wed, 02 March 2016 10:54 Go to next message
neal zhang is currently offline neal zhangFriend
Messages: 45
Registered: July 2012
Member
Hi all,
i hope add a tooltiip for a cell which only display part of content(i mean end with "...") in nattable. is there a way which get it? (i don't want to add ToolTip in all of cells. so..). Same with Column head. is everyone know this?

Dirk, can you help me. Embarrassed
thank you.

[Updated on: Wed, 02 March 2016 10:55]

Report message to a moderator

Re: How check a cell which only display part of content? [message #1725309 is a reply to message #1725300] Wed, 02 March 2016 12:11 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Extend and override NatTableContentTooltip#getText() that only returns a value if the text rendered by the underlying painter ends with ... - otherwise return null
Re: How check a cell which only display part of content? [message #1725364 is a reply to message #1725309] Thu, 03 March 2016 03:06 Go to previous messageGo to next message
neal zhang is currently offline neal zhangFriend
Messages: 45
Registered: July 2012
Member
Hi Dirk, thank you for your reply, i don't describe this question very well, in fact, i try to extend the DefaultToolTip, and added nattable object for this tooltip. and override the getText() function. here i can get the cell really value by "this.natTable.getDataValueByPosition(col, row)". but i don't know how check " the text rendered by the underlying painter ends with ... "

i also checked NattableContentTooltip.java, we can get the " ILayerCell cell " and "ICellPainter painter", i don't found how get "Text rendered which end with...", can you describe some detail things, thank you very much.

Re: How check a cell which only display part of content? [message #1725383 is a reply to message #1725364] Thu, 03 March 2016 07:58 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Honestly I don't have a solution out of the box and would need to think about this and test for a while. But currently I don't have time for this.

Dependent on your configuration a simple solution could be to calculate the length of the text via GC and if it is bigger than the cell width, provide a tooltip. But that would not work in case you have line breaks for example.
You could also try to extend the TextCellPainter and connect that to your tooltip implementation and set values only in case the text is cut.
Re: How check a cell which only display part of content? [message #1725712 is a reply to message #1725383] Mon, 07 March 2016 08:47 Go to previous messageGo to next message
neal zhang is currently offline neal zhangFriend
Messages: 45
Registered: July 2012
Member
Hi Dirk,
Thank you very much. it works.
Re: How check a cell which only display part of content? [message #1767646 is a reply to message #1725712] Sat, 08 July 2017 09:54 Go to previous message
Bel Razom is currently offline Bel RazomFriend
Messages: 10
Registered: May 2017
Junior Member
Hello neal, could you share your solution?
Previous Topic:Row Reorder issue
Next Topic:How to show a tooltip over a sorting triangle image at a column header?
Goto Forum:
  


Current Time: Sat Apr 20 03:03:10 GMT 2024

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

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

Back to the top