I have a datagrid where some columns are displayed with a custom renderer to make the text in that cell look like traditional web page hyperlinks (i.e. blue color, underline, handcursor on hover, etc.). The renderer uses a Label, with the desired styling to make it look like a hyperlink.
I would like to have a way so that if a user has clicked the link, the color could be changed to make it look like a 'visited' link (for example, change the color to purple). However since the renderer is used in a datagrid which means that the renderer may be recycled/reused when scrolling, the information about whether or not the link has been clicked cannot be stored within the renderer. There isn't an easy way to store the visited status in the underlying data object either, because it is XML and because there may be any number of the fields in each row that could be displayed as hyperlinks.
Any ideas on ways this might be possible to do?
It depends on what the final goal is.
You can certainly create some record of links visited in your app via some Singleton or by subclassing the DataGrid and storing visited links there. That should be easy to do, but the set of visited links will not be kept between runs.
So then, you can store the set of links visited in a SharedObject and restore them again later. That’s also relatively easy, but more work.
Now if someone hits the same URL from the browser outside your app, the browser remembers, but your app won’t know that. I believe that is still a hard problem to get the visited links from the browser.