Project

General

Profile

Download (2.05 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2018 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.ui.combo;
11

    
12
import java.util.ArrayList;
13
import java.util.List;
14

    
15
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18

    
19
/**
20
 * @author k.luther
21
 * @date 16.02.2018
22
 *
23
 */
24
public class MisappliedRelationshipComboElement extends TermComboElement<TaxonRelationshipType> {
25

    
26
    /**
27
     * @param formFactory
28
     * @param parentElement
29
     * @param termType
30
     * @param labelString
31
     * @param selection
32
     * @param addEmptyElement
33
     * @param style
34
     * @param useAbbrevLabel
35
     * @param comparator
36
     */
37
    public MisappliedRelationshipComboElement(CdmFormFactory formFactory, ICdmFormElement parentElement,
38
             String labelString, TaxonRelationshipType selection, boolean addEmptyElement, int style, boolean useAbbrevLabel) {
39
        super(formFactory, parentElement, TaxonRelationshipType.class, labelString, selection, addEmptyElement, style);
40
        List<TaxonRelationshipType> relTypes = new ArrayList<>();
41
        if (selection.isAnyMisappliedName()){
42
            relTypes.add(TaxonRelationshipType.MISAPPLIED_NAME_FOR());
43
            relTypes.add(TaxonRelationshipType.PRO_PARTE_MISAPPLIED_NAME_FOR());
44
            relTypes.add(TaxonRelationshipType.PARTIAL_MISAPPLIED_NAME_FOR());
45
        }else if (selection.isAnySynonym()){
46
            relTypes.add(TaxonRelationshipType.PRO_PARTE_SYNONYM_FOR());
47
            relTypes.add(TaxonRelationshipType.PARTIAL_SYNONYM_FOR());
48
        }else if (selection.equals(TaxonRelationshipType.INVALID_DESIGNATION_FOR())){
49
            relTypes.add(TaxonRelationshipType.INVALID_DESIGNATION_FOR());
50
            this.setEnabled(false);
51
        }
52
        populateTerms(relTypes);
53
        setSelection(selection);
54
    }
55

    
56
}
(4-4/9)