Merged refactoring from development branch.
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / NamedAreaDetailElement.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;
12
13 import org.eclipse.swt.events.SelectionListener;
14
15 import eu.etaxonomy.cdm.model.location.NamedArea;
16 import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
17 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
19 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
20 import eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement;
21
22 /**
23 * <p>CollectingAreasDetailElement class.</p>
24 *
25 * @author n.hoffmann
26 * @created Oct 14, 2010
27 * @version 1.0
28 */
29 public class NamedAreaDetailElement extends
30 AbstractEntityCollectionElement<NamedArea> {
31
32 private NamedAreaSelectionElement selection_namedArea;
33
34 /**
35 * <p>Constructor for CollectingAreasDetailElement.</p>
36 *
37 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
38 * @param section a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
39 * @param entity a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
40 * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
41 * @param style a int.
42 */
43 public NamedAreaDetailElement(CdmFormFactory formFactory,
44 AbstractFormSection section, NamedArea entity,
45 SelectionListener removeListener, int style) {
46 super(formFactory, section, entity, removeListener, null, style);
47 }
48
49 /* (non-Javadoc)
50 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
51 */
52 /** {@inheritDoc} */
53 @Override
54 public void setEntity(NamedArea entity) {
55 selection_namedArea.setEntity(entity);
56 }
57
58 /* (non-Javadoc)
59 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
60 */
61 /** {@inheritDoc} */
62 @Override
63 public void createControls(ICdmFormElement element, int style) {
64 selection_namedArea = formFactory.createNamedAreaSelectionElement(element, getConversationHolder(), "Area", null, style);
65 }
66
67 /* (non-Javadoc)
68 * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
69 */
70 /** {@inheritDoc} */
71 @Override
72 public void handleEvent(Object eventSource) {
73 if(eventSource == selection_namedArea){
74 setEntity(selection_namedArea.getSelection());
75 }
76 }
77
78 }