Project

General

Profile

Download (3.42 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.description.Feature;
16
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
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 StatisticalMeasureCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, StatisticalMeasure> {
28

    
29
    public StatisticalMeasureCollectionSection(CdmFormFactory formFactory,
30
            ConversationHolder conversation, ICdmFormElement parentElement, int style) {
31
        super(formFactory, conversation, parentElement, "Statistical measures", 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<StatisticalMeasure> getEntityCollection(Feature entity) {
40
        return entity.getRecommendedStatisticalMeasures();
41
    }
42

    
43
    @Override
44
    public Comparator<StatisticalMeasure> getComparator() {
45
        return new DefaultCdmBaseComparator<>();
46
    }
47

    
48
    /* (non-Javadoc)
49
     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
50
     */
51
    /** {@inheritDoc} */
52
    @Override
53
    public StatisticalMeasure createNewElement() {
54
        return StatisticalMeasure.NewInstance();
55
    }
56

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

    
66
    /* (non-Javadoc)
67
     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
68
     */
69
    /** {@inheritDoc} */
70
    @Override
71
    public void removeElement(StatisticalMeasure element) {
72
        getEntity().removeRecommendedStatisticalMeasure(element);
73
    }
74

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

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

    
93
    /**
94
     * {@inheritDoc}
95
     */
96
    @Override
97
    public StatisticalMeasure addExisting() {
98
        // TODO Auto-generated method stub
99
        return null;
100
    }
101

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

    
111
}
(16-16/19)