1
|
/**
|
2
|
* Copyright (C) 2013 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
|
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
|
10
|
|
11
|
import eu.etaxonomy.cdm.model.molecular.DnaSample;
|
12
|
import eu.etaxonomy.cdm.model.occurrence.Collection;
|
13
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
14
|
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
|
15
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
17
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
19
|
|
20
|
/**
|
21
|
* @author pplitzner
|
22
|
* @date 16.12.2013
|
23
|
*
|
24
|
*/
|
25
|
public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaSample> {
|
26
|
|
27
|
|
28
|
private EntitySelectionElement<Collection> selection_collection;
|
29
|
private TextWithLabelElement textBarcode;
|
30
|
private CheckboxElement checkIsPublish;
|
31
|
|
32
|
public DnaSampleGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
|
33
|
super(formFactory, formElement);
|
34
|
}
|
35
|
|
36
|
@Override
|
37
|
protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
|
38
|
selection_collection = formFactory
|
39
|
.createSelectionElement(Collection.class,
|
40
|
getConversationHolder(), formElement, "Collection",
|
41
|
entity.getCollection(),
|
42
|
EntitySelectionElement.ALL, style);
|
43
|
textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
|
44
|
checkIsPublish = formFactory.createCheckbox(formElement, "Publish", entity.isPublish(), style);
|
45
|
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public void handleEvent(Object eventSource) {
|
50
|
if(eventSource==textBarcode){
|
51
|
getEntity().setBarcode(textBarcode.getText());
|
52
|
}
|
53
|
else if(eventSource==checkIsPublish){
|
54
|
getEntity().setPublish(checkIsPublish.getSelection());
|
55
|
} else if (eventSource == selection_collection) {
|
56
|
getEntity().setCollection(selection_collection.getSelection());
|
57
|
}
|
58
|
}
|
59
|
|
60
|
}
|