Project

General

Profile

Download (2.46 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
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.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.ui.section.agent;
12

    
13
import eu.etaxonomy.cdm.model.agent.Institution;
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.CdmFormFactory.SelectionType;
18
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
19
import eu.etaxonomy.taxeditor.ui.selection.InstitutionSelectionElement;
20

    
21
/**
22
 * @author n.hoffmann
23
 * @created Dec 15, 2010
24
 * @version 1.0
25
 */
26
public class InstitutionDetailElement extends AbstractCdmDetailElement<Institution> {
27

    
28
	private TextWithLabelElement text_name;
29
	 
30
	private TextWithLabelElement text_code;
31

    
32
//	private InstitutionTypeSection section_institutionTypes;
33

    
34
	private InstitutionSelectionElement selection_partOfInstitution;
35
	
36
	/**
37
	 * @param formFactory
38
	 * @param formElement
39
	 */
40
	public InstitutionDetailElement(CdmFormFactory formFactory,
41
			ICdmFormElement formElement) {
42
		super(formFactory, formElement);
43
	}
44

    
45
	/* (non-Javadoc)
46
	 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
47
	 */
48
	@Override
49
	protected void createControls(ICdmFormElement formElement,
50
			Institution entity, int style) {
51
		text_name = formFactory.createTextWithLabelElement(formElement, "Name", entity.getName(), style);
52
		text_code = formFactory.createTextWithLabelElement(formElement, "Code", entity.getCode(), style);
53
//		section_institutionTypes
54
		selection_partOfInstitution = (InstitutionSelectionElement) formFactory.createSelectionElement(SelectionType.INSTITUTION, getConversationHolder(), formElement, "Is Part Of", entity.getIsPartOf(), style);
55
	}
56

    
57
	/* (non-Javadoc)
58
	 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
59
	 */
60
	@Override
61
	public void handleEvent(Object eventSource) {
62
		if(eventSource == text_name){
63
			getEntity().setName(text_name.getText());
64
		}
65
		else if(eventSource == text_code){
66
			getEntity().setCode(text_code.getText());
67
		}
68
		else if(eventSource == selection_partOfInstitution){
69
			getEntity().setIsPartOf(selection_partOfInstitution.getSelection());
70
		}
71
	}
72

    
73
}
(1-1/12)