Project

General

Profile

Revision f7e044c5

IDf7e044c54060cb052897e20f23e44cba1697abe3
Parent 2b71b448
Child 45db0045

Added by Katja Luther over 2 years ago

fix factual data view for name facts

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java
17 17
import eu.etaxonomy.cdm.model.common.Marker;
18 18
import eu.etaxonomy.cdm.model.description.DescriptionBase;
19 19
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
20
import eu.etaxonomy.cdm.model.term.FeatureTree;
21 20
import eu.etaxonomy.cdm.model.description.IDescribable;
22 21
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
22
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
23
import eu.etaxonomy.cdm.model.term.FeatureTree;
23 24
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
24 25
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
25 26
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
......
182 183
	 */
183 184
	private FeatureTree getFeatureTree(DescriptionBase description){
184 185

  
185
	    FeatureTree featureTree;
186
		// TODO change this to the feature tree associated with this taxon description
187
		if (description.hasStructuredData()){
188
			featureTree = PreferencesUtil.getDefaultFeatureTreeForStructuredDescription();
189
		}else{
190
			featureTree = PreferencesUtil.getDefaultFeatureTreeForTextualDescription();
191
		}
186
	        FeatureTree<?> featureTree = null;
187

  
188
	        // TODO change this to the feature tree associated with this taxon
189
	        // description
190
	        if (description.hasStructuredData()) {
191
	            featureTree = PreferencesUtil
192
	                    .getDefaultFeatureTreeForStructuredDescription();
193
	        } else {
194
	            featureTree = PreferencesUtil
195
	                    .getDefaultFeatureTreeForTextualDescription();
196
	        }
197

  
198
	        if (featureTree == null) {
199
	            featureTree = TermEditorInput.getDefaultFeatureTree();
200
	                    }
201
	        if (description instanceof TaxonNameDescription){
202

  
203
	            featureTree = TermEditorInput.getDefaultNameFeatureTree();
204
	        }
205

  
206
	        return featureTree;
207

  
192 208

  
193
		// create a transient tree with all features if none was selected
194
		if(featureTree == null){
195
			featureTree = TermEditorInput.getDefaultFeatureTree();
196
		}
197 209

  
198
		return featureTree;
199 210
	}
200 211

  
201 212
    /**
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/TermEditorInput.java
40 40
	// FIXME: the default feature should be move to CdmApplicationState
41 41
	//        where it is a singleton instance variable
42 42
	private static FeatureTree defaultFeatureTree = null;
43
	private static FeatureTree defaultNameFeatureTree = null;
43 44

  
44 45
	private List<String> termClasses = Arrays.asList(new String[]{
45 46
			DefinedTerm.class.getName()
......
111 112
        }
112 113
        return defaultFeatureTree;
113 114
    }
115

  
116
    public static FeatureTree getDefaultNameFeatureTree() {
117
        if(defaultNameFeatureTree == null) {
118
            List<Feature> nameFeatures = CdmStore.getTermManager().getPreferredTerms(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid()), null);
119
            defaultNameFeatureTree = FeatureTree.NewInstance(nameFeatures);
120
        }
121
        return defaultNameFeatureTree;
122
    }
114 123
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)