Project

General

Profile

Download (3.25 KB) Statistics
| Branch: | Tag: | Revision:
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.name;
11

    
12
import org.eclipse.swt.events.SelectionListener;
13

    
14
import eu.etaxonomy.cdm.model.common.TermType;
15
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
16
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
17
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
18
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
22
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
23
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
24
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
25
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractReferencedEntityElement;
26

    
27
/**
28
 * @author n.hoffmann
29
 * @created Nov 5, 2009
30
 * @version 1.0
31
 */
32
public class NomenclaturalStatusElement extends AbstractReferencedEntityElement<NomenclaturalStatus> implements IEntityElement<NomenclaturalStatus>, ISelectableElement{
33

    
34
	private TermComboElement<NomenclaturalStatusType> nomenclaturalStatusTypeCombo;
35

    
36
	private TextWithLabelElement ruleConsideredText;
37

    
38
	private final SelectionArbitrator selectionArbitrator;
39

    
40
	public NomenclaturalStatusElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement,
41
			NomenclaturalStatus element, SelectionListener removeListener, int style) {
42
		super(cdmFormFactory, formElement, element, removeListener, style);
43
		selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
44
	}
45

    
46
	/** {@inheritDoc} */
47
	@Override
48
	public void createControls(ICdmFormElement element, int style) {
49
		nomenclaturalStatusTypeCombo = formFactory.createDefinedTermComboElement(TermType.NomenclaturalStatusType, this, "Nomenclatural Status Type", null, false, style, true);
50
		ruleConsideredText = formFactory.createTextWithLabelElement(this, "Rule Considered", "", style);
51

    
52
		super.createControls(element, style);
53
	}
54

    
55
	/** {@inheritDoc} */
56
	@Override
57
	public void setEntity(NomenclaturalStatus entity) {
58
		super.setEntity(entity);
59
		nomenclaturalStatusTypeCombo.setSelection(entity.getType());
60
		ruleConsideredText.setText(entity.getRuleConsidered());
61
	}
62

    
63
	/**
64
	 * <p>Getter for the field <code>selectionArbitrator</code>.</p>
65
	 *
66
	 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} object.
67
	 */
68
	@Override
69
    public SelectionArbitrator getSelectionArbitrator() {
70
		return selectionArbitrator;
71
	}
72

    
73
	/** {@inheritDoc} */
74
	@Override
75
	public void handleEvent(Object eventSource) {
76
		if(eventSource == nomenclaturalStatusTypeCombo){
77
			getEntity().setType(nomenclaturalStatusTypeCombo.getSelection());
78
		}
79
		else if(eventSource == ruleConsideredText){
80
			getEntity().setRuleConsidered(ruleConsideredText.getText());
81
		}
82
		else if(eventSource == selection_reference){
83
			getEntity().setCitation(selection_reference.getSelection());
84
		}
85
		else if(eventSource == text_referenceDetail){
86
			getEntity().setCitationMicroReference(text_referenceDetail.getText());
87
		}
88
	}
89
}
(13-13/21)