2 * Copyright (C) 2013 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
.derivedUnit
;
11 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
12 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
13 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
14 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
16 import eu
.etaxonomy
.taxeditor
.ui
.element
.ToggleableTextElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
18 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
25 public class PreservedSpecimenGeneralDetailElement
extends AbstractCdmDetailElement
<DerivedUnit
> {
27 private ToggleableTextElement toggleableText_titleCache
;
28 private EntitySelectionElement
<Collection
> selection_collection
;
29 private TextWithLabelElement text_accessionNumber
;
36 public PreservedSpecimenGeneralDetailElement(CdmFormFactory formFactory
,
37 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
,
50 DerivedUnit entity
, int style
) {
51 toggleableText_titleCache
= formFactory
.createToggleableTextField(
52 formElement
, "Title Cache", entity
.getTitleCache(),
53 entity
.isProtectedTitleCache(), style
);
54 selection_collection
= formFactory
55 .createSelectionElement(Collection
.class,
56 getConversationHolder(), formElement
, "Collection",
57 entity
.getCollection(),
58 EntitySelectionElement
.ALL
, style
);
59 text_accessionNumber
= formFactory
.createTextWithLabelElement(
60 formElement
, "Accession Number", entity
.getAccessionNumber(),
68 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
72 public void handleEvent(Object eventSource
) {
73 if (eventSource
== toggleableText_titleCache
) {
74 getEntity().setTitleCache(toggleableText_titleCache
.getText(),
75 toggleableText_titleCache
.getState());
76 } else if (eventSource
== selection_collection
) {
77 getEntity().setCollection(selection_collection
.getSelection());
78 } else if (eventSource
== text_accessionNumber
) {
79 getEntity().setAccessionNumber(text_accessionNumber
.getText());
81 if (eventSource
!= toggleableText_titleCache
) {
82 toggleableText_titleCache
.setText(getEntity().getTitleCache());