Project

General

Profile

Download (2.98 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

    
13
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
14
import eu.etaxonomy.cdm.model.common.TermType;
15
import eu.etaxonomy.cdm.model.common.TermVocabulary;
16
import eu.etaxonomy.cdm.model.description.Feature;
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.occurrence.dna.AbstractUnboundEntityCollectionSection;
21

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

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

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

    
43
    /* (non-Javadoc)
44
     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
45
     */
46
    /** {@inheritDoc} */
47
    @Override
48
    public TermVocabulary<State> createNewElement() {
49
        return TermVocabulary.NewInstance(TermType.State);
50
    }
51

    
52
    /* (non-Javadoc)
53
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
54
     */
55
    /** {@inheritDoc} */
56
    @Override
57
    public void addElement(TermVocabulary<State> element) {
58
        //never gets called
59
    }
60

    
61
    /* (non-Javadoc)
62
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
63
     */
64
    /** {@inheritDoc} */
65
    @Override
66
    public void removeElement(TermVocabulary<State> element) {
67
        getEntity().removeSupportedCategoricalEnumeration(element);
68
    }
69

    
70
    /* (non-Javadoc)
71
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
72
     */
73
    /** {@inheritDoc} */
74
    @Override
75
    public String getEmptyString() {
76
        return "No state vocabularies yet.";
77
    }
78

    
79
    /* (non-Javadoc)
80
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
81
     */
82
    /** {@inheritDoc} */
83
    @Override
84
    protected String getTooltipString() {
85
        return "Add a state vocabulary";
86
    }
87

    
88

    
89
}
(14-14/19)