Project

General

Profile

Download (2.94 KB) Statistics
| Branch: | Tag: | Revision:
1 74b9f670 n.hoffmann
// $Id$
2
/**
3 f561b00c n.hoffmann
 * 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 74b9f670 n.hoffmann
11 f211dd28 n.hoffmann
package eu.etaxonomy.taxeditor.ui.section.occurrence;
12 74b9f670 n.hoffmann
13
import org.eclipse.swt.events.SelectionListener;
14
15 49a64920 Cherian Mathew
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
16 78222507 n.hoffmann
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 dacb59c9 Patric Plitzner
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19 f211dd28 n.hoffmann
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
20 23783f7a n.hoffmann
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
21 74b9f670 n.hoffmann
22
/**
23 f561b00c n.hoffmann
 * <p>
24
 * SpecimenCollectionDetailElement class.
25
 * </p>
26
 * 
27 74b9f670 n.hoffmann
 * @author n.hoffmann
28
 * @created Oct 14, 2010
29
 * @version 1.0
30
 */
31
public class SpecimenCollectionDetailElement extends
32 49a64920 Cherian Mathew
		AbstractEntityCollectionElement<DerivedUnit> {
33 74b9f670 n.hoffmann
34 49a64920 Cherian Mathew
	private EntitySelectionElement<DerivedUnit> selection_derivedUnit;
35 f561b00c n.hoffmann
36 74b9f670 n.hoffmann
	/**
37 f561b00c n.hoffmann
	 * <p>
38
	 * Constructor for SpecimenCollectionDetailElement.
39
	 * </p>
40
	 * 
41
	 * @param formFactory
42 78222507 n.hoffmann
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
43 f561b00c n.hoffmann
	 *            object.
44
	 * @param section
45 78222507 n.hoffmann
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
46 f561b00c n.hoffmann
	 *            object.
47
	 * @param entity
48
	 *            a {@link eu.etaxonomy.cdm.model.occurrence.Specimen} object.
49
	 * @param removeListener
50
	 *            a {@link org.eclipse.swt.events.SelectionListener} object.
51
	 * @param style
52
	 *            a int.
53 74b9f670 n.hoffmann
	 */
54
	public SpecimenCollectionDetailElement(CdmFormFactory formFactory,
55 49a64920 Cherian Mathew
			AbstractFormSection section, DerivedUnit entity,
56 74b9f670 n.hoffmann
			SelectionListener removeListener, int style) {
57
		super(formFactory, section, entity, removeListener, null, style);
58
	}
59
60 f561b00c n.hoffmann
	/*
61
	 * (non-Javadoc)
62
	 * 
63
	 * @see
64
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
65
	 * (java.lang.Object)
66 74b9f670 n.hoffmann
	 */
67 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
68 74b9f670 n.hoffmann
	@Override
69 49a64920 Cherian Mathew
	public void setEntity(DerivedUnit entity) {
70 74b9f670 n.hoffmann
		this.entity = entity;
71
		selection_derivedUnit.setEntity(entity);
72
	}
73
74 f561b00c n.hoffmann
	/*
75
	 * (non-Javadoc)
76
	 * 
77
	 * @see
78
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
79
	 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
80 74b9f670 n.hoffmann
	 */
81 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
82 74b9f670 n.hoffmann
	@Override
83
	public void createControls(ICdmFormElement element, int style) {
84 23783f7a n.hoffmann
		selection_derivedUnit = formFactory
85 49a64920 Cherian Mathew
				.createSelectionElement(DerivedUnit.class,
86 f561b00c n.hoffmann
						getConversationHolder(), element, "Derived Unit", null,
87 23783f7a n.hoffmann
						EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
88 74b9f670 n.hoffmann
	}
89
90 f561b00c n.hoffmann
	/*
91
	 * (non-Javadoc)
92
	 * 
93
	 * @see
94
	 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
95
	 * (java.lang.Object)
96 74b9f670 n.hoffmann
	 */
97 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
98 74b9f670 n.hoffmann
	@Override
99
	public void handleEvent(Object eventSource) {
100 f561b00c n.hoffmann
		if (eventSource == selection_derivedUnit) {
101 49a64920 Cherian Mathew
			this.setEntity((DerivedUnit) selection_derivedUnit.getSelection());
102 74b9f670 n.hoffmann
		}
103
	}
104
105
}