1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.taxeditor.ui.section.occurrence;
|
11
|
|
12
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
13
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
|
14
|
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
|
15
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
19
|
|
20
|
/**
|
21
|
* <p>DeterminationEventDetailSection class.</p>
|
22
|
*
|
23
|
* @author n.hoffmann
|
24
|
* @created Oct 13, 2010
|
25
|
* @version 1.0
|
26
|
*/
|
27
|
public abstract class AbstractDeterminationEventDetailSection extends
|
28
|
AbstractEntityCollectionSection<DerivedUnitFacade, DeterminationEvent> {
|
29
|
|
30
|
/**
|
31
|
* @param formFactory
|
32
|
* @param conversation
|
33
|
* @param parentElement
|
34
|
* @param title
|
35
|
* @param style
|
36
|
*/
|
37
|
public AbstractDeterminationEventDetailSection(CdmFormFactory formFactory,
|
38
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
39
|
String title, int style) {
|
40
|
super(formFactory, conversation, parentElement, title, style);
|
41
|
}
|
42
|
|
43
|
/* (non-Javadoc)
|
44
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
|
45
|
*/
|
46
|
/** {@inheritDoc} */
|
47
|
@Override
|
48
|
public DeterminationEvent createNewElement() {
|
49
|
DeterminationEvent instance = DeterminationEvent.NewInstance();
|
50
|
if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){
|
51
|
instance.setIdentifiedUnit(getEntity().innerFieldUnit());
|
52
|
}
|
53
|
else{
|
54
|
instance.setIdentifiedUnit(getEntity().innerDerivedUnit());
|
55
|
}
|
56
|
return instance;
|
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(DeterminationEvent determination) {
|
65
|
getEntity().addDetermination(determination);
|
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(DeterminationEvent determination) {
|
74
|
getEntity().removeDetermination(determination);
|
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 determinations yet.";
|
84
|
}
|
85
|
|
86
|
}
|