Project

General

Profile

Download (2.41 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.section.feature;
11

    
12
import java.util.Collection;
13
import java.util.Comparator;
14

    
15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16
import eu.etaxonomy.cdm.model.description.FeatureNode;
17
import eu.etaxonomy.cdm.model.description.State;
18
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
21
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
22

    
23
/**
24
 * @author pplitzner
25
 * @date 06.03.2018
26
 *
27
 */
28
public class InapplicableIfEntityCollectionSection extends AbstractUnboundEntityCollectionSection<FeatureNode, State>{
29

    
30
    public InapplicableIfEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation,
31
            ICdmFormElement parentElement, int style) {
32
        super(formFactory, conversation, parentElement, "Inapplicable If", style);
33
    }
34

    
35
    /**
36
     * {@inheritDoc}
37
     */
38
    @Override
39
    protected Collection<State> getEntityCollection(FeatureNode entity) {
40
        return entity.getInapplicableIf();
41
    }
42

    
43
    /**
44
     * {@inheritDoc}
45
     */
46
    @Override
47
    public Comparator<State> getComparator() {
48
        return new DefaultCdmBaseComparator<>();
49
    }
50

    
51
    /**
52
     * {@inheritDoc}
53
     */
54
    @Override
55
    public State createNewElement() {
56
        return State.NewInstance();
57
    }
58

    
59
    /**
60
     * {@inheritDoc}
61
     */
62
    @Override
63
    public void addElement(State element) {
64
        //never called
65
    }
66

    
67
    /**
68
     * {@inheritDoc}
69
     */
70
    @Override
71
    public State addExisting() {
72
        return null;
73
    }
74

    
75
    /**
76
     * {@inheritDoc}
77
     */
78
    @Override
79
    public boolean allowAddExisting() {
80
        return false;
81
    }
82

    
83
    /**
84
     * {@inheritDoc}
85
     */
86
    @Override
87
    public void removeElement(State element) {
88
        getEntity().removeInapplicableState(element);
89
    }
90

    
91
    /** {@inheritDoc} */
92
    @Override
93
    public String getEmptyString() {
94
        return "No state added yet.";
95
    }
96

    
97
    /** {@inheritDoc} */
98
    @Override
99
    protected String getTooltipString() {
100
        return "Add a state";
101
    }
102

    
103
}
(10-10/12)