4 package eu
.etaxonomy
.taxeditor
.ui
.section
.key
;
6 import org
.eclipse
.swt
.SWT
;
8 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
9 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
10 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmPropertyChangeEvent
;
11 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
12 import eu
.etaxonomy
.taxeditor
.ui
.element
.LayoutConstants
;
13 import eu
.etaxonomy
.taxeditor
.ui
.element
.NumberWithLabelElement
;
14 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
16 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeoScopePolyKeyDetailSection
;
22 public class PolytomousKeyDetailElement
extends
23 AbstractCdmDetailElement
<PolytomousKey
> {
25 private TextWithLabelElement textLabel
;
26 private NumberWithLabelElement numberStartNumber
;
27 private TaxonomicScopeSection sectionTaxonomicScope
;
28 private GeoScopePolyKeyDetailSection sectionGeoScopes
;
29 private ScopeRestrictionSection sectionScopeRestriction
;
31 public PolytomousKeyDetailElement(CdmFormFactory formFactory
,
32 ICdmFormElement formElement
) {
33 super(formFactory
, formElement
);
37 protected void createControls(ICdmFormElement formElement
,
38 PolytomousKey entity
, int style
) {
39 textLabel
= formFactory
.createTextWithLabelElement(formElement
, "Title", entity
.getTitleCache(), style
);
41 numberStartNumber
= formFactory
.createNumberTextWithLabelElement(formElement
, "Start Number", entity
.getStartNumber(), style
);
43 sectionTaxonomicScope
= formFactory
.createTaxonomicScopeSection(getConversationHolder(), formElement
, style
);
44 sectionTaxonomicScope
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
45 sectionTaxonomicScope
.setEntity(entity
);
47 sectionGeoScopes
= formFactory
.createGeoScopePolyKeyDetailSection(getConversationHolder(), formElement
, SWT
.NULL
);
48 sectionGeoScopes
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
49 sectionGeoScopes
.setEntity(entity
);
51 sectionScopeRestriction
= formFactory
.createScopeRestrictionSection(getConversationHolder(), formElement
, SWT
.NULL
);
52 sectionScopeRestriction
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
53 sectionScopeRestriction
.setEntity(entity
);
56 public String
getText() {
57 return textLabel
.getText();
61 public void handleEvent(Object eventSource
) {
62 if(eventSource
==textLabel
){
63 getEntity().setTitleCache(textLabel
.getText(), true);
65 else if(eventSource
==numberStartNumber
){
66 int startNumber
= numberStartNumber
.getInteger() == null?
0 : numberStartNumber
.getInteger();
67 getEntity().setStartNumber(startNumber
);
69 firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));