2 * Copyright (C) 2014 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
;
11 import eu
.etaxonomy
.cdm
.model
.molecular
.Amplification
;
12 import eu
.etaxonomy
.cdm
.model
.molecular
.AmplificationResult
;
13 import eu
.etaxonomy
.cdm
.model
.molecular
.Primer
;
14 import eu
.etaxonomy
.cdm
.model
.molecular
.SingleRead
;
15 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
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 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
21 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
28 public class SingleReadGeneralDetailElement
extends AbstractCdmDetailElement
<SingleRead
> {
30 private EntitySelectionElement
<Primer
> selectionPrimer
;
31 private EntitySelectionElement
<Amplification
> selectionAmplification
;
37 public SingleReadGeneralDetailElement(CdmFormFactory formFactory
, ICdmFormElement formElement
) {
38 super(formFactory
, formElement
);
45 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
46 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
49 protected void createControls(ICdmFormElement formElement
, SingleRead entity
, int style
) {
50 selectionPrimer
= formFactory
.createSelectionElement(Primer
.class, //getConversationHolder(),
51 formElement
, "Primer", entity
.getPrimer(), EntitySelectionElement
.ALL
, style
);
52 AmplificationResult amplificationResult
= entity
.getAmplificationResult();
53 if(amplificationResult
==null){
54 amplificationResult
= AmplificationResult
.NewInstance();
55 amplificationResult
.addSingleRead(entity
);
57 selectionAmplification
= formFactory
.createSelectionElement(Amplification
.class, //getConversationHolder(),
58 formElement
, "Amplification", amplificationResult
.getAmplification(), EntitySelectionElement
.ALL
, style
);
60 AnnotationSection annotationSection
= formFactory
.createAnnotationSection(getConversationHolder(), formElement
, StoreUtil
.getSectionStyle(AnnotationSection
.class, entity
.getClass().getCanonicalName()));
61 annotationSection
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
62 annotationSection
.setEntity(entity
);
64 AmplificationCloningDetailSection cloningSection
= formFactory
.createAmplificationCloningDetailSection(getConversationHolder(), formElement
, formFactory
.getSelectionProvider(), StoreUtil
.getSectionStyle(AmplificationCloningDetailSection
.class, amplificationResult
.getClass().getCanonicalName()));
65 cloningSection
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
66 cloningSection
.setEntity(amplificationResult
);
68 AmplificationGelPhotoCollectionDetailSection gelPhotoSection
= formFactory
.createAmplificationGelPhotoCollectionDetailSection(getConversationHolder(), formElement
, StoreUtil
.getSectionStyle(AmplificationGelPhotoCollectionDetailSection
.class, amplificationResult
.getClass().getCanonicalName()));
69 gelPhotoSection
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
70 gelPhotoSection
.setEntity(amplificationResult
);
77 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
81 public void handleEvent(Object eventSource
) {
82 if(eventSource
==selectionPrimer
){
83 getEntity().setPrimer(selectionPrimer
.getSelection());
86 if(eventSource
==selectionAmplification
){
87 AmplificationResult amplificationResult
= getEntity().getAmplificationResult();
88 if(amplificationResult
==null){
89 amplificationResult
= AmplificationResult
.NewInstance();
91 amplificationResult
.setAmplification(selectionAmplification
.getSelection());
92 amplificationResult
.addSingleRead(getEntity());