Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / vocabulary / StatisticalMeasureCollectionSection.java
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.description.Feature;
15 import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
16 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
19
20 /**
21 * @author pplitzner
22 * @date Apr 27, 2015
23 *
24 */
25 public class StatisticalMeasureCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, StatisticalMeasure> {
26
27 public StatisticalMeasureCollectionSection(CdmFormFactory formFactory,
28 ConversationHolder conversation, ICdmFormElement parentElement, int style) {
29 super(formFactory, conversation, parentElement, "Statistical measures", style);
30 }
31
32 /* (non-Javadoc)
33 * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
34 */
35 /** {@inheritDoc} */
36 @Override
37 protected Collection<StatisticalMeasure> getEntityCollection(Feature entity) {
38 return entity.getRecommendedStatisticalMeasures();
39 }
40
41 /* (non-Javadoc)
42 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
43 */
44 /** {@inheritDoc} */
45 @Override
46 public StatisticalMeasure createNewElement() {
47 return StatisticalMeasure.NewInstance();
48 }
49
50 /* (non-Javadoc)
51 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
52 */
53 /** {@inheritDoc} */
54 @Override
55 public void addElement(StatisticalMeasure element) {
56 //never gets called
57 }
58
59 /* (non-Javadoc)
60 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
61 */
62 /** {@inheritDoc} */
63 @Override
64 public void removeElement(StatisticalMeasure element) {
65 getEntity().removeRecommendedStatisticalMeasure(element);
66 }
67
68 /* (non-Javadoc)
69 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
70 */
71 /** {@inheritDoc} */
72 @Override
73 public String getEmptyString() {
74 return "No statistical measures yet.";
75 }
76
77 /* (non-Javadoc)
78 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
79 */
80 /** {@inheritDoc} */
81 @Override
82 protected String getTooltipString() {
83 return "Add a statistical measure";
84 }
85
86 }