Revision 353f7dda
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/CharacterMatrix.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.editor.workingSet.matrix; |
10 | 10 |
|
11 |
import java.awt.DisplayMode; |
|
11 | 12 |
import java.io.File; |
12 | 13 |
import java.io.FileInputStream; |
13 | 14 |
import java.io.IOException; |
... | ... | |
20 | 21 |
import java.util.Map; |
21 | 22 |
import java.util.Properties; |
22 | 23 |
import java.util.Set; |
24 |
import java.util.stream.Collectors; |
|
23 | 25 |
|
24 | 26 |
import org.apache.commons.collections4.map.LinkedMap; |
25 | 27 |
import org.eclipse.core.runtime.ICoreRunnable; |
... | ... | |
85 | 87 |
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer; |
86 | 88 |
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration; |
87 | 89 |
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes; |
88 |
import org.eclipse.nebula.widgets.nattable.style.DisplayMode; |
|
89 | 90 |
import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum; |
90 |
import org.eclipse.nebula.widgets.nattable.style.Style; |
|
91 | 91 |
import org.eclipse.nebula.widgets.nattable.style.VerticalAlignmentEnum; |
92 | 92 |
import org.eclipse.nebula.widgets.nattable.summaryrow.DefaultSummaryRowConfiguration; |
93 | 93 |
import org.eclipse.nebula.widgets.nattable.summaryrow.FixedSummaryRowLayer; |
... | ... | |
1049 | 1049 |
} |
1050 | 1050 |
|
1051 | 1051 |
public void setSpecimenCache(List<SpecimenWrapper> specimenCache) { |
1052 |
this.specimenCache = specimenCache; |
|
1052 |
this.specimenCache = |
|
1053 |
specimenCache.stream().filter(wrapper -> |
|
1054 |
wrapper.getSpecimen().getDescriptions().stream().noneMatch(description -> |
|
1055 |
workingSet.getDescriptions().contains(description))) |
|
1056 |
.collect(Collectors.toList()); |
|
1053 | 1057 |
} |
1054 | 1058 |
|
1055 | 1059 |
public Properties getNatTableState() { |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/SpecimenSelectionDialog.java | ||
---|---|---|
9 | 9 |
package eu.etaxonomy.taxeditor.editor.workingSet.matrix; |
10 | 10 |
|
11 | 11 |
import java.util.ArrayList; |
12 |
import java.util.Arrays; |
|
12 | 13 |
import java.util.Collection; |
13 | 14 |
import java.util.List; |
14 | 15 |
import java.util.UUID; |
... | ... | |
17 | 18 |
|
18 | 19 |
import org.eclipse.jface.dialogs.Dialog; |
19 | 20 |
import org.eclipse.jface.layout.GridDataFactory; |
20 |
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
|
21 |
import org.eclipse.jface.viewers.ArrayContentProvider;
|
|
21 | 22 |
import org.eclipse.jface.viewers.IStructuredSelection; |
22 | 23 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
23 | 24 |
import org.eclipse.jface.viewers.LabelProvider; |
... | ... | |
63 | 64 |
*/ |
64 | 65 |
public class SpecimenSelectionDialog extends Dialog { |
65 | 66 |
|
67 |
private static final List<String> NODE_PROPERTY_PATH = Arrays.asList(new String[] { |
|
68 |
"taxon", |
|
69 |
"taxon.name", |
|
70 |
}); |
|
71 |
|
|
66 | 72 |
private static String TEXT_FILTER_DEFAULT = "Enter text filter"; |
67 | 73 |
|
68 | 74 |
private TableViewer list; |
... | ... | |
149 | 155 |
columnSpecimen.getColumn().setMoveable(true); |
150 | 156 |
table.setHeaderVisible(true); |
151 | 157 |
table.setLinesVisible(true); |
152 |
list.setContentProvider(new SpecimenListContentProvider());
|
|
158 |
list.setContentProvider(new ArrayContentProvider());
|
|
153 | 159 |
list.setLabelProvider(new SpecimenListLabelProvider()); |
154 | 160 |
|
155 | 161 |
//gather specimens |
... | ... | |
189 | 195 |
for (UUID uuid : filteredNodes) { |
190 | 196 |
//TODO implement occurrence service for taxon nodes |
191 | 197 |
// let it return UuidAndTitleCache |
192 |
TaxonNode taxonNode = taxonNodeService.load(uuid); |
|
198 |
TaxonNode taxonNode = taxonNodeService.load(uuid, NODE_PROPERTY_PATH);
|
|
193 | 199 |
Taxon taxon = taxonNode.getTaxon(); |
194 | 200 |
if(taxon!=null){ |
195 | 201 |
FindOccurrencesConfigurator config = new FindOccurrencesConfigurator(); |
... | ... | |
225 | 231 |
return selectedSpecimens; |
226 | 232 |
} |
227 | 233 |
|
228 |
private class SpecimenListContentProvider implements IStructuredContentProvider{ |
|
229 |
@Override |
|
230 |
public Object[] getElements(Object inputElement) { |
|
231 |
return ((List<SpecimenWrapper>) inputElement).stream().filter(wrapper -> |
|
232 |
wrapper.getSpecimen().getDescriptions().stream().noneMatch(description -> |
|
233 |
matrix.getWorkingSet().getDescriptions().contains(description))).toArray(); |
|
234 |
} |
|
235 |
} |
|
236 |
|
|
237 | 234 |
private class SpecimenListLabelProvider extends LabelProvider implements ITableLabelProvider{ |
238 | 235 |
|
239 | 236 |
@Override |
... | ... | |
247 | 244 |
SpecimenWrapper wrapper = (SpecimenWrapper)element; |
248 | 245 |
switch (columnIndex) { |
249 | 246 |
case 0: |
250 |
return wrapper.getTaxonNode().getTaxon().getName().getTitleCache();
|
|
247 |
return wrapper.getTaxonNodeLabel();
|
|
251 | 248 |
case 1: |
252 | 249 |
return wrapper.getSpecimen().getTitleCache(); |
253 | 250 |
default: |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/SpecimenWrapper.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
private SpecimenOrObservationBase specimen; |
22 | 22 |
private TaxonNode taxonNode; |
23 |
private String taxonNodeLabel; |
|
23 | 24 |
private String label; |
24 | 25 |
|
25 | 26 |
public SpecimenWrapper(SpecimenOrObservationBase specimen, TaxonNode taxonNode, String label) { |
26 | 27 |
super(); |
27 | 28 |
this.specimen = specimen; |
28 | 29 |
this.taxonNode = taxonNode; |
30 |
this.taxonNodeLabel = taxonNode.getTaxon().getName().getTitleCache(); |
|
29 | 31 |
this.label = label; |
30 | 32 |
} |
31 | 33 |
|
... | ... | |
37 | 39 |
return taxonNode; |
38 | 40 |
} |
39 | 41 |
|
42 |
public String getTaxonNodeLabel() { |
|
43 |
return taxonNodeLabel; |
|
44 |
} |
|
45 |
|
|
40 | 46 |
public String getLabel() { |
41 | 47 |
return label; |
42 | 48 |
} |
Also available in: Unified diff
ref #7095 Increase performance of specimen selection dialog