Project

General

Profile

« Previous | Next » 

Revision 607296e9

Added by Katja Luther almost 4 years ago

ref #8785: add button to specimen sel dialog to remove filter

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/SpecimenSelectionDialog.java
84 84

  
85 85
        Composite composite_1 = new Composite(composite, SWT.NONE);
86 86
        composite_1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
87
        composite_1.setLayout(new GridLayout(4, false));
87
        composite_1.setLayout(new GridLayout(5, false));
88 88

  
89 89
        Label l_textFilter = new Label(composite_1, SWT.NULL);
90 90
        GridData data_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
......
128 128
            }
129 129
        });
130 130

  
131
        Button btnRemoveTaxonFilterButton = new Button(composite_1, SWT.NONE);
132
        btnRemoveTaxonFilterButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
133
        btnRemoveTaxonFilterButton.setToolTipText(Messages.SpecimenSelectionDialog_REMOVE_FILTER);
134
        btnRemoveTaxonFilterButton.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
135
        btnRemoveTaxonFilterButton.addSelectionListener(new SelectionAdapter() {
136
            @Override
137
            public void widgetSelected(SelectionEvent e) {
138
                txtTextFilter.setText("");
139
                refreshInput(matrix.getSpecimenCache());
140
            }
141
        });
142

  
131 143
        Label lblNewLabel = new Label(composite, SWT.NONE);
132 144
        lblNewLabel.setImage(ImageResources.getImage(ImageResources.WARNING_ICON));
133 145

  
......
196 208
            loadSpecimens();
197 209
        }
198 210
        if(treeIndex !=null){
199
            filterByTaxonNode(treeIndex);
211
            filterByTaxonNode(treeIndex, null);
200 212
        }else{
201 213
            refreshInput(matrix.getSpecimenCache());
202 214
        }
......
230 242
                        .collect(Collectors.toList()));
231 243
            }
232 244
        }
233
        refreshInput(result);
245
        filterByTaxonNode(treeIndex, result);
246

  
234 247
    }
235 248

  
236 249
    private void loadSpecimens(){
......
322 335
        }
323 336
    }
324 337

  
325
    private void filterByTaxonNode(List<String> treeIndexList){
326
        List<SpecimenNodeWrapper> result = new ArrayList<>();
327
        Collection<SpecimenNodeWrapper> specimenCache = matrix.getSpecimenCache();
338
    private void filterByTaxonNode(List<String> treeIndexList, Collection<SpecimenNodeWrapper> specimenCache){
339
        Collection<SpecimenNodeWrapper> result = new ArrayList<>();
340
        if (specimenCache == null){
341
            specimenCache = matrix.getSpecimenCache();
342
        }
328 343
        for (String treeIndex: treeIndexList){
329 344
            if (StringUtils.isNotBlank(treeIndex)){
330 345
                result.addAll(specimenCache.stream()

Also available in: Unified diff