Search in sources :

Example 1 with RecordRowPredicateRowFilter

use of com.revolsys.swing.table.record.filter.RecordRowPredicateRowFilter in project com.revolsys.open by revolsys.

the class RecordLayerTableModel method setFilter.

public void setFilter(final Condition filter) {
    Invoke.later(() -> {
        final Condition filter2;
        if (filter == null) {
            filter2 = Condition.ALL;
        } else {
            filter2 = filter;
        }
        if (!DataType.equal(filter2, this.filter)) {
            final Object oldValue = this.filter;
            this.filter = filter2;
            if (Property.isEmpty(filter2)) {
                this.rowFilterCondition = null;
            } else {
                this.rowFilterCondition = new RecordRowPredicateRowFilter(filter2);
                if (!DataType.equal(oldValue, filter2)) {
                    this.filterHistory.remove(filter2);
                    this.filterHistory.addFirst(filter2);
                    while (this.filterHistory.size() > 20) {
                        this.filterHistory.removeLast();
                    }
                    firePropertyChange("hasFilterHistory", false, true);
                }
            }
            if (isSortable()) {
                final RecordLayerTable table = getTable();
                table.setRowFilter(this.rowFilterCondition);
            } else {
                refresh();
            }
            firePropertyChange("filter", oldValue, this.filter);
            final boolean hasFilter = isHasFilter();
            firePropertyChange("hasFilter", !hasFilter, hasFilter);
        }
    });
}
Also used : Condition(com.revolsys.record.query.Condition) RecordRowPredicateRowFilter(com.revolsys.swing.table.record.filter.RecordRowPredicateRowFilter) RecordLayerTable(com.revolsys.swing.map.layer.record.table.RecordLayerTable)

Aggregations

Condition (com.revolsys.record.query.Condition)1 RecordLayerTable (com.revolsys.swing.map.layer.record.table.RecordLayerTable)1 RecordRowPredicateRowFilter (com.revolsys.swing.table.record.filter.RecordRowPredicateRowFilter)1