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
GroupByObjects.
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.voidClear the internal converter cache.displayToCanonicalValue(ILayerCell cell, IConfigRegistry configRegistry, Object displayValue) Convert from display value to value in the backing data structure.protected ObjectgetDisplayValue(ILayerCell cell, IConfigRegistry configRegistry, Object canonicalValue) Searches for theIDisplayConverterto use for the givenILayerCelland converts the given canonical value to the display value using the found converter.voidregisterUnderlyingDisplayConverter(int columnIndex, IDisplayConverter converter) Registers a givenIDisplayConverterfor a column index.voidunregisterUnderlyingDisplayConverter(int columnIndex) Unregister theIDisplayConverterthat 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- TheGroupByDataLayernecessary to perform index based or content based operations.
-
GroupByDisplayConverter
- Parameters:
groupByDataLayer- TheGroupByDataLayernecessary 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:IDisplayConverterConvert 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:
canonicalToDisplayValuein interfaceIDisplayConverter- Specified by:
canonicalToDisplayValuein classContextualDisplayConverter- Parameters:
cell- TheILayerCellwhose canonical value should be converted.configRegistry- TheIConfigRegistryof the NatTable to which theILayerCellbelongs.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:IDisplayConverterConvert 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:
displayToCanonicalValuein interfaceIDisplayConverter- Specified by:
displayToCanonicalValuein classContextualDisplayConverter- Parameters:
cell- TheILayerCellwhose canonical value should be converted.configRegistry- TheIConfigRegistryof the NatTable to which theILayerCellbelongs.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 theIDisplayConverterto use for the givenILayerCelland converts the given canonical value to the display value using the found converter.- Parameters:
cell- TheILayerCellfor which the display value is asked.configRegistry- TheConfigRegistrynecessary to retrieve theIDisplayConverter.canonicalValue- The canonical value to convert.- Returns:
- The canonical value converted to the display value.
-
registerUnderlyingDisplayConverter
Registers a givenIDisplayConverterfor a column index. Only necessary to override the searching for aIDisplayConverterthat is registered for the column of the grouping.- Parameters:
columnIndex- The column index for which the groupBy display converter should be overriden.converter- TheIDisplayConverterthat should be used for converting the groupBy value of the given index.
-
unregisterUnderlyingDisplayConverter
public void unregisterUnderlyingDisplayConverter(int columnIndex) Unregister theIDisplayConverterthat is registered for the given column index.- Parameters:
columnIndex- The index for which the registeredIDisplayConvertershould be unregistered.
-
clearConverterCache
public void clearConverterCache()Clear the internal converter cache. Needed in case of dynamical converter registry updates.
-