2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.name
;
12 import org
.eclipse
.swt
.events
.SelectionListener
;
14 import eu
.etaxonomy
.cdm
.api
.service
.IVocabularyService
;
15 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
16 import eu
.etaxonomy
.cdm
.model
.common
.VocabularyEnum
;
17 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
18 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
19 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
20 import eu
.etaxonomy
.taxeditor
.ui
.combo
.TermComboElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.AbstractFormSection
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.element
.IEntityElement
;
25 import eu
.etaxonomy
.taxeditor
.ui
.element
.ISelectableElement
;
26 import eu
.etaxonomy
.taxeditor
.ui
.element
.SelectionArbitrator
;
27 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
28 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AbstractReferencedEntityElement
;
32 * @created Nov 5, 2009
35 public class NomenclaturalStatusElement
extends AbstractReferencedEntityElement
<NomenclaturalStatus
> implements IEntityElement
<NomenclaturalStatus
>, ISelectableElement
{
37 private TermComboElement
<NomenclaturalStatusType
> nomenclaturalStatusTypeCombo
;
39 private TextWithLabelElement ruleConsideredText
;
41 private final SelectionArbitrator selectionArbitrator
;
43 public NomenclaturalStatusElement(CdmFormFactory cdmFormFactory
, AbstractFormSection formElement
,
44 NomenclaturalStatus element
, SelectionListener removeListener
, int style
) {
45 super(cdmFormFactory
, formElement
, element
, removeListener
, style
);
46 selectionArbitrator
= cdmFormFactory
.createSelectionArbitrator(this);
51 public void createControls(ICdmFormElement element
, int style
) {
52 TermVocabulary vocabulary
= CdmStore
.getService(IVocabularyService
.class).find(VocabularyEnum
.NomenclaturalStatusType
.getUuid());
53 nomenclaturalStatusTypeCombo
= formFactory
.createDefinedTermComboElement(vocabulary
, this, "Nomenclatural Status Type", null,false, style
, true);
54 ruleConsideredText
= formFactory
.createTextWithLabelElement(this, "Rule Considered", "", style
);
56 super.createControls(element
, style
);
61 public void setEntity(NomenclaturalStatus entity
) {
62 super.setEntity(entity
);
63 nomenclaturalStatusTypeCombo
.setSelection(entity
.getType());
64 ruleConsideredText
.setText(entity
.getRuleConsidered());
68 * <p>Getter for the field <code>selectionArbitrator</code>.</p>
70 * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} object.
73 public SelectionArbitrator
getSelectionArbitrator() {
74 return selectionArbitrator
;
79 public void handleEvent(Object eventSource
) {
80 if(eventSource
== nomenclaturalStatusTypeCombo
){
81 getEntity().setType(nomenclaturalStatusTypeCombo
.getSelection());
83 else if(eventSource
== ruleConsideredText
){
84 getEntity().setRuleConsidered(ruleConsideredText
.getText());
86 else if(eventSource
== selection_reference
){
87 getEntity().setCitation(selection_reference
.getSelection());
89 else if(eventSource
== text_referenceDetail
){
90 getEntity().setCitationMicroReference(text_referenceDetail
.getText());