Skip to content

Commit

Permalink
'#2163 Code to avoid enabling filterer from filterpanel without any
Browse files Browse the repository at this point in the history
defined filter defined by the filterer before.
  • Loading branch information
patrickdalla committed Jun 4, 2024
1 parent 32c22bd commit c324e7e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions iped-app/src/main/java/iped/app/ui/FiltersPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ public void actionPerformed(ActionEvent e) {
filterer.restoreDefinedFilters(clastFilters);
App.get().getAppListener().updateFileListing();
App.get().filtersPanel.updateUI();
} else {
CheckBoxTreeCellRenderer.TreeCellCheckBoxActionEvent te = (CheckBoxTreeCellRenderer.TreeCellCheckBoxActionEvent) e;
if (te.getCheckBox().isSelected()) {
te.getCheckBox().setSelected(false);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ public String getValueString(Object value) {
return value.toString();
}

public class TreeCellCheckBoxActionEvent extends ActionEvent {
JCheckBox checkBox = null;

public TreeCellCheckBoxActionEvent(JCheckBox checkBox, Object source, int id, String command) {
super(source, id, command);
this.checkBox = checkBox;
}

public JCheckBox getCheckBox() {
return checkBox;
}

}

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {

Expand Down Expand Up @@ -87,8 +101,9 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean
checkbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
e.setSource(value);
al.actionPerformed(e);
al.actionPerformed(
new TreeCellCheckBoxActionEvent(checkbox, value, e.getID(),
e.getActionCommand()));
}
});
}
Expand Down

0 comments on commit c324e7e

Please sign in to comment.