Examples of IDisplayConverter


Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

    public static String convertDataType(ILayerCell cell,
            IConfigRegistry configRegistry) {
        Object canonicalValue = cell.getDataValue();
        Object displayValue;

        IDisplayConverter displayConverter = configRegistry.getConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER, cell.getDisplayMode(),
                cell.getConfigLabels().getLabels());

        if (displayConverter != null) {
            displayValue = displayConverter.canonicalToDisplayValue(cell,
                    configRegistry, canonicalValue);
        } else {
            displayValue = canonicalValue;
        }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

     */
    @SuppressWarnings("rawtypes")
    @Override
    protected String getStringFromColumnObject(final int columnIndex,
            final Object object) {
        final IDisplayConverter displayConverter = this.configRegistry
                .getConfigAttribute(FILTER_DISPLAY_CONVERTER, NORMAL,
                        FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex);

        if (object instanceof Collection) {
            String result = ""; //$NON-NLS-1$
            Collection valueCollection = (Collection) object;
            for (Object value : valueCollection) {
                if (result.length() > 0) {
                    result += "|"; //$NON-NLS-1$
                }
                String convertedValue = displayConverter
                        .canonicalToDisplayValue(value).toString();
                if (convertedValue.isEmpty()) {
                    // for an empty String add the regular expression for empty
                    // String
                    convertedValue = "^$"; //$NON-NLS-1$
                }
                result += convertedValue;
            }
            return "(" + result + ")"; //$NON-NLS-1$//$NON-NLS-2$
        }

        return displayConverter.canonicalToDisplayValue(object).toString();
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

                        TEXT_DELIMITER, NORMAL, FILTER_ROW_COLUMN_LABEL_PREFIX
                                + columnIndex);
                TextMatchingMode textMatchingMode = configRegistry
                        .getConfigAttribute(TEXT_MATCHING_MODE, NORMAL,
                                FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex);
                IDisplayConverter displayConverter = configRegistry
                        .getConfigAttribute(FILTER_DISPLAY_CONVERTER, NORMAL,
                                FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex);
                Comparator comparator = configRegistry.getConfigAttribute(
                        FILTER_COMPARATOR, NORMAL,
                        FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex);
                final Function<T, Object> columnValueProvider = getColumnValueProvider(columnIndex);

                List<ParseResult> parseResults = FilterRowUtils.parse(
                        filterText, textDelimiter, textMatchingMode);

                EventList<MatcherEditor<T>> stringMatcherEditors = new BasicEventList<MatcherEditor<T>>();
                for (ParseResult parseResult : parseResults) {
                    try {
                        MatchType matchOperation = parseResult
                                .getMatchOperation();
                        if (matchOperation == MatchType.NONE) {
                            stringMatcherEditors.add(getTextMatcherEditor(
                                    columnIndex, textMatchingMode,
                                    displayConverter,
                                    parseResult.getValueToMatch()));
                        } else {
                            Object threshold = displayConverter
                                    .displayToCanonicalValue(parseResult
                                            .getValueToMatch());
                            matcherEditors.add(getThresholdMatcherEditor(
                                    columnIndex, threshold, comparator,
                                    columnValueProvider, matchOperation));
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

     *            The value set to the filter cell that needs to be converted
     * @return The String value for the given filter value.
     */
    protected String getStringFromColumnObject(final int columnIndex,
            final Object object) {
        final IDisplayConverter displayConverter = this.configRegistry
                .getConfigAttribute(FILTER_DISPLAY_CONVERTER, NORMAL,
                        FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex);
        return displayConverter.canonicalToDisplayValue(object).toString();
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

        if (selectedCells != null) {
            Set<Class> converterSet = new HashSet<Class>();

            for (ILayerCell selectedCell : selectedCells) {
                LabelStack labelStack = selectedCell.getConfigLabels();
                IDisplayConverter dataTypeConverter = configRegistry.getConfigAttribute(
                        CellConfigAttributes.DISPLAY_CONVERTER,
                        DisplayMode.EDIT,
                        labelStack.getLabels());
                if (dataTypeConverter != null) {
                    converterSet.add(dataTypeConverter.getClass());
                }
                if (converterSet.size() > 1)
                    return false;
            }
        }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

    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) {
            try {
                convertedValue = (Boolean) displayConverter
                        .canonicalToDisplayValue(cell, configRegistry,
                                cell.getDataValue());
            } catch (Exception e) {
                log.debug(e);
            }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

            String stringValue, Comparator<String> comparator,
            boolean caseSensitive, boolean wholeWord, boolean regex,
            int columnPosition, int rowPosition) {

        // Convert cell's data
        final IDisplayConverter displayConverter = configRegistry
                .getConfigAttribute(
                        CellConfigAttributes.DISPLAY_CONVERTER,
                        DisplayMode.NORMAL,
                        layer.getConfigLabelsByPosition(columnPosition,
                                rowPosition).getLabels());
        Object dataValue = null;
        if (displayConverter != null) {
            ILayerCell cell = layer.getCellByPosition(columnPosition,
                    rowPosition);
            if (cell != null) {
                dataValue = displayConverter.canonicalToDisplayValue(cell,
                        configRegistry, cell.getDataValue());
            }
        }

        // Compare with valueToMatch
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

    @Override
    public void saveState(String prefix, Properties properties) {
        Map<Integer, String> filterTextByIndex = new HashMap<Integer, String>();
        for (Integer columnIndex : filterIndexToObjectMap.keySet()) {
            final IDisplayConverter converter = configRegistry
                    .getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER,
                            DisplayMode.NORMAL,
                            FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
                                    + columnIndex);
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

            Object property = properties.get(prefix
                    + FilterRowDataLayer.PERSISTENCE_KEY_FILTER_ROW_TOKENS);
            Map<Integer, String> filterTextByIndex = PersistenceUtils
                    .parseString(property);
            for (Integer columnIndex : filterTextByIndex.keySet()) {
                final IDisplayConverter converter = configRegistry
                        .getConfigAttribute(
                                CellConfigAttributes.DISPLAY_CONVERTER,
                                DisplayMode.NORMAL,
                                FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
                                        + columnIndex);
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter

public class DefaultExportFormatter implements IExportFormatter {

    public Object formatForExport(ILayerCell cell,
            IConfigRegistry configRegistry) {
        Object dataValue = cell.getDataValue();
        IDisplayConverter displayConverter = configRegistry.getConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER, cell.getDisplayMode(),
                cell.getConfigLabels().getLabels());
        return displayConverter.canonicalToDisplayValue(dataValue);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.