2 * Copyright (C) 2007 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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
;
12 import eu
.etaxonomy
.cdm
.model
.agent
.Institution
;
13 import eu
.etaxonomy
.cdm
.model
.occurrence
.Collection
;
14 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
15 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
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
;
23 * CollectionDetailElement class.
27 * @created Oct 13, 2010
30 public class CollectionDetailElement
extends
31 AbstractCdmDetailElement
<Collection
> {
33 private ToggleableTextElement text_titleCache
;
35 private TextWithLabelElement text_code
;
37 private TextWithLabelElement text_codeStandard
;
39 private TextWithLabelElement text_name
;
41 private TextWithLabelElement text_townOrLocation
;
43 private EntitySelectionElement
<Institution
> selection_institute
;
45 private EntitySelectionElement
<Collection
> selection_superCollection
;
49 * Constructor for CollectionDetailElement.
53 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
56 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
59 public CollectionDetailElement(CdmFormFactory formFactory
,
60 ICdmFormElement formElement
) {
61 super(formFactory
, formElement
);
68 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
69 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
70 * eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
74 protected void createControls(ICdmFormElement formElement
,
75 Collection entity
, int style
) {
76 text_titleCache
= formFactory
.createToggleableTextField(formElement
,
77 "Title Cache", entity
.getTitleCache(),
78 entity
.isProtectedTitleCache(), style
);
80 text_code
= formFactory
.createTextWithLabelElement(formElement
, "Code",
81 entity
.getCode(), style
);
82 text_codeStandard
= formFactory
.createTextWithLabelElement(formElement
,
83 "Code Standard", entity
.getCodeStandard(), style
);
84 text_name
= formFactory
.createTextWithLabelElement(formElement
, "Name",
85 entity
.getName(), style
);
86 text_townOrLocation
= formFactory
.createTextWithLabelElement(
87 formElement
, "Town Or Location", entity
.getTownOrLocation(),
89 selection_institute
= formFactory
90 .createSelectionElement(Institution
.class,
91 getConversationHolder(), formElement
, "Institute",
92 entity
.getInstitute(),
93 EntitySelectionElement
.ALL
, style
);
94 selection_superCollection
= formFactory
95 .createSelectionElement(Collection
.class,
96 getConversationHolder(), formElement
,
97 "Super Collection", entity
.getSuperCollection(),
98 EntitySelectionElement
.ALL
, style
);
105 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
110 public void handleEvent(Object eventSource
) {
111 if (eventSource
== text_titleCache
) {
112 getEntity().setTitleCache(text_titleCache
.getText(),
113 text_titleCache
.getState());
114 } else if (eventSource
== text_code
) {
115 getEntity().setCode(text_code
.getText());
116 } else if (eventSource
== text_codeStandard
) {
117 getEntity().setCodeStandard(text_codeStandard
.getText());
118 } else if (eventSource
== text_name
) {
119 getEntity().setName(text_name
.getText());
120 } else if (eventSource
== text_townOrLocation
) {
121 getEntity().setTownOrLocation(text_townOrLocation
.getText());
122 } else if (eventSource
== selection_institute
) {
123 getEntity().setInstitute(selection_institute
.getSelection());
124 } else if (eventSource
== selection_superCollection
) {
125 getEntity().setSuperCollection(
126 selection_superCollection
.getSelection());