|Re: MouseOver, MouseOut listeners for Tablecells possible? [message #986605 is a reply to message #986515]
||Wed, 21 November 2012 07:52
| Dirk Fauth
Registered: July 2012
glad to hear you found a solution. Although IMHO this is more a workaround and should be integrated into NatTable. Nevertheless, it works!
In NatTable we have the concept of commands and events. To keep it short, if you want to repaint only a cell if something has changed, you should fire a CellVisualChangeEvent. But you need to know that events are propagated the layer stack upwards. So to inform all layers about the change, you'll need to fire the event on the lowest layer (mostly the DataLayer is a good choice).
I'm not quite sure what you mean by "navigate more precisely, than on table-cell level". You can get the ILayerCell by calling this:
ILayerCell cell = natTable.getCellByPosition(col, row);
Having the ILayerCell you are able to get a lot of information. The ILayerCell comes with some information on the cell itself. There are also some helper classes to extract information associated with the cell. Note that you always need the current ConfigRegistry instance to do this
//get the foreground style information for a cell
IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry);
Color fg = cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR);
//get the cell painter used to render a cell
ICellPainter cellPainter = cell.getLayer().getCellPainter(cell.getColumnPosition(), cell.getRowPosition(), cell, configRegistry);
These code fragments are used within the NatTable framework itself. But I'm not sure why you would need this. Setting these values programmatically shouldn't work I guess. The concept for styling and all other configurations is label based. I haven't tried that yet, and possibly this doesn't work because of the current concept on interpreting the layer stack, but maybe you could temporarily add a special label to the label stack of the ILayerCell to change the rendering on mouse over.
Powered by FUDForum
. Page generated in 0.16056 seconds