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
.description
.detail
;
12 import org
.eclipse
.swt
.SWT
;
13 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
15 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
16 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
17 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.LayoutConstants
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.TimePeriodElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.description
.ModifierSection
;
27 * <p>Abstract AbstractDetailedDescriptionDetailElement class.</p>
30 * @created Jun 10, 2010
33 public abstract class AbstractDetailedDescriptionDetailElement
<T
extends DescriptionElementBase
> extends AbstractCdmDetailElement
<T
>{
35 TimePeriodElement timePeriod
;
36 ModifierSection section_modifiers
;
37 TextWithLabelElement text_modifyingText
;
40 * <p>Constructor for AbstractDetailedDescriptionDetailElement.</p>
42 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
43 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
44 * @param entity a T object.
46 * @param <T> a T object.
48 public AbstractDetailedDescriptionDetailElement(CdmFormFactory formFactory
,
49 ICdmFormElement formElement
, T entity
, int style
) {
50 super(formFactory
, formElement
);
55 protected void createTimePeriod(ICdmFormElement formElement
, DescriptionElementBase entity
,
57 timePeriod
= formFactory
.createTimePeriodElement(this, "Time scope", entity
.getTimeperiod(), SWT
.WRAP
);
61 protected void createModifier(ICdmFormElement formElement
, DescriptionElementBase entity
,
64 section_modifiers
= formFactory
.createModifierSection(getConversationHolder(), this, ExpandableComposite
.TWISTIE
|ExpandableComposite
.EXPANDED
);
65 section_modifiers
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
66 section_modifiers
.setEntity(entity
);
68 text_modifyingText
= formFactory
.createTextWithLabelElement(this, "Modifying Text", null, style
);
69 if(getEntity().getModifyingText().get(CdmStore
.getDefaultLanguage()) != null) {
70 text_modifyingText
.setText(getEntity().getModifyingText().get(CdmStore
.getDefaultLanguage()).getText());
75 public void handleEvent(Object eventSource
) {
76 if(eventSource
== timePeriod
){
77 getEntity().setTimeperiod(timePeriod
.getTimePeriod());
79 if (eventSource
== text_modifyingText
){
80 getEntity().putModifyingText(LanguageString
.NewInstance(text_modifyingText
.getText(), CdmStore
.getDefaultLanguage()));