Project

General

Profile

Download (2.81 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.description;
11

    
12
import org.eclipse.swt.events.SelectionListener;
13

    
14
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
15
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
16
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
20
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
21

    
22
/**
23
 * <p>
24
 * DerivedUnitElement class.
25
 * </p>
26
 *
27
 * @author n.hoffmann
28
 * @created Sep 16, 2010
29
 * @version 1.0
30
 */
31
public class DerivedUnitElement extends
32
		AbstractEntityCollectionElement<SpecimenOrObservationBase> {
33

    
34
	private EntitySelectionElement<DerivedUnit> selection_derivedUnit;
35

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

    
62
	/*
63
	 * (non-Javadoc)
64
	 *
65
	 * @see
66
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
67
	 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
68
	 */
69
	/** {@inheritDoc} */
70
	@Override
71
	public void createControls(ICdmFormElement element, int style) {
72
		selection_derivedUnit = formFactory.createSelectionElement(
73
				DerivedUnit.class,
74
				element, "Specimen", null,
75
				EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE,
76
				style);
77
	}
78

    
79
	/*
80
	 * (non-Javadoc)
81
	 *
82
	 * @see
83
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
84
	 * (java.lang.Object)
85
	 */
86
	/** {@inheritDoc} */
87
	@Override
88
	public void handleEvent(Object eventSource) {
89
		if(eventSource == selection_derivedUnit){
90
			setEntity(selection_derivedUnit.getSelection());
91
		}
92
	}
93

    
94
	/** {@inheritDoc} */
95
	@Override
96
	public void setEntity(SpecimenOrObservationBase entity) {
97
		this.entity = entity;
98
	}
99

    
100
}
(2-2/26)