Project

General

Profile

« Previous | Next » 

Revision 38c05df2

Added by Patrick Plitzner about 6 years ago

ref #7095 Limit node hierarchy by maxRank of corresponding working set

View differences:

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