merge from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / dna / SampleDesignationTextDetailElement.java
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.occurrence.dna;
12
13 import org.eclipse.swt.events.SelectionListener;
14 import org.eclipse.swt.graphics.Color;
15
16 import eu.etaxonomy.cdm.model.common.Identifier;
17 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
18 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
20 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
21 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
22
23 /**
24 *
25 * @author pplitzner
26 * @date Oct 16, 2014
27 *
28 * @param <T>
29 */
30 public class SampleDesignationTextDetailElement extends
31 AbstractEntityCollectionElement<Identifier> {
32
33 protected TextWithLabelElement text_description;
34
35 /**
36 * @param formFactory
37 * @param section
38 * @param entity
39 * @param removeListener
40 * @param backgroundColor
41 * @param style
42 */
43 public SampleDesignationTextDetailElement(CdmFormFactory formFactory, AbstractFormSection<?> section,
44 Identifier entity, SelectionListener removeListener, Color backgroundColor, int style) {
45 super(formFactory, section, entity, removeListener, backgroundColor, style);
46 }
47
48 /*
49 * (non-Javadoc)
50 *
51 * @see
52 * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
53 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
54 */
55 /** {@inheritDoc} */
56 @Override
57 public void createControls(ICdmFormElement element, int style) {
58 text_description = formFactory.createTextWithLabelElement(element,
59 "Sample Designation", null, style);
60 }
61
62 /* (non-Javadoc)
63 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
64 */
65 @Override
66 public void handleEvent(Object eventSource) {
67 if(eventSource==text_description){
68 this.entity.setIdentifier(text_description.getText());
69 }
70 }
71
72 /* (non-Javadoc)
73 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
74 */
75 @Override
76 public void setEntity(Identifier entity) {
77 this.entity = entity;
78 text_description.setText(entity.getIdentifier());
79 }
80
81 }