6639 fix appearance of past occrrurences filter

This commit is contained in:
William Schaefer 2020-08-17 10:06:59 -04:00
parent e2a7b72525
commit d0be74fc65
2 changed files with 7 additions and 14 deletions

View File

@ -39,12 +39,11 @@ public class DomainFilterPanel extends AbstractFiltersPanel {
addFilter(new ArtifactTypeFilterPanel(), false, null, 1); addFilter(new ArtifactTypeFilterPanel(), false, null, 1);
addFilter(new DateFilterPanel(), false, null, 1); addFilter(new DateFilterPanel(), false, null, 1);
int[] pastOccurrencesIndices; int[] pastOccurrencesIndices;
if (!CentralRepository.isEnabled()) { if (CentralRepository.isEnabled()) {
pastOccurrencesIndices = new int[]{0};
} else {
pastOccurrencesIndices = new int[]{2, 3, 4}; pastOccurrencesIndices = new int[]{2, 3, 4};
addFilter(new PastOccurrencesFilterPanel(), true, pastOccurrencesIndices, 0);
} }
addFilter(new PastOccurrencesFilterPanel(), true, pastOccurrencesIndices, 0);
addPanelsToScrollPane(domainFiltersSplitPane); addPanelsToScrollPane(domainFiltersSplitPane);
} }

View File

@ -38,15 +38,9 @@ final class PastOccurrencesFilterPanel extends AbstractDiscoveryFilterPanel {
*/ */
PastOccurrencesFilterPanel() { PastOccurrencesFilterPanel() {
initComponents(); initComponents();
setUpFrequencyFilter(ResultType.FILE); setUpFrequencyFilter();
}
/**
* Creates new form PastOccurrencesFilterPanel.
*/
PastOccurrencesFilterPanel(ResultType type) {
initComponents();
setUpFrequencyFilter(type);
} }
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -101,11 +95,11 @@ final class PastOccurrencesFilterPanel extends AbstractDiscoveryFilterPanel {
/** /**
* Initialize the frequency filter. * Initialize the frequency filter.
*/ */
private void setUpFrequencyFilter(ResultType type) { private void setUpFrequencyFilter() {
int count = 0; int count = 0;
DefaultListModel<FileSearchData.Frequency> frequencyListModel = (DefaultListModel<FileSearchData.Frequency>) crFrequencyList.getModel(); DefaultListModel<FileSearchData.Frequency> frequencyListModel = (DefaultListModel<FileSearchData.Frequency>) crFrequencyList.getModel();
frequencyListModel.removeAllElements(); frequencyListModel.removeAllElements();
if (!CentralRepository.isEnabled() && type != ResultType.ATTRIBUTE) { if (!CentralRepository.isEnabled()) {
for (FileSearchData.Frequency freq : FileSearchData.Frequency.getOptionsForFilteringWithoutCr()) { for (FileSearchData.Frequency freq : FileSearchData.Frequency.getOptionsForFilteringWithoutCr()) {
frequencyListModel.add(count, freq); frequencyListModel.add(count, freq);
} }