Search in sources :

Example 11 with IDisplayConverter

use of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter in project nebula.widgets.nattable by eclipse.

the class DefaultExportFormatter method formatForExport.

@Override
public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
    Object dataValue = cell.getDataValue();
    IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
    if (displayConverter == null) {
        displayConverter = this.fallbackConverter;
    }
    return displayConverter.canonicalToDisplayValue(cell, configRegistry, dataValue);
}
Also used : IDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter)

Example 12 with IDisplayConverter

use of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter in project nebula.widgets.nattable by eclipse.

the class FilterRowDataProvider method saveState.

// Load/save state
@Override
public void saveState(String prefix, Properties properties) {
    Map<Integer, String> filterTextByIndex = new HashMap<Integer, String>();
    for (Integer columnIndex : this.filterIndexToObjectMap.keySet()) {
        final IDisplayConverter converter = this.configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex);
        String filterText = getFilterStringRepresentation(this.filterIndexToObjectMap.get(columnIndex), converter);
        // $NON-NLS-1$
        filterText = filterText.replace("|", PIPE_REPLACEMENT);
        filterTextByIndex.put(columnIndex, filterText);
    }
    String string = PersistenceUtils.mapAsString(filterTextByIndex);
    if (!ObjectUtils.isEmpty(string)) {
        properties.put(prefix + FilterRowDataLayer.PERSISTENCE_KEY_FILTER_ROW_TOKENS, string);
    }
}
Also used : HashMap(java.util.HashMap) IDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter)

Example 13 with IDisplayConverter

use of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter in project nebula.widgets.nattable by eclipse.

the class CheckBoxPainter method convertDataType.

protected Boolean convertDataType(ILayerCell cell, IConfigRegistry configRegistry) {
    if (cell.getDataValue() instanceof Boolean) {
        return (Boolean) cell.getDataValue();
    }
    IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
    Boolean convertedValue = null;
    if (displayConverter != null) {
        convertedValue = (Boolean) displayConverter.canonicalToDisplayValue(cell, configRegistry, cell.getDataValue());
    }
    if (convertedValue == null) {
        convertedValue = Boolean.FALSE;
    }
    return convertedValue;
}
Also used : IDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter)

Aggregations

IDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter)13 LabelStack (org.eclipse.nebula.widgets.nattable.layer.LabelStack)4 ILayerCell (org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell)2 BasicEventList (ca.odell.glazedlists.BasicEventList)1 CompositeMatcherEditor (ca.odell.glazedlists.matchers.CompositeMatcherEditor)1 MatcherEditor (ca.odell.glazedlists.matchers.MatcherEditor)1 TextMatcherEditor (ca.odell.glazedlists.matchers.TextMatcherEditor)1 ThresholdMatcherEditor (ca.odell.glazedlists.matchers.ThresholdMatcherEditor)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 ICSSValueConverter (org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverter)1 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)1 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)1 DefaultDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DefaultDisplayConverter)1 DisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter)1