Skip to content

Commit

Permalink
'#2163 Implements clear filter code to sync with clearAllFilters button.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdalla committed May 28, 2024
1 parent 70dd932 commit 1e535b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions iped-app/src/main/java/iped/app/ui/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
9 changes: 6 additions & 3 deletions iped-app/src/main/java/iped/app/ui/FiltersPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -377,7 +377,6 @@ public void updateUI() {

}

@Override
public void clearFilter() {
ckStructuredFilterer.setSelected(false);
ckStructuredFilterer.setBackground(ckStructuredFilterer.getParent().getBackground());
Expand All @@ -389,4 +388,8 @@ public void clearFilter() {
public CombinedFilterer getCombinedFilterer() {
return combinedFilterer;
}

public boolean isCombinedFiltererApplied() {
return ckStructuredFilterer.isSelected();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -48,6 +49,8 @@ public class CombinedFilterer implements IResultSetFilterer, IFilterChangeListen

private CombinedBitSet cbs;

private FiltersPanel filtersPanel;

@Override
public List getDefinedFilters() {
ArrayList<IFilter> result = new ArrayList<IFilter>();
Expand Down Expand Up @@ -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) {
Expand All @@ -560,8 +563,7 @@ public void onFilterChange(IMutableFilter filter) {

@Override
public void clearFilter() {
// TODO Auto-generated method stub

filtersPanel.clearFilter();
}

public void invalidateCache() {
Expand All @@ -572,4 +574,8 @@ public void setRootNode(OperandNode rootNode) {
this.rootNode = rootNode;
}

public void setFiltersPanel(FiltersPanel filtersPanel) {
this.filtersPanel = filtersPanel;
}

}

0 comments on commit 1e535b1

Please sign in to comment.