Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 581359

Summary: Support ContextualDisplayConverter for FILTER_DISPLAY_CONVERTER
Product: [Technology] NatTable Reporter: Dirk Fauth <dirk.fauth>
Component: GlazedLists ExtensionAssignee: Dirk Fauth <dirk.fauth>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.0.5   
Target Milestone: 2.1.0   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/199422
https://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/commit/?id=381fb194f968e5de1b0886f432c6a95dc4960bfd
Whiteboard:

Description Dirk Fauth CLA 2023-01-16 05:25:23 EST
It is possible to register an IDisplayConverter for FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER that converts the text for a filter in the datamodel to a string representation. Currently the IFilterStrategy implementations only call IDisplayConverter#canonicalToDisplayValue(Object) as the context, especially the ILayerCell, is not known.

There are some cases where it would be at least interesting to have access to the IConfigRegistry and the column index of the filter. The IConfigRegistry is available in the default IFilterStrategy implementations, only the ILayerCell can not be retrieved, as the IFilterStrategy does not know an ILayer.

A possible workaround would be to create a fake ILayerCell like this:

new LayerCell(null, columnIndex, 0)

The layer can be null as this is handled internally. The row index is not relevant for the filter row. The only really interesting information is the column index.

This change should have no impact on existing solutions, as ContextualDisplayConverter did not work, and in DisplayConverter implementations the method canonicalToDisplayValue(ILayerCell, IConfigRegistry, Object) forwards to canonicalToDisplayValue(Object).
Comment 1 Eclipse Genie CLA 2023-01-16 05:41:28 EST
New Gerrit change created: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/199422
Comment 3 Dirk Fauth CLA 2023-03-31 03:48:22 EDT
Fixed with 2.1.0