1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 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
|
|
11
|
package eu.etaxonomy.taxeditor.ui.section.occurrence;
|
12
|
|
13
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
14
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
|
15
|
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
|
16
|
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
|
17
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
21
|
|
22
|
/**
|
23
|
* <p>DeterminationEventDetailSection class.</p>
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created Oct 13, 2010
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public abstract class AbstractDeterminationEventDetailSection extends
|
30
|
AbstractEntityCollectionSection<DerivedUnitFacade, DeterminationEvent> {
|
31
|
|
32
|
/**
|
33
|
* @param formFactory
|
34
|
* @param conversation
|
35
|
* @param parentElement
|
36
|
* @param title
|
37
|
* @param style
|
38
|
*/
|
39
|
public AbstractDeterminationEventDetailSection(CdmFormFactory formFactory,
|
40
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
41
|
String title, int style) {
|
42
|
super(formFactory, conversation, parentElement, title, style);
|
43
|
}
|
44
|
|
45
|
/* (non-Javadoc)
|
46
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
|
47
|
*/
|
48
|
/** {@inheritDoc} */
|
49
|
@Override
|
50
|
public DeterminationEvent createNewElement() {
|
51
|
DeterminationEvent instance = DeterminationEvent.NewInstance();
|
52
|
if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
|
53
|
instance.setIdentifiedUnit(getEntity().innerFieldUnit());
|
54
|
}
|
55
|
else{
|
56
|
instance.setIdentifiedUnit(getEntity().innerDerivedUnit());
|
57
|
}
|
58
|
return instance;
|
59
|
}
|
60
|
|
61
|
/* (non-Javadoc)
|
62
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
63
|
*/
|
64
|
/** {@inheritDoc} */
|
65
|
@Override
|
66
|
public void addElement(DeterminationEvent determination) {
|
67
|
getEntity().addDetermination(determination);
|
68
|
}
|
69
|
|
70
|
/* (non-Javadoc)
|
71
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
72
|
*/
|
73
|
/** {@inheritDoc} */
|
74
|
@Override
|
75
|
public void removeElement(DeterminationEvent determination) {
|
76
|
getEntity().removeDetermination(determination);
|
77
|
}
|
78
|
|
79
|
/* (non-Javadoc)
|
80
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
|
81
|
*/
|
82
|
/** {@inheritDoc} */
|
83
|
@Override
|
84
|
public String getEmptyString() {
|
85
|
return "No determinations yet.";
|
86
|
}
|
87
|
|
88
|
}
|