Revision 38c05df2
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/CharacterMatrix.java | ||
---|---|---|
232 | 232 |
// because the Comparator will be set by configuration |
233 | 233 |
SortedList<Object> sortedList = new SortedList<>(descriptions, null); |
234 | 234 |
// wrap the SortedList with the TreeList |
235 |
TreeList treeList = new TreeList(sortedList, new DescriptionTreeFormat(), TreeList.NODES_START_EXPANDED); |
|
235 |
TreeList treeList = new TreeList(sortedList, new DescriptionTreeFormat(workingSet.getMaxRank()), TreeList.NODES_START_EXPANDED);
|
|
236 | 236 |
|
237 | 237 |
ConfigRegistry configRegistry = new ConfigRegistry(); |
238 | 238 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/DescriptionTreeFormat.java | ||
---|---|---|
14 | 14 |
import java.util.Set; |
15 | 15 |
|
16 | 16 |
import ca.odell.glazedlists.TreeList; |
17 |
import eu.etaxonomy.cdm.model.name.Rank; |
|
17 | 18 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
18 | 19 |
import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator; |
19 | 20 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
... | ... | |
29 | 30 |
public class DescriptionTreeFormat implements TreeList.Format<Object> { |
30 | 31 |
|
31 | 32 |
private Comparator<TaxonNode> comparator; |
33 |
private Rank minRank; |
|
34 |
private Rank maxRank; |
|
32 | 35 |
|
33 |
public DescriptionTreeFormat() { |
|
36 |
public DescriptionTreeFormat(Rank maxRank) { |
|
37 |
this.maxRank = maxRank; |
|
34 | 38 |
if (PreferencesUtil.getSortNodesNaturally()){ |
35 | 39 |
comparator = new TaxonNaturalComparator(); |
36 | 40 |
} else if (PreferencesUtil.getSortNodesStrictlyAlphabetically()){ |
... | ... | |
55 | 59 |
} |
56 | 60 |
|
57 | 61 |
private void addPathRecursive(List path, TaxonNode node){ |
58 |
if(node.getParent()!=null){ |
|
62 |
if(node.getParent()!=null |
|
63 |
&& node.getTaxon()!=null |
|
64 |
&& node.getTaxon().getName()!=null |
|
65 |
&& node.getTaxon().getName().getRank()!=null){ |
|
66 |
Rank rank = node.getTaxon().getName().getRank(); |
|
67 |
if(maxRank.equals(rank)){ |
|
68 |
path.add(node); |
|
69 |
return; |
|
70 |
} |
|
59 | 71 |
addPathRecursive(path, node.getParent()); |
60 | 72 |
path.add(node); |
61 | 73 |
} |
Also available in: Unified diff
ref #7095 Limit node hierarchy by maxRank of corresponding working set