Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / DerivedUnitElement.java
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, getConversationHolder(), element,
74 "Specimen", null, EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE,
75 style);
76 }
77
78 /*
79 * (non-Javadoc)
80 *
81 * @see
82 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
83 * (java.lang.Object)
84 */
85 /** {@inheritDoc} */
86 @Override
87 public void handleEvent(Object eventSource) {
88 if(eventSource == selection_derivedUnit){
89 setEntity(selection_derivedUnit.getSelection());
90 }
91 }
92
93 /** {@inheritDoc} */
94 @Override
95 public void setEntity(SpecimenOrObservationBase entity) {
96 this.entity = entity;
97 }
98
99 }