Project

General

Profile

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

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

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

    
33
	private EntitySelectionElement<DerivedUnit> selection_derivedUnit;
34

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

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

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

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

    
104
}
(33-33/36)