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
.model
.agent
.Institution
;
14 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
15 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.compatibility
.ICdmFormElement
;
16 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
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 * CollectionDetailElement class.
28 * @created Oct 13, 2010
31 public class CollectionDetailElement
extends
32 AbstractCdmDetailElement
<Collection
> {
34 private ToggleableTextElement text_titleCache
;
36 private TextWithLabelElement text_code
;
38 private TextWithLabelElement text_codeStandard
;
40 private TextWithLabelElement text_name
;
42 private TextWithLabelElement text_townOrLocation
;
44 private EntitySelectionElement
<Institution
> selection_institute
;
46 private EntitySelectionElement
<Collection
> selection_superCollection
;
50 * Constructor for CollectionDetailElement.
54 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
57 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
60 public CollectionDetailElement(CdmFormFactory formFactory
,
61 ICdmFormElement formElement
) {
62 super(formFactory
, formElement
);
69 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
70 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
71 * eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
75 protected void createControls(ICdmFormElement formElement
,
76 Collection entity
, int style
) {
77 text_titleCache
= formFactory
.createToggleableTextField(formElement
,
78 "Title Cache", entity
.getTitleCache(),
79 entity
.isProtectedTitleCache(), style
);
81 text_code
= formFactory
.createTextWithLabelElement(formElement
, "Code",
82 entity
.getCode(), style
);
83 text_codeStandard
= formFactory
.createTextWithLabelElement(formElement
,
84 "Code Standard", entity
.getCodeStandard(), style
);
85 text_name
= formFactory
.createTextWithLabelElement(formElement
, "Name",
86 entity
.getName(), style
);
87 text_townOrLocation
= formFactory
.createTextWithLabelElement(
88 formElement
, "Town Or Location", entity
.getTownOrLocation(),
90 selection_institute
= formFactory
91 .createSelectionElement(Institution
.class,
92 getConversationHolder(), formElement
, "Institute",
93 entity
.getInstitute(),
94 EntitySelectionElement
.ALL
, style
);
95 selection_superCollection
= formFactory
96 .createSelectionElement(Collection
.class,
97 getConversationHolder(), formElement
,
98 "Super Collection", entity
.getSuperCollection(),
99 EntitySelectionElement
.ALL
, style
);
106 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
111 public void handleEvent(Object eventSource
) {
112 if (eventSource
== text_titleCache
) {
113 getEntity().setTitleCache(text_titleCache
.getText(),
114 text_titleCache
.getState());
115 } else if (eventSource
== text_code
) {
116 getEntity().setCode(text_code
.getText());
117 } else if (eventSource
== text_codeStandard
) {
118 getEntity().setCodeStandard(text_codeStandard
.getText());
119 } else if (eventSource
== text_name
) {
120 getEntity().setName(text_name
.getText());
121 } else if (eventSource
== text_townOrLocation
) {
122 getEntity().setTownOrLocation(text_townOrLocation
.getText());
123 } else if (eventSource
== selection_institute
) {
124 getEntity().setInstitute(selection_institute
.getSelection());
125 } else if (eventSource
== selection_superCollection
) {
126 getEntity().setSuperCollection(
127 selection_superCollection
.getSelection());