Project

General

Profile

Download (2.99 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
		if (selection_derivedUnit != null){
71
			selection_derivedUnit.setEntity(entity);
72
		}
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(DerivedUnit.class,
87
				        element, "Derived Unit", null,
88
						EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
89
		if (entity != null){
90
			setEntity(entity);
91
		}
92
	}
93

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

    
109
}
(36-36/38)