Project

General

Profile

Download (2.76 KB) Statistics
| Branch: | Tag: | Revision:
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.IPreferenceKeys;
16
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
20

    
21
/**
22
 * <p>DeterminationEventDetailSection class.</p>
23
 *
24
 * @author n.hoffmann
25
 * @created Oct 13, 2010
26
 * @version 1.0
27
 */
28
public abstract class AbstractDeterminationEventDetailSection extends
29
		AbstractEntityCollectionSection<DerivedUnitFacade, DeterminationEvent> {
30

    
31
	/**
32
	 * @param formFactory
33
	 * @param conversation
34
	 * @param parentElement
35
	 * @param title
36
	 * @param style
37
	 */
38
	public AbstractDeterminationEventDetailSection(CdmFormFactory formFactory,
39
			ConversationHolder conversation, ICdmFormElement parentElement,
40
			String title, int style) {
41
		super(formFactory, conversation, parentElement, title, style);
42
	}
43

    
44
	/* (non-Javadoc)
45
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
46
	 */
47
	/** {@inheritDoc} */
48
	@Override
49
	public DeterminationEvent createNewElement() {
50
		DeterminationEvent instance = DeterminationEvent.NewInstance();
51
        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
52
            instance.setIdentifiedUnit(getEntity().innerFieldUnit());
53
        }
54
        else{
55
            instance.setIdentifiedUnit(getEntity().innerDerivedUnit());
56
        }
57
		return instance;
58
	}
59

    
60
	/* (non-Javadoc)
61
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
62
	 */
63
	/** {@inheritDoc} */
64
	@Override
65
	public void addElement(DeterminationEvent determination) {
66
		getEntity().addDetermination(determination);
67
	}
68

    
69
	/* (non-Javadoc)
70
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
71
	 */
72
	/** {@inheritDoc} */
73
	@Override
74
	public void removeElement(DeterminationEvent determination) {
75
		getEntity().removeDetermination(determination);
76
	}
77

    
78
	/* (non-Javadoc)
79
	 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
80
	 */
81
	/** {@inheritDoc} */
82
	@Override
83
	public String getEmptyString() {
84
		return "No determinations yet.";
85
	}
86

    
87
}
(1-1/36)