Project

General

Profile

Revision 5167fe82

ID5167fe82c63a0351e3a6913123f88be1f64331bf
Parent 6e7032cb
Child 655e14bf

Added by Katja Luther over 1 year ago

fix default feature tree for facts and name facts

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DynamicFeatureMenuE4.java
34 34
import eu.etaxonomy.cdm.model.term.FeatureNode;
35 35
import eu.etaxonomy.cdm.model.term.FeatureTree;
36 36
import eu.etaxonomy.cdm.model.term.VocabularyEnum;
37
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
38 37
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
39 38
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
40 39
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
......
137 136
		}
138 137

  
139 138
		if (featureTree == null) {
140
			featureTree = TermEditorInput.getDefaultFeatureTree();
139
		    List<Feature> terms = CdmStore.getTermManager().getPreferredTerms(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.Feature.getUuid()), null);
140
            terms.remove(Feature.IMAGE());
141

  
142
			featureTree = FeatureTree.NewInstance(terms);
143

  
141 144
		}
142 145
		if (description instanceof TaxonNameDescription){
143 146
		    List<Feature> terms = CdmStore.getTermManager().getPreferredTerms(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid()));
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermManager.java
11 11

  
12 12
import java.util.ArrayList;
13 13
import java.util.Collection;
14
import java.util.Comparator;
14 15
import java.util.HashMap;
15 16
import java.util.List;
16 17
import java.util.Map;
......
20 21
import eu.etaxonomy.cdm.model.term.TermBase;
21 22
import eu.etaxonomy.cdm.model.term.TermType;
22 23
import eu.etaxonomy.cdm.model.term.TermVocabulary;
24
import eu.etaxonomy.taxeditor.model.DefaultTermComparator;
23 25
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
24 26
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
25 27

  
......
65 67
	public <T extends DefinedTermBase> List<T> getPreferredTerms(TermVocabulary<T> termVocabulary){
66 68
	    List terms = cachedTermMap.get(termVocabulary);
67 69
	    if(terms==null){
68
	        terms = getFilteredTerms(new ArrayList<T>(TermStore.getTerms(termVocabulary, null)));
70
	        terms = getFilteredTerms(new ArrayList<T>(TermStore.getTerms(termVocabulary,null)));
69 71
	        cachedTermMap.put(termVocabulary, terms);
70 72
	    }
71 73
	    return terms;
72 74
	}
73 75

  
76

  
77
	/**
78
    *
79
    * @param clazz
80
    * @return
81
    */
82
   public <T extends DefinedTermBase> List<T> getPreferredTerms(TermVocabulary<T> termVocabulary, Comparator comp){
83
       if (comp == null){
84
           comp = new DefaultTermComparator<T>();
85
       }
86
       List terms = cachedTermMap.get(termVocabulary);
87
       if(terms==null){
88
           terms = getFilteredTerms(new ArrayList<T>(TermStore.getTerms(termVocabulary,comp)));
89
           cachedTermMap.put(termVocabulary, terms);
90
       }
91
       terms.sort(comp);
92
       return terms;
93
   }
74 94
	/**
75 95
	 *
76 96
	 * @param clazz

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)