ref #6190 removing svn property place holder in first line of code - java files
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / taxon / TaxonDetailElement.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.taxon;
11
12 import org.eclipse.swt.events.SelectionListener;
13
14 import eu.etaxonomy.cdm.model.taxon.Taxon;
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 * @author n.hoffmann
23 * @created Mar 29, 2011
24 * @version 1.0
25 */
26 public class TaxonDetailElement extends AbstractEntityCollectionElement<Taxon> {
27
28 private EntitySelectionElement<Taxon> selection_taxon;
29
30 /**
31 * @param formFactory
32 * @param section
33 * @param entity
34 * @param removeListener
35 * @param backgroundColor
36 * @param style
37 */
38 public TaxonDetailElement(CdmFormFactory formFactory,
39 AbstractFormSection section, Taxon entity,
40 SelectionListener removeListener, int style) {
41 super(formFactory, section, entity, removeListener, null, style);
42 }
43
44 /*
45 * (non-Javadoc)
46 *
47 * @see
48 * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity
49 * (java.lang.Object)
50 */
51 @Override
52 public void setEntity(Taxon entity) {
53 selection_taxon.setEntity(entity);
54 }
55
56 /*
57 * (non-Javadoc)
58 *
59 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#
60 * createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
61 */
62 @Override
63 public void createControls(ICdmFormElement element, int style) {
64 selection_taxon = formFactory
65 .createSelectionElement(Taxon.class,
66 getConversationHolder(), element, "Taxon", null,
67 EntitySelectionElement.NOTHING, style);
68 }
69
70 /*
71 * (non-Javadoc)
72 *
73 * @see
74 * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent
75 * (java.lang.Object)
76 */
77 @Override
78 public void handleEvent(Object eventSource) {
79 if (eventSource == selection_taxon) {
80 setEntity(selection_taxon.getSelection());
81 }
82 }
83
84 }