Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / dna / SampleDesignationDetailElement.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.occurrence.dna;
11
12 import org.eclipse.ui.forms.widgets.ExpandableComposite;
13
14 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
15 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
16 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
17 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
18 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
19
20 /**
21 *
22 * @author pplitzner
23 * @date Oct 20, 2014
24 *
25 */
26 public class SampleDesignationDetailElement extends AbstractCdmDetailElement<IdentifiableEntity<?>> {
27
28 private CurrentSampleDesignationDetailSection sectionCurrentSampleDesignation;
29
30 private SampleDesignationHistoryDetailSection sectionSampleDesignationHistory;
31
32 /**
33 * @param formFactory
34 * @param formElement
35 */
36 public SampleDesignationDetailElement(CdmFormFactory formFactory,
37 ICdmFormElement formElement) {
38 super(formFactory, formElement);
39 }
40
41 /* (non-Javadoc)
42 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, java.lang.Object, int)
43 */
44 @Override
45 protected void createControls(ICdmFormElement formElement,
46 IdentifiableEntity<?> entity, int style) {
47
48 sectionCurrentSampleDesignation = formFactory.createCurrentSampleDesignationDetailSection(getConversationHolder(), formElement, ExpandableComposite.EXPANDED);
49 sectionCurrentSampleDesignation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
50 sectionCurrentSampleDesignation.setEntity(entity);
51
52 sectionSampleDesignationHistory = formFactory.createSampleDesignationHistoryDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
53 sectionSampleDesignationHistory.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
54 sectionSampleDesignationHistory.setEntity(entity);
55
56 }
57
58 /* (non-Javadoc)
59 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
60 */
61 @Override
62 public void handleEvent(Object eventSource) {
63 if(eventSource == sectionCurrentSampleDesignation){
64 sectionSampleDesignationHistory.refresh();
65 }
66 }
67
68 }