From 1e535b135f29a9c0689edc22d0c97c1cef00059b Mon Sep 17 00:00:00 2001 From: "patrick.pdb" Date: Tue, 28 May 2024 11:42:48 -0400 Subject: [PATCH] '#2163 Implements clear filter code to sync with clearAllFilters button. --- iped-app/src/main/java/iped/app/ui/App.java | 1 + iped-app/src/main/java/iped/app/ui/FiltersPanel.java | 9 ++++++--- .../app/ui/filterdecisiontree/CombinedFilterer.java | 12 +++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/iped-app/src/main/java/iped/app/ui/App.java b/iped-app/src/main/java/iped/app/ui/App.java index 268fa4f6b5..71efee05f3 100644 --- a/iped-app/src/main/java/iped/app/ui/App.java +++ b/iped-app/src/main/java/iped/app/ui/App.java @@ -826,6 +826,7 @@ public void accept(IFilterer filterer) { }); filtersPanel.install(filterManager); + clearAllFilters.addClearListener(filtersPanel.getCombinedFilterer()); filtersPanel.updateUI(); hitsTable.getSelectionModel().addListSelectionListener(new HitsTableListener(TextViewer.font)); diff --git a/iped-app/src/main/java/iped/app/ui/FiltersPanel.java b/iped-app/src/main/java/iped/app/ui/FiltersPanel.java index 600dd82f15..b4b103c474 100644 --- a/iped-app/src/main/java/iped/app/ui/FiltersPanel.java +++ b/iped-app/src/main/java/iped/app/ui/FiltersPanel.java @@ -41,12 +41,11 @@ import iped.app.ui.filterdecisiontree.OperandNode.Operand; import iped.app.ui.filterdecisiontree.OperandPopupMenu; import iped.app.ui.filters.FilterTransferHandler; -import iped.viewers.api.ClearFilterListener; import iped.viewers.api.IFilter; import iped.viewers.api.IFilterer; import iped.viewers.api.IMiniaturizable; -public class FiltersPanel extends JPanel implements ClearFilterListener +public class FiltersPanel extends JPanel { private JTree filtersTree; private JScrollPane filtersTreePane; @@ -165,6 +164,7 @@ public void mouseMoved(MouseEvent e) { filtersTree.setModel(new FiltersTreeModel(filterManager.getFilterers())); combinedFilterer = new CombinedFilterer(); + combinedFilterer.setFiltersPanel(this); combinedFilterer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -377,7 +377,6 @@ public void updateUI() { } - @Override public void clearFilter() { ckStructuredFilterer.setSelected(false); ckStructuredFilterer.setBackground(ckStructuredFilterer.getParent().getBackground()); @@ -389,4 +388,8 @@ public void clearFilter() { public CombinedFilterer getCombinedFilterer() { return combinedFilterer; } + + public boolean isCombinedFiltererApplied() { + return ckStructuredFilterer.isSelected(); + } } \ No newline at end of file diff --git a/iped-app/src/main/java/iped/app/ui/filterdecisiontree/CombinedFilterer.java b/iped-app/src/main/java/iped/app/ui/filterdecisiontree/CombinedFilterer.java index cd759101da..7a7e54d5b7 100644 --- a/iped-app/src/main/java/iped/app/ui/filterdecisiontree/CombinedFilterer.java +++ b/iped-app/src/main/java/iped/app/ui/filterdecisiontree/CombinedFilterer.java @@ -18,6 +18,7 @@ import iped.app.ui.App; import iped.app.ui.CaseSearcherFilter; +import iped.app.ui.FiltersPanel; import iped.app.ui.filterdecisiontree.OperandNode.Operand; import iped.data.IItemId; import iped.engine.data.IPEDMultiSource; @@ -48,6 +49,8 @@ public class CombinedFilterer implements IResultSetFilterer, IFilterChangeListen private CombinedBitSet cbs; + private FiltersPanel filtersPanel; + @Override public List getDefinedFilters() { ArrayList result = new ArrayList(); @@ -545,7 +548,7 @@ public boolean hasFilters() { @Override public boolean hasFiltersApplied() { - return rootNode.getChildren().size() > 0; + return rootNode.getChildren().size() > 0 && filtersPanel.isCombinedFiltererApplied(); } public void invertPreCached(IFilter op) { @@ -560,8 +563,7 @@ public void onFilterChange(IMutableFilter filter) { @Override public void clearFilter() { - // TODO Auto-generated method stub - + filtersPanel.clearFilter(); } public void invalidateCache() { @@ -572,4 +574,8 @@ public void setRootNode(OperandNode rootNode) { this.rootNode = rootNode; } + public void setFiltersPanel(FiltersPanel filtersPanel) { + this.filtersPanel = filtersPanel; + } + }