Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Putting multiple hyperlinks inside a cell(How to put a set of clickable texts inside a cell.)
icon5.gif  Putting multiple hyperlinks inside a cell [message #1560296] Mon, 12 January 2015 14:14 Go to next message
Xavier Wolfs is currently offline Xavier WolfsFriend
Messages: 10
Registered: January 2015
Junior Member
Hi,

We have just started implementing NatTable and we are very pleased by the performance increase we are seeing. However, we are having trouble implementing a specific functionality.

What we would like is to have clickable text inside a cell, which would then reference a row in the table which we select and bring into view. Basically, something like:

Row # | Name # | Related links
----------------------------------------------------------------------------------------
Row 1 | Name 1 | Name 2 Name 3
Row 2 | Name 2 | Name 1
Row 3 | Name 3 | Name 1

By clicking on the text "Name 3" in the cell on Row 1, Row 3 would be selected.

How we did this previously using TreeViewer, is by determing the style range that fits the selected character position to determine to text that was clicked. Is there simpler way to add these kind of hyperlinks in a cell using NatTable? Putting the underlying data (where to link too) isn't an issue, it's getting the cell to recognize the part of text that was selected that is proving difficult.

I found a topic dicussing this topic at www.eclipse.org/forums/index.php/t/459185/, but that topic seemed to only discuss a single hyperlink.
Re: Putting multiple hyperlinks inside a cell [message #1560464 is a reply to message #1560296] Mon, 12 January 2015 16:14 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
First, NatTable does not support styling words within a text differently like you can do this using a "style range" similar you did in a TreeViewer. This can be achieved by implementing a custom TextPainter that adds that support somehow.

For retrieving the clicked word you need to implement some custom MouseEventMatcher that is able to determine the text that is rendered at the click position. Surely possible but not a trivial task I guess.
Re: Putting multiple hyperlinks inside a cell [message #1561694 is a reply to message #1560464] Tue, 13 January 2015 08:38 Go to previous messageGo to next message
Xavier Wolfs is currently offline Xavier WolfsFriend
Messages: 10
Registered: January 2015
Junior Member
Thank you for your quick reply Dirk.

We were hoping for a different reply of course, but were kind of expecting it. We'll probably change the functionality of the cell to no longer work through hyperlinks, but rather something else (a combobox comes to mind). Should we decide to implement a custom TextPainter or MouseEventMatcher however, I'll let you know.
Re: Putting multiple hyperlinks inside a cell [message #1599193 is a reply to message #1561694] Tue, 03 February 2015 12:54 Go to previous messageGo to next message
Georgian Grec is currently offline Georgian GrecFriend
Messages: 5
Registered: July 2014
Junior Member
Hello Xavier

If you guys find an elegant solution to this hyperlink problem, please post it here. We're struggling with the exact same issue, and cannot find a workaround.

An option was adding SWT Link widgets in each cells in a column, but that also has some limitations.

Looking forward to hearing from you. Thanks.
Re: Putting multiple hyperlinks inside a cell [message #1623742 is a reply to message #1599193] Thu, 19 February 2015 09:47 Go to previous message
Xavier Wolfs is currently offline Xavier WolfsFriend
Messages: 10
Registered: January 2015
Junior Member
Hello Georgian,

I completely forgot to update this thread with what we ended up doing.

We ended up not using hyperlinks, but making use of the hoverlayer to implement visually pleasant clickable cell. The cell is styled to look like a hyperlink (blue letters). When a user hovers over the cell, it changes its background color to a light gray. On a click, we then handle the CellEvent via a LayerListener and handle the mouseclick accordingly.

Hope this helps.
Previous Topic:Freeze and Unfreeze column
Next Topic:Editable NatTable for GlazedLists?
Goto Forum:
  


Current Time: Tue Mar 09 06:56:37 GMT 2021

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

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

Back to the top