Project

General

Profile

Download (2.86 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.description;
12

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

    
15
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
16
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
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
 * DerivedUnitElement class.
26
 * </p>
27
 * 
28
 * @author n.hoffmann
29
 * @created Sep 16, 2010
30
 * @version 1.0
31
 */
32
public class DerivedUnitElement extends
33
		AbstractEntityCollectionElement<SpecimenOrObservationBase> {
34

    
35
	private EntitySelectionElement<DerivedUnit> selection_derivedUnit;
36

    
37
	/**
38
	 * <p>
39
	 * Constructor for DerivedUnitElement.
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
50
	 *            {@link eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase}
51
	 *            object.
52
	 * @param removeListener
53
	 *            a {@link org.eclipse.swt.events.SelectionListener} object.
54
	 * @param style
55
	 *            a int.
56
	 */
57
	public DerivedUnitElement(CdmFormFactory formFactory,
58
			AbstractFormSection section, SpecimenOrObservationBase entity,
59
			SelectionListener removeListener, int style) {
60
		super(formFactory, section, entity, removeListener, null, style);
61
	}
62

    
63
	/*
64
	 * (non-Javadoc)
65
	 * 
66
	 * @see
67
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
68
	 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
69
	 */
70
	/** {@inheritDoc} */
71
	@Override
72
	public void createControls(ICdmFormElement element, int style) {
73
		selection_derivedUnit = formFactory.createSelectionElement(
74
				DerivedUnit.class, getConversationHolder(), element,
75
				"Specimen", null, 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
}
(1-1/24)