Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2024 Original authors and others.
* Copyright (c) 2012, 2025 Original authors and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -268,7 +268,13 @@ public void applyFilter(Map<Integer, Object> filterIndexToObjectMap) {
this.matcherEditor.getMatcherEditors().iterator();
while (existingMatcherEditors.hasNext()) {
final MatcherEditor<T> existingMatcherEditor = existingMatcherEditors.next();
if (!containsMatcherEditor(matcherEditors, existingMatcherEditor)) {
if (existingMatcherEditor instanceof DefaultGlazedListsFilterStrategy.ColumnSetMatcherEditor
|| !containsMatcherEditor(matcherEditors, existingMatcherEditor)) {
// always remove an existing
// ColumnSetMatcherEditor as a new one will be
// added if necessary
// done this way to avoid equals() checks based
// on the filter values
existingMatcherEditors.remove();
changed = true;
}
Expand All @@ -285,10 +291,9 @@ public void applyFilter(Map<Integer, Object> filterIndexToObjectMap) {

// If there was no change to the MatcherEditors but
// applyFilter() was called, probably the re-evaluation
// of the
// filter was requested. To trigger the re-evaluation we
// need to
// add a MatcherEditor that matches all.
// of the filter was requested. To trigger the
// re-evaluation we need to add a MatcherEditor that
// matches all.
if (!changed) {
this.matcherEditor.getMatcherEditors().add(this.matchAll);
this.matcherEditor.getMatcherEditors().remove(this.matchAll);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2024 Original authors and others.
* Copyright (c) 2012, 2025 Original authors and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -30,6 +30,7 @@
import java.util.Observer;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

import org.eclipse.nebula.widgets.nattable.command.DisposeResourcesCommand;
import org.eclipse.nebula.widgets.nattable.command.ILayerCommand;
Expand Down Expand Up @@ -62,7 +63,6 @@
import org.eclipse.swt.widgets.Display;

import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.FilterList;
import ca.odell.glazedlists.GlazedLists;
import ca.odell.glazedlists.TreeList;
import ca.odell.glazedlists.TreeList.ExpansionModel;
Expand Down Expand Up @@ -626,9 +626,9 @@ protected void updateTree() {
* caches
*/
if (GroupByDataLayer.this.groupByExpansionModel != null) {
FilterList<Object> groupByObjects = new FilterList<>(
GroupByDataLayer.this.treeList,
GroupByDataLayer.this.groupByMatcher);
List<Object> groupByObjects = this.treeList.stream()
.filter(t -> this.groupByMatcher.matches(t))
.collect(Collectors.toList());
GroupByDataLayer.this.groupByExpansionModel.cleanupCollapsed(groupByObjects);
}
});
Expand Down Expand Up @@ -1012,11 +1012,12 @@ public void cleanupCollapsed(Collection<Object> groupByObjects) {
*/
public List<T> getItemsInGroup(GroupByObject group) {
return this.itemsByGroup.computeIfAbsent(group, g -> {

this.eventList.getReadWriteLock().readLock().lock();
try {
FilterList<T> filterList = new FilterList<>(this.eventList, getGroupDescriptorMatcher(g, this.columnAccessor));
return new ArrayList<>(filterList);
Matcher<T> matcher = getGroupDescriptorMatcher(group, this.columnAccessor);
return this.eventList.stream()
.filter(t -> matcher.matches(t))
.collect(Collectors.toList());
} finally {
this.eventList.getReadWriteLock().readLock().unlock();
}
Expand Down