1
|
/**
|
2
|
* Copyright (C) 2020 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.section.reference;
|
10
|
|
11
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
|
14
|
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
|
15
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
16
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
17
|
import eu.etaxonomy.taxeditor.store.StoreUtil;
|
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.section.AbstractCdmDetailElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
|
23
|
|
24
|
/**
|
25
|
* @author k.luther
|
26
|
* @since Jul 1, 2020
|
27
|
*/
|
28
|
public class OriginalSourceElement extends AbstractCdmDetailElement<OriginalSourceBase> implements IPropertyChangeListener{
|
29
|
|
30
|
// protected EnumComboElement<OriginalSourceType> combo_origsourcetype;
|
31
|
|
32
|
private EntitySelectionElement<Reference> selection_Ref;
|
33
|
private OriginalSourceAdvancedSection advancedSection;
|
34
|
|
35
|
|
36
|
// protected EntitySelectionElement<Reference> selection_reference;
|
37
|
// protected TextWithLabelElement text_referenceDetail;
|
38
|
|
39
|
|
40
|
public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
|
41
|
super(formFactory, formElement);
|
42
|
// selectionArbitrator = formFactory.createSelectionArbitrator(this);
|
43
|
}
|
44
|
|
45
|
@Override
|
46
|
protected void createControls(ICdmFormElement formElement, OriginalSourceBase entity, int style) {
|
47
|
|
48
|
selection_Ref = formFactory.createSelectionElement(Reference.class,
|
49
|
formElement, Messages.TaxonNodeWizardPage_PLACEMENT_SOURCE, null,
|
50
|
EntitySelectionElement.DELETABLE, style, 100);
|
51
|
|
52
|
if (entity != null){
|
53
|
selection_Ref.setEntity(entity.getCitation());
|
54
|
}
|
55
|
selection_Ref.setBackground(this.getPersistentBackground());
|
56
|
for (ICdmFormElement element: selection_Ref.getElements()){
|
57
|
element.setBackground(getPersistentBackground());
|
58
|
}
|
59
|
advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
|
60
|
advancedSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
|
61
|
|
62
|
addControl(advancedSection);
|
63
|
addElement(advancedSection);
|
64
|
advancedSection.setBackground(this.getPersistentBackground());
|
65
|
advancedSection.setEntity(entity);
|
66
|
|
67
|
}
|
68
|
|
69
|
@Override
|
70
|
public void handleEvent(Object eventSource) {
|
71
|
if (eventSource.equals(selection_Ref)){
|
72
|
getEntity().setCitation(selection_Ref.getEntity());
|
73
|
}
|
74
|
|
75
|
}
|
76
|
|
77
|
|
78
|
|
79
|
}
|