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 * @created Oct 13, 2010
25 public class CollectionDetailElement
extends
26 AbstractCdmDetailElement
<Collection
> {
28 private ToggleableTextElement text_titleCache
;
30 private TextWithLabelElement text_code
;
32 private TextWithLabelElement text_codeStandard
;
34 private TextWithLabelElement text_name
;
36 private TextWithLabelElement text_townOrLocation
;
38 private EntitySelectionElement
<Institution
> selection_institute
;
40 private EntitySelectionElement
<Collection
> selection_superCollection
;
44 * Constructor for CollectionDetailElement.
48 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
51 * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
54 public CollectionDetailElement(CdmFormFactory formFactory
,
55 ICdmFormElement formElement
) {
56 super(formFactory
, formElement
);
60 protected void createControls(ICdmFormElement formElement
,
61 Collection entity
, int style
) {
62 text_titleCache
= formFactory
.createToggleableTextField(formElement
,
63 "Title Cache", entity
.getTitleCache(),
64 entity
.isProtectedTitleCache(), style
);
66 text_code
= formFactory
.createTextWithLabelElement(formElement
, "Code",
67 entity
.getCode(), style
);
68 text_codeStandard
= formFactory
.createTextWithLabelElement(formElement
,
69 "Code Standard", entity
.getCodeStandard(), style
);
70 text_name
= formFactory
.createTextWithLabelElement(formElement
, "Name",
71 entity
.getName(), style
);
72 text_townOrLocation
= formFactory
.createTextWithLabelElement(
73 formElement
, "Town Or Location", entity
.getTownOrLocation(),
75 selection_institute
= formFactory
76 .createSelectionElement(Institution
.class,//getConversationHolder(),
77 formElement
, "Institute",
78 entity
.getInstitute(),
79 EntitySelectionElement
.ALL
, style
);
80 selection_superCollection
= formFactory
81 .createSelectionElement(Collection
.class,//getConversationHolder(),
83 "Super Collection", entity
.getSuperCollection(),
84 EntitySelectionElement
.ALL
, style
);
88 public void handleEvent(Object eventSource
) {
89 if (eventSource
== text_titleCache
) {
90 getEntity().setTitleCache(text_titleCache
.getText(),
91 text_titleCache
.getState());
92 } else if (eventSource
== text_code
) {
93 getEntity().setCode(text_code
.getText());
94 } else if (eventSource
== text_codeStandard
) {
95 getEntity().setCodeStandard(text_codeStandard
.getText());
96 } else if (eventSource
== text_name
) {
97 getEntity().setName(text_name
.getText());
98 } else if (eventSource
== text_townOrLocation
) {
99 getEntity().setTownOrLocation(text_townOrLocation
.getText());
100 } else if (eventSource
== selection_institute
) {
101 getEntity().setInstitute(selection_institute
.getSelection());
102 } else if (eventSource
== selection_superCollection
) {
103 getEntity().setSuperCollection(
104 selection_superCollection
.getSelection());
106 if (eventSource
!= text_titleCache
) {
107 text_titleCache
.setText(getEntity().getTitleCache());