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