Project

General

Profile

« Previous | Next » 

Revision c0918c7c

Added by Patrick Plitzner about 6 years ago

ref #7095 Refactor RowWrapper

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/DescriptionTreeFormat.java
11 11

  
12 12
import java.util.Comparator;
13 13
import java.util.List;
14
import java.util.Set;
15 14

  
16 15
import ca.odell.glazedlists.TreeList;
17 16
import eu.etaxonomy.cdm.model.description.WorkingSet;
18 17
import eu.etaxonomy.cdm.model.name.Rank;
19 18
import eu.etaxonomy.cdm.model.taxon.Classification;
20
import eu.etaxonomy.cdm.model.taxon.Taxon;
21 19
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
22 20

  
23 21
/**
......
31 29
 public class DescriptionTreeFormat implements TreeList.Format<Object> {
32 30

  
33 31
     private Rank maxRank;
34
     private Classification classification;
35 32

  
36 33
     public DescriptionTreeFormat(WorkingSet workingSet) {
37 34
         this.maxRank = workingSet.getMaxRank();
38
         Set<TaxonNode> taxonSubtreeFilter = workingSet.getTaxonSubtreeFilter();
39
         if(taxonSubtreeFilter!=null && !taxonSubtreeFilter.isEmpty()){
40
             this.classification = taxonSubtreeFilter.iterator().next().getClassification();
41
         }
42 35
     }
43 36

  
44 37
     @Override
45 38
     public void getPath(List path, Object element) {
46 39
         if(element instanceof RowWrapper){
47 40
             //TODO: check for multiple taxon nodes in multiple classifications
48
             Taxon taxon = ((RowWrapper) element).getAssociatedTaxon();
49
             TaxonNode taxonNode = taxon.getTaxonNode(classification);
41
             TaxonNode taxonNode = ((RowWrapper) element).getTaxonNode();
50 42
             addPathRecursive(path, taxonNode);
51 43
         }
52 44
         path.add(element);

Also available in: Unified diff