Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » StyledText in TextPainter
StyledText in TextPainter [message #1744066] Thu, 22 September 2016 07:13 Go to next message
Nico Linder is currently offline Nico LinderFriend
Messages: 8
Registered: June 2016
Junior Member
Hello,

we wondered, why there is a Text in the TextPainter and not a StyledText. Are there any reasons for that?

Thanks
Nico Linder
Re: StyledText in TextPainter [message #1744071 is a reply to message #1744066] Thu, 22 September 2016 07:53 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2624
Registered: July 2012
Senior Member
I don't know what you mean. Neither TextPainter nor AbstractTextPainter use Text. It is a painter no control.
Re: StyledText in TextPainter [message #1744092 is a reply to message #1744071] Thu, 22 September 2016 10:13 Go to previous messageGo to next message
Nico Linder is currently offline Nico LinderFriend
Messages: 8
Registered: June 2016
Junior Member
I'm very sorry, I worked on a painter and got confused with the class names for a moment.
I meant the TextCellEditor.
Re: StyledText in TextPainter [message #1744101 is a reply to message #1744092] Thu, 22 September 2016 10:42 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2624
Registered: July 2012
Senior Member
Why should there be a StyledText in TextCellEditor? The TextPainter can not render styled text, so it doesn't make sense to support styled text editing. Or to make it more clear, what you are styling in a StyledText can't be interpreted by the TextPainter. So I don't see a reason for using StyledText.

On the other hand, if you want to use StyledText, feel free to implement a custom editor. Should be straight forward with the framework.

BTW, since 1.5 we have a RichTextPainter and RichTextCellEditor that operate via HTML for styling text. It can be found in the Nebula Extension.
Re: StyledText in TextPainter [message #1751631 is a reply to message #1744101] Thu, 12 January 2017 05:58 Go to previous messageGo to next message
Joachim Fox is currently offline Joachim FoxFriend
Messages: 5
Registered: January 2011
Junior Member
Hi,

I have the need for an editor and painter which support links (which the RichTextEditor/Painter does not). So I thought of a StyledText-like editor/painter, which is however also not yet supported.

When digging a bit deeper into the implementation to see what it would need to make links working, I think I understood the following:


    to implement linking, somehow I have to remember the area that should be responsive to the mouse, and a link target ('href') associated with this area

    during the painting process, I could compute these areas

    I cannot store them in the painter, however, since painters are not associated with the cell

    the cell is created on the fly, so I cannot store it there, eiter


I currently have two ideas how to do it:

    store it somehow in the data associated with the cell, and therefore I would make the users via the data providers responsible for storing the data. For example, I could create a new interface ICellPainterData which gives access both to the 'real' data and to the painter data. It doesn't feel like the best way to do it (because it requires the users of the NatTable to store internal data), but that's the best (easiest) idea I had so far.

    Probably however it is best to store the data in the painter itself, somehow in a data type which stores objects based on cell row/colum indices...


Would you have alternative suggestions?

Thank you!
Joachim

[Updated on: Thu, 12 January 2017 06:50]

Report message to a moderator

Re: StyledText in TextPainter [message #1751642 is a reply to message #1751631] Thu, 12 January 2017 07:46 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2624
Registered: July 2012
Senior Member
Sorry I don't get your point. Do you want to support links in a text or only a text that is itself a link?

If there should be only a text shown as link, there should be easier ways to achieve this. If the link should be part of a longer text, I would suggest to try to extend the RichTextPainter instead of hacking in NatTable. AFAIK the Papyrus team is currently working on adding link support in Nebula RichText.
Re: StyledText in TextPainter [message #1751709 is a reply to message #1751642] Thu, 12 January 2017 18:26 Go to previous message
Joachim Fox is currently offline Joachim FoxFriend
Messages: 5
Registered: January 2011
Junior Member
Hi,

thank you for the Papyrus hint. The link should be part of a longer text, the text should be able to contain more than one hint, and potentially also support other features (e.g. mouse over/tooltips) based on the location of the mouse pointer over the cell. Therefore, the 'active regions' of the cell need to be stored to be accessible for the UI bindings.

I'll have a look at what Papyrus is doing and how the RichText feature could be extended.

Regards!
Previous Topic:Get index of currently selected column from within custom selection binding
Next Topic:Key navigation not "active" when programmatically focusing NatTable Control
Goto Forum:
  


Current Time: Fri Nov 16 08:07:40 GMT 2018

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

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

Back to the top