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 the GroupByDataLayer
All Implemented Interfaces:
IDisplayConverter

public class GroupByDisplayConverter<T> extends ContextualDisplayConverter
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.

See Also:
  • Field Details

  • Constructor Details

    • GroupByDisplayConverter

      public GroupByDisplayConverter(GroupByDataLayer<T> groupByDataLayer)
      Parameters:
      groupByDataLayer - The GroupByDataLayer necessary to perform index based or content based operations.
    • GroupByDisplayConverter

      public GroupByDisplayConverter(GroupByDataLayer<T> groupByDataLayer, Object defaultSummaryValue)
      Parameters:
      groupByDataLayer - The GroupByDataLayer 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 interface IDisplayConverter
      Specified by:
      canonicalToDisplayValue in class ContextualDisplayConverter
      Parameters:
      cell - The ILayerCell whose canonical value should be converted.
      configRegistry - The IConfigRegistry of the NatTable to which the ILayerCell 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 interface IDisplayConverter
      Specified by:
      displayToCanonicalValue in class ContextualDisplayConverter
      Parameters:
      cell - The ILayerCell whose canonical value should be converted.
      configRegistry - The IConfigRegistry of the NatTable to which the ILayerCell 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 the IDisplayConverter to use for the given ILayerCell and converts the given canonical value to the display value using the found converter.
      Parameters:
      cell - The ILayerCell for which the display value is asked.
      configRegistry - The ConfigRegistry necessary to retrieve the IDisplayConverter.
      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 given IDisplayConverter for a column index. Only necessary to override the searching for a IDisplayConverter that is registered for the column of the grouping.
      Parameters:
      columnIndex - The column index for which the groupBy display converter should be overriden.
      converter - The IDisplayConverter that should be used for converting the groupBy value of the given index.
    • unregisterUnderlyingDisplayConverter

      public void unregisterUnderlyingDisplayConverter(int columnIndex)
      Unregister the IDisplayConverter that is registered for the given column index.
      Parameters:
      columnIndex - The index for which the registered IDisplayConverter should be unregistered.
    • clearConverterCache

      public void clearConverterCache()
      Clear the internal converter cache. Needed in case of dynamical converter registry updates.