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.agent;
|
11
|
|
12
|
import eu.etaxonomy.cdm.model.agent.Institution;
|
13
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
14
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
15
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
16
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
17
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
18
|
|
19
|
/**
|
20
|
* @author n.hoffmann
|
21
|
* @created Dec 15, 2010
|
22
|
* @version 1.0
|
23
|
*/
|
24
|
public class InstitutionDetailElement extends
|
25
|
AbstractCdmDetailElement<Institution> {
|
26
|
|
27
|
private TextWithLabelElement text_name;
|
28
|
|
29
|
private TextWithLabelElement text_code;
|
30
|
|
31
|
// private InstitutionTypeSection section_institutionTypes;
|
32
|
|
33
|
private EntitySelectionElement<Institution> selection_partOfInstitution;
|
34
|
|
35
|
/**
|
36
|
* @param formFactory
|
37
|
* @param formElement
|
38
|
*/
|
39
|
public InstitutionDetailElement(CdmFormFactory formFactory,
|
40
|
ICdmFormElement formElement) {
|
41
|
super(formFactory, formElement);
|
42
|
}
|
43
|
|
44
|
/*
|
45
|
* (non-Javadoc)
|
46
|
*
|
47
|
* @see
|
48
|
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
|
49
|
* (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
|
50
|
*/
|
51
|
@Override
|
52
|
protected void createControls(ICdmFormElement formElement,
|
53
|
Institution entity, int style) {
|
54
|
this.setWarnForReferencingObjects(formElement);
|
55
|
|
56
|
text_name = formFactory.createTextWithLabelElement(formElement, "Name",
|
57
|
entity.getName(), style);
|
58
|
text_code = formFactory.createTextWithLabelElement(formElement, "Code",
|
59
|
entity.getCode(), style);
|
60
|
// section_institutionTypes
|
61
|
selection_partOfInstitution = formFactory
|
62
|
.createSelectionElement(Institution.class,
|
63
|
//getConversationHolder(),
|
64
|
formElement, "Is Part Of",
|
65
|
entity.getIsPartOf(),
|
66
|
EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.DELETABLE,
|
67
|
style);
|
68
|
}
|
69
|
|
70
|
/*
|
71
|
* (non-Javadoc)
|
72
|
*
|
73
|
* @see
|
74
|
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
|
75
|
* .lang.Object)
|
76
|
*/
|
77
|
@Override
|
78
|
public void handleEvent(Object eventSource) {
|
79
|
if (eventSource == text_name) {
|
80
|
getEntity().setName(text_name.getText());
|
81
|
} else if (eventSource == text_code) {
|
82
|
getEntity().setCode(text_code.getText());
|
83
|
} else if (eventSource == selection_partOfInstitution) {
|
84
|
getEntity().setIsPartOf(selection_partOfInstitution.getSelection());
|
85
|
}
|
86
|
}
|
87
|
|
88
|
}
|