3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.ui
.section
.name
;
13 import org
.eclipse
.swt
.events
.SelectionListener
;
15 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
16 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
17 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
18 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignationStatus
;
19 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
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
.CheckboxElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
25 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
29 * NameTypeDesignationElement class.
33 * @created May 17, 2010
36 public class NameTypeDesignationElement
extends
37 AbstractTypeDesignationElement
<NameTypeDesignation
> {
39 private CheckboxElement checkbox_rejectedType
;
40 private CheckboxElement checkbox_conservedType
;
41 private EntitySelectionElement
<TaxonNameBase
> selection_typeName
;
42 private TermComboElement
<NameTypeDesignationStatus
> combo_typeStatus
;
46 * Constructor for NameTypeDesignationElement.
50 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
53 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
56 * a {@link eu.etaxonomy.cdm.model.name.NameTypeDesignation}
58 * @param removeListener
59 * a {@link org.eclipse.swt.events.SelectionListener} object.
63 public NameTypeDesignationElement(CdmFormFactory formFactory
,
64 AbstractFormSection section
, NameTypeDesignation entity
,
65 SelectionListener removeListener
, int style
) {
66 super(formFactory
, section
, entity
, removeListener
, style
);
71 public void createControls(ICdmFormElement formElement
, int style
) {
73 checkbox_rejectedType
= formFactory
.createCheckbox(formElement
,
74 "Rejected Type", false, style
);
75 checkbox_conservedType
= formFactory
.createCheckbox(formElement
,
76 "Conserved Type", false, style
);
77 selection_typeName
= formFactory
78 .createSelectionElement(TaxonNameBase
.class,
79 getConversationHolder(), formElement
, "Name", null,
80 EntitySelectionElement
.ALL
, style
);
81 combo_typeStatus
= formFactory
.createDefinedTermComboElement(TermType
.NameTypeDesignationStatus
, formElement
,
82 "Designation Status", null, style
);
84 super.createControls(formElement
, style
);
89 public void setEntity(NameTypeDesignation entity
) {
90 super.setEntity(entity
);
91 checkbox_conservedType
.setSelection(entity
.isConservedType());
92 checkbox_rejectedType
.setSelection(entity
.isRejectedType());
94 selection_typeName
.setEntity((TaxonNameBase
) HibernateProxyHelper
.deproxy(entity
.getTypeName()));
96 combo_typeStatus
.setSelection((NameTypeDesignationStatus
) HibernateProxyHelper
.deproxy(entity
.getTypeStatus()));
98 checkbox_notDesignated
.setSelection(entity
.isNotDesignated());
103 public void handleEvent(Object eventSource
) {
104 if (eventSource
== checkbox_conservedType
) {
105 getEntity().setConservedType(checkbox_conservedType
.getSelection());
106 } else if (eventSource
== checkbox_rejectedType
) {
107 getEntity().setRejectedType(checkbox_rejectedType
.getSelection());
108 } else if (eventSource
== selection_typeName
) {
109 getEntity().setTypeName(selection_typeName
.getEntity());
110 } else if (eventSource
== combo_typeStatus
) {
111 getEntity().setTypeStatus(combo_typeStatus
.getSelection());
112 } else if (eventSource
== checkbox_notDesignated
) {
113 getEntity().setNotDesignated(checkbox_notDesignated
.getSelection());
114 } else if (eventSource
== selection_reference
) {
115 getEntity().setCitation(selection_reference
.getSelection());
116 } else if (eventSource
== text_referenceDetail
) {
117 getEntity().setCitationMicroReference(
118 text_referenceDetail
.getText());
119 } else if (eventSource
== text_originaleNameString
) {
120 getEntity().setOriginalNameString(
121 text_originaleNameString
.getText());