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
.name
.NameTypeDesignation
;
17 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignationStatus
;
18 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
19 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.compatibility
.ICdmFormElement
;
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
.selection
.EntitySelectionElement
;
28 * NameTypeDesignationElement class.
32 * @created May 17, 2010
35 public class NameTypeDesignationElement
extends
36 AbstractTypeDesignationElement
<NameTypeDesignation
> {
38 private CheckboxElement checkbox_rejectedType
;
39 private CheckboxElement checkbox_conservedType
;
40 private EntitySelectionElement
<TaxonNameBase
> selection_typeName
;
41 private TermComboElement
<NameTypeDesignationStatus
> combo_typeStatus
;
45 * Constructor for NameTypeDesignationElement.
49 * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
52 * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
55 * a {@link eu.etaxonomy.cdm.model.name.NameTypeDesignation}
57 * @param removeListener
58 * a {@link org.eclipse.swt.events.SelectionListener} object.
62 public NameTypeDesignationElement(CdmFormFactory formFactory
,
63 AbstractFormSection section
, NameTypeDesignation entity
,
64 SelectionListener removeListener
, int style
) {
65 super(formFactory
, section
, entity
, removeListener
, style
);
70 public void createControls(ICdmFormElement formElement
, int style
) {
72 checkbox_rejectedType
= formFactory
.createCheckbox(formElement
,
73 "Rejected Type", false, style
);
74 checkbox_conservedType
= formFactory
.createCheckbox(formElement
,
75 "Conserved Type", false, style
);
76 selection_typeName
= formFactory
77 .createSelectionElement(TaxonNameBase
.class,
78 getConversationHolder(), formElement
, "Name", null,
79 EntitySelectionElement
.ALL
, style
);
80 combo_typeStatus
= formFactory
.createTermComboElement(
81 NameTypeDesignationStatus
.class, 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());