Project

General

Profile

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

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

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

    
24
/**
25
 * @author pplitzner
26
 * @date Apr 27, 2015
27
 *
28
 */
29
public class StateVocabularyCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, TermVocabulary<State>> {
30

    
31
    public StateVocabularyCollectionSection(CdmFormFactory formFactory,
32
            ConversationHolder conversation, ICdmFormElement parentElement, int style) {
33
        super(formFactory, conversation, parentElement, "Supported state vocabularies", style);
34
    }
35

    
36
    /* (non-Javadoc)
37
     * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
38
     */
39
    /** {@inheritDoc} */
40
    @Override
41
    protected Collection<TermVocabulary<State>> getEntityCollection(Feature entity) {
42
        return entity.getSupportedCategoricalEnumerations();
43
    }
44

    
45
    @Override
46
    public Comparator<TermVocabulary<State>> getComparator() {
47
        return new DefaultCdmBaseComparator<>();
48
    }
49

    
50
    /* (non-Javadoc)
51
     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
52
     */
53
    /** {@inheritDoc} */
54
    @Override
55
    public TermVocabulary<State> createNewElement() {
56
        return TermVocabulary.NewInstance(TermType.State);
57
    }
58

    
59
    /* (non-Javadoc)
60
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
61
     */
62
    /** {@inheritDoc} */
63
    @Override
64
    public void addElement(TermVocabulary<State> element) {
65
        //never gets called
66
    }
67

    
68
    /* (non-Javadoc)
69
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
70
     */
71
    /** {@inheritDoc} */
72
    @Override
73
    public void removeElement(TermVocabulary<State> element) {
74
        getEntity().removeSupportedCategoricalEnumeration(element);
75
    }
76

    
77
    /* (non-Javadoc)
78
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
79
     */
80
    /** {@inheritDoc} */
81
    @Override
82
    public String getEmptyString() {
83
        return "No state vocabularies yet.";
84
    }
85

    
86
    /* (non-Javadoc)
87
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
88
     */
89
    /** {@inheritDoc} */
90
    @Override
91
    protected String getTooltipString() {
92
        return "Add a state vocabulary";
93
    }
94

    
95
    /**
96
     * {@inheritDoc}
97
     */
98
    @Override
99
    public TermVocabulary<State> addExisting() {
100
        // TODO Auto-generated method stub
101
        return null;
102
    }
103

    
104
    /**
105
     * {@inheritDoc}
106
     */
107
    @Override
108
    public boolean allowAddExisting() {
109
        // TODO Auto-generated method stub
110
        return false;
111
    }
112

    
113

    
114
}
(14-14/19)