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
;
12 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
13 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
14 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.compatibility
.ICdmFormElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
16 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.element
.ToggleableTextElement
;
18 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
19 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
26 public class PreservedSpecimenGeneralDetailElement
extends AbstractCdmDetailElement
<DerivedUnit
> {
28 private ToggleableTextElement toggleableText_titleCache
;
29 private EntitySelectionElement
<Collection
> selection_collection
;
30 private TextWithLabelElement text_accessionNumber
;
37 public PreservedSpecimenGeneralDetailElement(CdmFormFactory formFactory
,
38 ICdmFormElement formElement
) {
39 super(formFactory
, formElement
);
46 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
47 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
50 protected void createControls(ICdmFormElement formElement
,
51 DerivedUnit entity
, int style
) {
52 toggleableText_titleCache
= formFactory
.createToggleableTextField(
53 formElement
, "Title Cache", entity
.getTitleCache(),
54 entity
.isProtectedTitleCache(), style
);
55 selection_collection
= formFactory
56 .createSelectionElement(Collection
.class,
57 getConversationHolder(), formElement
, "Collection",
58 entity
.getCollection(),
59 EntitySelectionElement
.ALL
, style
);
60 text_accessionNumber
= formFactory
.createTextWithLabelElement(
61 formElement
, "Accession Number", entity
.getAccessionNumber(),
69 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
73 public void handleEvent(Object eventSource
) {
74 if (eventSource
== toggleableText_titleCache
) {
75 getEntity().setTitleCache(toggleableText_titleCache
.getText(),
76 toggleableText_titleCache
.getState());
77 } else if (eventSource
== selection_collection
) {
78 getEntity().setCollection(selection_collection
.getSelection());
79 } else if (eventSource
== text_accessionNumber
) {
80 getEntity().setAccessionNumber(text_accessionNumber
.getText());
82 if (eventSource
!= toggleableText_titleCache
) {
83 toggleableText_titleCache
.setText(getEntity().getTitleCache());