3 * Copyright (C) 2007 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.
11 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
;
13 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
14 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
15 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
16 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.ToggleableTextElement
;
19 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
24 * @created Dec 16, 2010
27 public class DerivedUnitGeneralDetailElement
extends
28 AbstractCdmDetailElement
<DerivedUnitFacade
> {
30 private ToggleableTextElement toggleableText_titleCache
;
31 private EntitySelectionElement
<Collection
> selection_collection
;
32 private TextWithLabelElement text_accessionNumber
;
40 public DerivedUnitGeneralDetailElement(CdmFormFactory formFactory
,
41 ICdmFormElement formElement
) {
42 super(formFactory
, formElement
);
49 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
50 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
53 protected void createControls(ICdmFormElement formElement
,
54 DerivedUnitFacade entity
, int style
) {
55 toggleableText_titleCache
= formFactory
.createToggleableTextField(
56 formElement
, "Title Cache", entity
.getTitleCache(),
57 entity
.isProtectedTitleCache(), style
);
58 toggleableText_titleCache
.setEnabled(false);
59 selection_collection
= formFactory
60 .createSelectionElement(Collection
.class,
61 getConversationHolder(), formElement
, "Collection",
62 entity
.getCollection(),
63 EntitySelectionElement
.ALL
, style
);
64 text_accessionNumber
= formFactory
.createTextWithLabelElement(
65 formElement
, "Accession Number", entity
.getAccessionNumber(),
74 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
78 public void handleEvent(Object eventSource
) {
79 if (eventSource
== toggleableText_titleCache
) {
80 getEntity().setTitleCache(toggleableText_titleCache
.getText(),
81 toggleableText_titleCache
.getState());
83 else if (eventSource
== selection_collection
) {
84 getEntity().setCollection(selection_collection
.getSelection());
85 } else if (eventSource
== text_accessionNumber
) {
86 getEntity().setAccessionNumber(text_accessionNumber
.getText());
88 if (eventSource
!= toggleableText_titleCache
) {
89 toggleableText_titleCache
.setText(getEntity().getTitleCache());