Search in sources :

Example 1 with FilterAppliedEvent

use of org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent in project nebula.widgets.nattable by eclipse.

the class FilterRowDataProvider method loadState.

@Override
public void loadState(String prefix, Properties properties) {
    this.filterIndexToObjectMap.clear();
    try {
        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 = this.configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.NORMAL, FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex);
            String filterText = filterTextByIndex.get(columnIndex);
            // $NON-NLS-1$
            filterText = filterText.replace(PIPE_REPLACEMENT, "|");
            this.filterIndexToObjectMap.put(columnIndex, getFilterFromString(filterText, converter));
        }
    } catch (Exception e) {
        // $NON-NLS-1$
        LOG.error("Error while restoring filter row text!", e);
    }
    this.filterStrategy.applyFilter(this.filterIndexToObjectMap);
    this.columnHeaderLayer.fireLayerEvent(new FilterAppliedEvent(this.columnHeaderLayer));
}
Also used : FilterAppliedEvent(org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent) IDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter)

Example 2 with FilterAppliedEvent

use of org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent in project nebula.widgets.nattable by eclipse.

the class FilterRowDataProvider method clearAllFilters.

/**
 * Clear all filters that are currently applied.
 */
public void clearAllFilters() {
    this.filterIndexToObjectMap.clear();
    this.filterStrategy.applyFilter(this.filterIndexToObjectMap);
    this.columnHeaderLayer.fireLayerEvent(new FilterAppliedEvent(this.columnHeaderLayer));
}
Also used : FilterAppliedEvent(org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent)

Example 3 with FilterAppliedEvent

use of org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent in project nebula.widgets.nattable by eclipse.

the class FilterRowDataProvider method setDataValue.

@Override
public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
    if (ObjectUtils.isNotNull(newValue)) {
        this.filterIndexToObjectMap.put(columnIndex, newValue);
    } else {
        this.filterIndexToObjectMap.remove(columnIndex);
    }
    this.filterStrategy.applyFilter(this.filterIndexToObjectMap);
    this.columnHeaderLayer.fireLayerEvent(new FilterAppliedEvent(this.columnHeaderLayer));
}
Also used : FilterAppliedEvent(org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent)

Aggregations

FilterAppliedEvent (org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent)3 IDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter)1