Project

General

Profile

Download (1.88 KB) Statistics
| Branch: | Tag: | Revision:
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 java.util.Arrays;
14
import java.util.Collection;
15

    
16
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
17
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
18
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
19
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
21

    
22
/**
23
 * @author n.hoffmann
24
 * @created May 11, 2011
25
 * @version 1.0
26
 */
27
public class CurrentDeterminationDetailSection extends
28
		AbstractDeterminationEventDetailSection {
29

    
30
	/**
31
	 * @param formFactory
32
	 * @param conversation
33
	 * @param parentElement
34
	 * @param style
35
	 */
36
	public CurrentDeterminationDetailSection(CdmFormFactory formFactory,
37
			ConversationHolder conversation, ICdmFormElement parentElement,
38
			int style) {
39
		super(formFactory, conversation, parentElement, "Current Determination", style);
40
	}
41

    
42
	/* (non-Javadoc)
43
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
44
	 */
45
	@Override
46
	public Collection<DeterminationEvent> getCollection(DerivedUnitFacade entity) {
47
		DeterminationEvent preferredDetermination = entity.getPreferredDetermination();
48
		return preferredDetermination != null ? Arrays.asList(new DeterminationEvent[]{preferredDetermination}) : null;
49
	}
50
	
51
	/* (non-Javadoc)
52
	 * @see eu.etaxonomy.taxeditor.ui.section.occurrence.AbstractDeterminationEventDetailSection#createNewElement()
53
	 */
54
	@Override
55
	public DeterminationEvent createNewElement() {
56
		DeterminationEvent newElement = super.createNewElement();
57
		newElement.setPreferredFlag(true);
58
		return newElement;
59
	}
60

    
61
}
(6-6/29)