Project

General

Profile

Download (3.01 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 org.eclipse.swt.events.SelectionListener;
14

    
15
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
16
import eu.etaxonomy.cdm.model.occurrence.Specimen;
17
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
18
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
21
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
22

    
23
/**
24
 * <p>
25
 * SpecimenCollectionDetailElement class.
26
 * </p>
27
 * 
28
 * @author n.hoffmann
29
 * @created Oct 14, 2010
30
 * @version 1.0
31
 */
32
public class SpecimenCollectionDetailElement extends
33
		AbstractEntityCollectionElement<Specimen> {
34

    
35
	private EntitySelectionElement<DerivedUnitBase> selection_derivedUnit;
36

    
37
	/**
38
	 * <p>
39
	 * Constructor for SpecimenCollectionDetailElement.
40
	 * </p>
41
	 * 
42
	 * @param formFactory
43
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
44
	 *            object.
45
	 * @param section
46
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
47
	 *            object.
48
	 * @param entity
49
	 *            a {@link eu.etaxonomy.cdm.model.occurrence.Specimen} object.
50
	 * @param removeListener
51
	 *            a {@link org.eclipse.swt.events.SelectionListener} object.
52
	 * @param style
53
	 *            a int.
54
	 */
55
	public SpecimenCollectionDetailElement(CdmFormFactory formFactory,
56
			AbstractFormSection section, Specimen entity,
57
			SelectionListener removeListener, int style) {
58
		super(formFactory, section, entity, removeListener, null, style);
59
	}
60

    
61
	/*
62
	 * (non-Javadoc)
63
	 * 
64
	 * @see
65
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
66
	 * (java.lang.Object)
67
	 */
68
	/** {@inheritDoc} */
69
	@Override
70
	public void setEntity(Specimen entity) {
71
		this.entity = entity;
72
		selection_derivedUnit.setEntity(entity);
73
	}
74

    
75
	/*
76
	 * (non-Javadoc)
77
	 * 
78
	 * @see
79
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
80
	 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
81
	 */
82
	/** {@inheritDoc} */
83
	@Override
84
	public void createControls(ICdmFormElement element, int style) {
85
		selection_derivedUnit = formFactory
86
				.createSelectionElement(DerivedUnitBase.class,
87
						getConversationHolder(), element, "Derived Unit", null,
88
						EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
89
	}
90

    
91
	/*
92
	 * (non-Javadoc)
93
	 * 
94
	 * @see
95
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
96
	 * (java.lang.Object)
97
	 */
98
	/** {@inheritDoc} */
99
	@Override
100
	public void handleEvent(Object eventSource) {
101
		if (eventSource == selection_derivedUnit) {
102
			this.setEntity((Specimen) selection_derivedUnit.getSelection());
103
		}
104
	}
105

    
106
}
(28-28/29)