1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2015 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.vocabulary;
|
11
|
|
12
|
import java.util.Collection;
|
13
|
|
14
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
15
|
import eu.etaxonomy.cdm.model.description.Feature;
|
16
|
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
19
|
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
|
20
|
|
21
|
/**
|
22
|
* @author pplitzner
|
23
|
* @date Apr 27, 2015
|
24
|
*
|
25
|
*/
|
26
|
public class MeasurementUnitCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, MeasurementUnit> {
|
27
|
|
28
|
public MeasurementUnitCollectionSection(CdmFormFactory formFactory,
|
29
|
ConversationHolder conversation, ICdmFormElement parentElement, int style) {
|
30
|
super(formFactory, conversation, parentElement, "Recommended measurement units", style);
|
31
|
}
|
32
|
|
33
|
/* (non-Javadoc)
|
34
|
* @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
|
35
|
*/
|
36
|
/** {@inheritDoc} */
|
37
|
@Override
|
38
|
protected Collection<MeasurementUnit> getEntityCollection(Feature entity) {
|
39
|
return entity.getRecommendedMeasurementUnits();
|
40
|
}
|
41
|
|
42
|
/* (non-Javadoc)
|
43
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
|
44
|
*/
|
45
|
/** {@inheritDoc} */
|
46
|
@Override
|
47
|
public MeasurementUnit createNewElement() {
|
48
|
return MeasurementUnit.NewInstance();
|
49
|
}
|
50
|
|
51
|
/* (non-Javadoc)
|
52
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
53
|
*/
|
54
|
/** {@inheritDoc} */
|
55
|
@Override
|
56
|
public void addElement(MeasurementUnit element) {
|
57
|
//never gets called
|
58
|
}
|
59
|
|
60
|
/* (non-Javadoc)
|
61
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
62
|
*/
|
63
|
/** {@inheritDoc} */
|
64
|
@Override
|
65
|
public void removeElement(MeasurementUnit element) {
|
66
|
getEntity().removeRecommendedMeasurementUnit(element);
|
67
|
}
|
68
|
|
69
|
/* (non-Javadoc)
|
70
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
|
71
|
*/
|
72
|
/** {@inheritDoc} */
|
73
|
@Override
|
74
|
public String getEmptyString() {
|
75
|
return "No recommended measurement units yet.";
|
76
|
}
|
77
|
|
78
|
/* (non-Javadoc)
|
79
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
|
80
|
*/
|
81
|
/** {@inheritDoc} */
|
82
|
@Override
|
83
|
protected String getTooltipString() {
|
84
|
return "Add a measurement unit";
|
85
|
}
|
86
|
|
87
|
}
|