3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.dna
;
12 import eu
.etaxonomy
.cdm
.model
.molecular
.DnaSample
;
13 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
14 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
15 import eu
.etaxonomy
.taxeditor
.ui
.element
.CheckboxElement
;
16 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
18 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
19 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
26 public class DnaSampleGeneralDetailElement
extends AbstractCdmDetailElement
<DnaSample
> {
29 private EntitySelectionElement
<Collection
> selection_collection
;
30 private TextWithLabelElement textBarcode
;
31 private CheckboxElement checkIsPublish
;
33 public DnaSampleGeneralDetailElement(CdmFormFactory formFactory
, ICdmFormElement formElement
) {
34 super(formFactory
, formElement
);
38 protected void createControls(ICdmFormElement formElement
, DnaSample entity
, int style
) {
39 selection_collection
= formFactory
40 .createSelectionElement(Collection
.class,
41 getConversationHolder(), formElement
, "Collection",
42 entity
.getCollection(),
43 EntitySelectionElement
.ALL
, style
);
44 textBarcode
= formFactory
.createTextWithLabelElement(formElement
, "Barcode", entity
.getBarcode(), style
);
45 checkIsPublish
= formFactory
.createCheckbox(formElement
, "Publish", entity
.isPublish(), style
);
50 public void handleEvent(Object eventSource
) {
51 if(eventSource
==textBarcode
){
52 getEntity().setBarcode(textBarcode
.getText());
54 else if(eventSource
==checkIsPublish
){
55 getEntity().setPublish(checkIsPublish
.getSelection());
56 } else if (eventSource
== selection_collection
) {
57 getEntity().setCollection(selection_collection
.getSelection());