Project

General

Profile

« Previous | Next » 

Revision 599261fd

Added by Patrick Plitzner over 6 years ago

Add scope restrictions to PolytomousKey details view #5280

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
20 20
import org.eclipse.swt.widgets.Label;
21 21
import org.eclipse.swt.widgets.Listener;
22 22

  
23
import eu.etaxonomy.cdm.model.common.DefinedTerm;
24 23
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
25 24
import eu.etaxonomy.cdm.model.common.TermType;
26 25
import eu.etaxonomy.cdm.model.common.TermVocabulary;
......
67 66

  
68 67
	private Comparator<T> termComparator;
69 68

  
69
	private final TermType termType;
70
	private final TermVocabulary termVocabulary;
70 71
	private final Class<T> termClass;
71 72

  
72 73
	private List<T> customPreferredTerms;
......
96 97
	        int style) {
97 98
        super(formFactory, parentElement);
98 99

  
99
        if(termClass!=null){
100
            this.termClass = termClass;
101
        }
102
        else{
103
            this.termClass =  (Class<T>) DefinedTerm.class;
104
        }
100
        this.termType = termType;
101
        this.termVocabulary = termVocabulary;
102
        this.termClass = termClass;
105 103
        this.addEmptyElement = addEmptyElement;
106 104

  
107 105
        if (labelString != null) {
......
265 263
	 * @return a {@link java.util.List} object.
266 264
	 */
267 265
	protected List<T> getPreferredTerms(){
266
	    List<T> preferredTerms = new ArrayList<T>();
268 267
		if (customPreferredTerms != null){
269 268
			return customPreferredTerms;
270 269
		}
271
		return getTermManager().getPreferredTerms(termClass);
270
		else if(termType!=null){
271
		    preferredTerms = getTermManager().getPreferredTerms(termType);
272
		}
273
		else if(termVocabulary!=null){
274
		    preferredTerms = getTermManager().getPreferredTerms(termVocabulary);
275
		}
276
		if(termClass!=null){
277
		    preferredTerms = getTermManager().getPreferredTerms(termClass);
278
		}
279
		return preferredTerms;
272 280
	}
273 281

  
274 282
	/**
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailElement.java
26 26
    private NumberWithLabelElement numberStartNumber;
27 27
    private TaxonomicScopeSection sectionTaxonomicScope;
28 28
    private GeoScopePolyKeyDetailSection sectionGeoScopes;
29
    private ScopeRestrictionSection sectionScopeRestriction;
29 30

  
30 31
	public PolytomousKeyDetailElement(CdmFormFactory formFactory,
31 32
			ICdmFormElement formElement) {
......
46 47
	    sectionGeoScopes = formFactory.createGeoScopePolyKeyDetailSection(getConversationHolder(), formElement, SWT.NULL);
47 48
	    sectionGeoScopes.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
48 49
	    sectionGeoScopes.setEntity(entity);
50

  
51
	    sectionScopeRestriction = formFactory.createScopeRestrictionSection(getConversationHolder(), formElement, SWT.NULL);
52
	    sectionScopeRestriction.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
53
	    sectionScopeRestriction.setEntity(entity);
49 54
	}
50 55

  
51 56
	public String getText() {

Also available in: Unified diff