Class GroupByDisplayConverter<T>
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.data.convert.ContextualDisplayConverter
-
- org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDisplayConverter<T>
-
- Type Parameters:
T
- the type of the underlying data in theGroupByDataLayer
- All Implemented Interfaces:
IDisplayConverter
public class GroupByDisplayConverter<T> extends ContextualDisplayConverter
IDisplayConverter
that is used for conversion ofGroupByObject
s.Should be registered for the label
GroupByDataLayer.GROUP_BY_OBJECT
.It only returns a converted value in case of the tree column or a groupBy summary is configured. For this it searches for an underlying
IDisplayConverter
based on the GroupBy value or the summary column.- See Also:
GroupByDataLayer
,GroupByDataLayerConfiguration
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Integer,IDisplayConverter>
converterCache
protected GroupByDataLayer<T>
groupByDataLayer
protected Map<Integer,IDisplayConverter>
wrappedConverters
-
Constructor Summary
Constructors Constructor Description GroupByDisplayConverter(GroupByDataLayer<T> groupByDataLayer)
GroupByDisplayConverter(GroupByDataLayer<T> groupByDataLayer, Object defaultSummaryValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
canonicalToDisplayValue(ILayerCell cell, IConfigRegistry configRegistry, Object canonicalValue)
Convert backing data value to value to be displayed.void
clearConverterCache()
Clear the internal converter cache.Object
displayToCanonicalValue(ILayerCell cell, IConfigRegistry configRegistry, Object displayValue)
Convert from display value to value in the backing data structure.protected Object
getDisplayValue(ILayerCell cell, IConfigRegistry configRegistry, Object canonicalValue)
Searches for theIDisplayConverter
to use for the givenILayerCell
and converts the given canonical value to the display value using the found converter.void
registerUnderlyingDisplayConverter(int columnIndex, IDisplayConverter converter)
Registers a givenIDisplayConverter
for a column index.void
unregisterUnderlyingDisplayConverter(int columnIndex)
Unregister theIDisplayConverter
that is registered for the given column index.-
Methods inherited from class org.eclipse.nebula.widgets.nattable.data.convert.ContextualDisplayConverter
canonicalToDisplayValue, displayToCanonicalValue
-
-
-
-
Field Detail
-
wrappedConverters
protected final Map<Integer,IDisplayConverter> wrappedConverters
-
converterCache
protected final Map<Integer,IDisplayConverter> converterCache
-
groupByDataLayer
protected final GroupByDataLayer<T> groupByDataLayer
-
-
Constructor Detail
-
GroupByDisplayConverter
public GroupByDisplayConverter(GroupByDataLayer<T> groupByDataLayer)
- Parameters:
groupByDataLayer
- TheGroupByDataLayer
necessary to perform index based or content based operations.
-
GroupByDisplayConverter
public GroupByDisplayConverter(GroupByDataLayer<T> groupByDataLayer, Object defaultSummaryValue)
- Parameters:
groupByDataLayer
- TheGroupByDataLayer
necessary to perform index based or content based operations.defaultSummaryValue
- The value that will be shown in case the summary value is not calculated yet.
-
-
Method Detail
-
canonicalToDisplayValue
public Object canonicalToDisplayValue(ILayerCell cell, IConfigRegistry configRegistry, Object canonicalValue)
Description copied from interface:IDisplayConverter
Convert backing data value to value to be displayed. Typically converts to a String for display. Use this method for contextual conversion.Note that on returning a different type than String,
toString()
will be called on the returned object to render the value for displaying.- Specified by:
canonicalToDisplayValue
in interfaceIDisplayConverter
- Specified by:
canonicalToDisplayValue
in classContextualDisplayConverter
- Parameters:
cell
- TheILayerCell
whose canonical value should be converted.configRegistry
- TheIConfigRegistry
of the NatTable to which theILayerCell
belongs.canonicalValue
- The data value from the backing data.- Returns:
- The converted value to display.
-
displayToCanonicalValue
public Object displayToCanonicalValue(ILayerCell cell, IConfigRegistry configRegistry, Object displayValue)
Description copied from interface:IDisplayConverter
Convert from display value to value in the backing data structure.NOTE:
The type the display value is converted to must match the type in the setter of the backing bean/row object Use this method for contextual conversion.- Specified by:
displayToCanonicalValue
in interfaceIDisplayConverter
- Specified by:
displayToCanonicalValue
in classContextualDisplayConverter
- Parameters:
cell
- TheILayerCell
whose canonical value should be converted.configRegistry
- TheIConfigRegistry
of the NatTable to which theILayerCell
belongs.displayValue
- The display value that should be converted to the data value that matches the backing data.- Returns:
- The converted value to put to the backing data.
-
getDisplayValue
protected Object getDisplayValue(ILayerCell cell, IConfigRegistry configRegistry, Object canonicalValue)
Searches for theIDisplayConverter
to use for the givenILayerCell
and converts the given canonical value to the display value using the found converter.- Parameters:
cell
- TheILayerCell
for which the display value is asked.configRegistry
- TheConfigRegistry
necessary to retrieve theIDisplayConverter
.canonicalValue
- The canonical value to convert.- Returns:
- The canonical value converted to the display value.
-
registerUnderlyingDisplayConverter
public void registerUnderlyingDisplayConverter(int columnIndex, IDisplayConverter converter)
Registers a givenIDisplayConverter
for a column index. Only necessary to override the searching for aIDisplayConverter
that is registered for the column of the grouping.- Parameters:
columnIndex
- The column index for which the groupBy display converter should be overriden.converter
- TheIDisplayConverter
that should be used for converting the groupBy value of the given index.
-
unregisterUnderlyingDisplayConverter
public void unregisterUnderlyingDisplayConverter(int columnIndex)
Unregister theIDisplayConverter
that is registered for the given column index.- Parameters:
columnIndex
- The index for which the registeredIDisplayConverter
should be unregistered.
-
clearConverterCache
public void clearConverterCache()
Clear the internal converter cache. Needed in case of dynamical converter registry updates.
-
-