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