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
.occurrence
.Collection
;
14 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
;
15 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.SelectionType
;
16 import eu
.etaxonomy
.taxeditor
.ui
.forms
.ICdmFormElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.forms
.TextWithLabelElement
;
18 import eu
.etaxonomy
.taxeditor
.ui
.forms
.ToggleableTextElement
;
19 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
25 * CollectionDetailElement class.
29 * @created Oct 13, 2010
32 public class CollectionDetailElement
extends
33 AbstractCdmDetailElement
<Collection
> {
35 private ToggleableTextElement text_titleCache
;
37 private TextWithLabelElement text_code
;
39 private TextWithLabelElement text_codeStandard
;
41 private TextWithLabelElement text_name
;
43 private TextWithLabelElement text_townOrLocation
;
45 private InstitutionSelectionElement selection_institute
;
47 private CollectionSelectionElement selection_superCollection
;
51 * Constructor for CollectionDetailElement.
55 * a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
58 * a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
61 public CollectionDetailElement(CdmFormFactory formFactory
,
62 ICdmFormElement formElement
) {
63 super(formFactory
, formElement
);
70 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
71 * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
72 * eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
76 protected void createControls(ICdmFormElement formElement
,
77 Collection entity
, int style
) {
78 text_titleCache
= formFactory
.createToggleableTextField(formElement
,
79 "Title Cache", entity
.getTitleCache(),
80 entity
.isProtectedTitleCache(), style
);
82 text_code
= formFactory
.createTextWithLabelElement(formElement
, "Code",
83 entity
.getCode(), style
);
84 text_codeStandard
= formFactory
.createTextWithLabelElement(formElement
,
85 "Code Standard", entity
.getCodeStandard(), style
);
86 text_name
= formFactory
.createTextWithLabelElement(formElement
, "Name",
87 entity
.getName(), style
);
88 text_townOrLocation
= formFactory
.createTextWithLabelElement(
89 formElement
, "Town Or Location", entity
.getTownOrLocation(),
91 selection_institute
= (InstitutionSelectionElement
) formFactory
92 .createSelectionElement(SelectionType
.INSTITUTION
,
93 getConversationHolder(), formElement
, "Institute",
94 entity
.getInstitute(),
95 InstitutionSelectionElement
.DEFAULT
, style
);
96 selection_superCollection
= (CollectionSelectionElement
) formFactory
97 .createSelectionElement(SelectionType
.COLLECTION
,
98 getConversationHolder(), formElement
,
99 "Super Collection", entity
.getSuperCollection(),
100 CollectionSelectionElement
.DEFAULT
, style
);
107 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
112 public void handleEvent(Object eventSource
) {
113 if (eventSource
== text_titleCache
) {
114 getEntity().setTitleCache(text_titleCache
.getText(),
115 text_titleCache
.getState());
116 } else if (eventSource
== text_code
) {
117 getEntity().setCode(text_code
.getText());
118 } else if (eventSource
== text_codeStandard
) {
119 getEntity().setCodeStandard(text_codeStandard
.getText());
120 } else if (eventSource
== text_name
) {
121 getEntity().setName(text_name
.getText());
122 } else if (eventSource
== text_townOrLocation
) {
123 getEntity().setTownOrLocation(text_townOrLocation
.getText());
124 } else if (eventSource
== selection_institute
) {
125 getEntity().setInstitute(selection_institute
.getSelection());
126 } else if (eventSource
== selection_superCollection
) {
127 getEntity().setSuperCollection(
128 selection_superCollection
.getSelection());