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
IDisplayConverter
that is used for conversion of
GroupByObject
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Integer,
IDisplayConverter> protected final GroupByDataLayer<T>
protected final Map<Integer,
IDisplayConverter> -
Constructor Summary
ConstructorsConstructorDescriptionGroupByDisplayConverter
(GroupByDataLayer<T> groupByDataLayer) GroupByDisplayConverter
(GroupByDataLayer<T> groupByDataLayer, Object defaultSummaryValue) -
Method Summary
Modifier and TypeMethodDescriptioncanonicalToDisplayValue
(ILayerCell cell, IConfigRegistry configRegistry, Object canonicalValue) Convert backing data value to value to be displayed.void
Clear the internal converter cache.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 Details
-
wrappedConverters
-
converterCache
-
groupByDataLayer
-
-
Constructor Details
-
GroupByDisplayConverter
- Parameters:
groupByDataLayer
- TheGroupByDataLayer
necessary to perform index based or content based operations.
-
GroupByDisplayConverter
- 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 Details
-
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
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.
-