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
.ICdmFormElement
;
16 import eu
.etaxonomy
.taxeditor
.ui
.forms
.TextWithLabelElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.forms
.ToggleableTextElement
;
18 import eu
.etaxonomy
.taxeditor
.ui
.forms
.CdmFormFactory
.SelectionType
;
19 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.selection
.CollectionSelectionElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.selection
.InstitutionSelectionElement
;
24 * <p>CollectionDetailElement class.</p>
27 * @created Oct 13, 2010
30 public class CollectionDetailElement
extends AbstractCdmDetailElement
<Collection
> {
32 private ToggleableTextElement text_titleCache
;
34 private TextWithLabelElement text_code
;
36 private TextWithLabelElement text_codeStandard
;
38 private TextWithLabelElement text_name
;
40 private TextWithLabelElement text_townOrLocation
;
42 private InstitutionSelectionElement selection_institute
;
44 private CollectionSelectionElement selection_superCollection
;
47 * <p>Constructor for CollectionDetailElement.</p>
49 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
50 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
52 public CollectionDetailElement(CdmFormFactory formFactory
,
53 ICdmFormElement formElement
) {
54 super(formFactory
, formElement
);
58 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
62 protected void createControls(ICdmFormElement formElement
,
63 Collection entity
, int style
) {
64 text_titleCache
= formFactory
.createToggleableTextField(formElement
, "Title Cache", entity
.getTitleCache(), entity
.isProtectedTitleCache(), style
);
66 text_code
= formFactory
.createTextWithLabelElement(formElement
, "Code", entity
.getCode(), style
);
67 text_codeStandard
= formFactory
.createTextWithLabelElement(formElement
, "Code Standard", entity
.getCodeStandard(), style
);
68 text_name
= formFactory
.createTextWithLabelElement(formElement
, "Name", entity
.getName(), style
);
69 text_townOrLocation
= formFactory
.createTextWithLabelElement(formElement
, "Town Or Location", entity
.getTownOrLocation(), style
);
70 selection_institute
= (InstitutionSelectionElement
) formFactory
.createSelectionElement(SelectionType
.INSTITUTION
, getConversationHolder(), formElement
, "Institute", entity
.getInstitute(), style
);
71 selection_superCollection
= (CollectionSelectionElement
) formFactory
.createSelectionElement(SelectionType
.COLLECTION
, getConversationHolder(), formElement
, "Super Collection", entity
.getSuperCollection(), style
);
75 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
79 public void handleEvent(Object eventSource
) {
80 if(eventSource
== text_titleCache
){
81 getEntity().setTitleCache(text_titleCache
.getText(), text_titleCache
.getState());
83 else if(eventSource
== text_code
){
84 getEntity().setCode(text_code
.getText());
86 else if(eventSource
== text_codeStandard
){
87 getEntity().setCodeStandard(text_codeStandard
.getText());
89 else if(eventSource
== text_name
){
90 getEntity().setName(text_name
.getText());
92 else if(eventSource
== text_townOrLocation
){
93 getEntity().setTownOrLocation(text_townOrLocation
.getText());
95 else if(eventSource
== selection_institute
){
96 getEntity().setInstitute(selection_institute
.getSelection());
98 else if(eventSource
== selection_superCollection
){
99 getEntity().setSuperCollection(selection_superCollection
.getSelection());