Revision 0122459a
Added by Katja Luther over 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceElement.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import org.eclipse.jface.util.IPropertyChangeListener; |
12 | 12 |
|
13 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
14 |
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase; |
|
15 |
import eu.etaxonomy.cdm.model.description.DescriptionElementSource; |
|
13 | 16 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
14 |
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase; |
|
15 | 17 |
import eu.etaxonomy.cdm.model.reference.Reference; |
18 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
16 | 19 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
17 | 20 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
18 | 21 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
... | ... | |
25 | 28 |
* @author k.luther |
26 | 29 |
* @since Jul 1, 2020 |
27 | 30 |
*/ |
28 |
public class OriginalSourceElement extends AbstractCdmDetailElement<OriginalSourceBase> implements IPropertyChangeListener{
|
|
31 |
public class OriginalSourceElement extends AbstractCdmDetailElement<ReferencedEntityBase> implements IPropertyChangeListener{
|
|
29 | 32 |
|
30 | 33 |
// protected EnumComboElement<OriginalSourceType> combo_origsourcetype; |
31 | 34 |
|
32 | 35 |
private EntitySelectionElement<Reference> selection_Ref; |
33 | 36 |
private OriginalSourceAdvancedSection advancedSection; |
34 | 37 |
|
38 |
private CdmBase cdmEntity; |
|
39 |
|
|
35 | 40 |
|
36 | 41 |
// protected EntitySelectionElement<Reference> selection_reference; |
37 | 42 |
// protected TextWithLabelElement text_referenceDetail; |
38 | 43 |
|
39 | 44 |
|
40 |
public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement) { |
|
45 |
public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity) {
|
|
41 | 46 |
super(formFactory, formElement); |
47 |
this.cdmEntity = cdmEntity; |
|
42 | 48 |
// selectionArbitrator = formFactory.createSelectionArbitrator(this); |
43 | 49 |
} |
44 | 50 |
|
45 | 51 |
@Override |
46 |
protected void createControls(ICdmFormElement formElement, OriginalSourceBase entity, int style) {
|
|
52 |
protected void createControls(ICdmFormElement formElement, ReferencedEntityBase entity, int style) {
|
|
47 | 53 |
|
48 | 54 |
selection_Ref = formFactory.createSelectionElement(Reference.class, |
49 | 55 |
formElement, Messages.TaxonNodeWizardPage_PLACEMENT_SOURCE, null, |
... | ... | |
69 | 75 |
@Override |
70 | 76 |
public void handleEvent(Object eventSource) { |
71 | 77 |
if (eventSource.equals(selection_Ref)){ |
78 |
|
|
79 |
if (getEntity() == null){ |
|
80 |
Reference ref = selection_Ref.getEntity(); |
|
81 |
DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null); |
|
82 |
setEntity(source); |
|
83 |
selection_Ref.setEntity(ref); |
|
84 |
if (cdmEntity != null && cdmEntity instanceof TaxonNode){ |
|
85 |
((TaxonNode)cdmEntity).setSource(source); |
|
86 |
} |
|
87 |
} |
|
88 |
//TODO: why is this null????ß |
|
72 | 89 |
getEntity().setCitation(selection_Ref.getEntity()); |
90 |
|
|
73 | 91 |
} |
74 | 92 |
|
75 | 93 |
} |
76 | 94 |
|
95 |
/** |
|
96 |
* @param cdmEntity2 |
|
97 |
*/ |
|
98 |
public void setCdmEntity(CdmBase cdmEntity) { |
|
99 |
this.cdmEntity = cdmEntity; |
|
100 |
|
|
101 |
} |
|
102 |
|
|
77 | 103 |
|
78 | 104 |
|
79 | 105 |
} |
Also available in: Unified diff
ref #9116: add single source element to taxon node details and restructure the wizard