1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.ui.section.occurrence;
|
11
|
|
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;
|
20
|
|
21
|
/**
|
22
|
* <p>
|
23
|
* CollectionDetailElement class.
|
24
|
* </p>
|
25
|
*
|
26
|
* @author n.hoffmann
|
27
|
* @created Oct 13, 2010
|
28
|
* @version 1.0
|
29
|
*/
|
30
|
public class CollectionDetailElement extends
|
31
|
AbstractCdmDetailElement<Collection> {
|
32
|
|
33
|
private ToggleableTextElement text_titleCache;
|
34
|
|
35
|
private TextWithLabelElement text_code;
|
36
|
|
37
|
private TextWithLabelElement text_codeStandard;
|
38
|
|
39
|
private TextWithLabelElement text_name;
|
40
|
|
41
|
private TextWithLabelElement text_townOrLocation;
|
42
|
|
43
|
private EntitySelectionElement<Institution> selection_institute;
|
44
|
|
45
|
private EntitySelectionElement<Collection> selection_superCollection;
|
46
|
|
47
|
/**
|
48
|
* <p>
|
49
|
* Constructor for CollectionDetailElement.
|
50
|
* </p>
|
51
|
*
|
52
|
* @param formFactory
|
53
|
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
|
54
|
* object.
|
55
|
* @param formElement
|
56
|
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
|
57
|
* object.
|
58
|
*/
|
59
|
public CollectionDetailElement(CdmFormFactory formFactory,
|
60
|
ICdmFormElement formElement) {
|
61
|
super(formFactory, formElement);
|
62
|
}
|
63
|
|
64
|
/*
|
65
|
* (non-Javadoc)
|
66
|
*
|
67
|
* @see
|
68
|
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
|
69
|
* (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
|
70
|
* eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
|
71
|
*/
|
72
|
/** {@inheritDoc} */
|
73
|
@Override
|
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);
|
79
|
|
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(),
|
88
|
style);
|
89
|
selection_institute = formFactory
|
90
|
.createSelectionElement(Institution.class,//getConversationHolder(),
|
91
|
formElement, "Institute",
|
92
|
entity.getInstitute(),
|
93
|
EntitySelectionElement.ALL, style);
|
94
|
selection_superCollection = formFactory
|
95
|
.createSelectionElement(Collection.class,//getConversationHolder(),
|
96
|
formElement,
|
97
|
"Super Collection", entity.getSuperCollection(),
|
98
|
EntitySelectionElement.ALL, style);
|
99
|
}
|
100
|
|
101
|
/*
|
102
|
* (non-Javadoc)
|
103
|
*
|
104
|
* @see
|
105
|
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
|
106
|
* .lang.Object)
|
107
|
*/
|
108
|
/** {@inheritDoc} */
|
109
|
@Override
|
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());
|
127
|
}
|
128
|
if (eventSource != text_titleCache) {
|
129
|
text_titleCache.setText(getEntity().getTitleCache());
|
130
|
}
|
131
|
|
132
|
}
|
133
|
|
134
|
}
|