Project

General

Profile

« Previous | Next » 

Revision 82d37a4c

Added by Katja Luther over 3 years ago

ref #9199: adapt editor to SingleSourcedEntityBase

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameRelationshipDetailElement.java
22 22
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
23 23
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
24 24
import eu.etaxonomy.taxeditor.ui.element.LabelElement;
25
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractReferencedEntityElement;
25
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
26
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSingleSourceElement;
26 27
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
27 28

  
28 29
/**
......
31 32
 * @author n.hoffmann
32 33
 * @created Mar 18, 2010
33 34
 */
34
public class NameRelationshipDetailElement extends AbstractReferencedEntityElement<NameRelationship>{
35
public class NameRelationshipDetailElement extends AbstractSingleSourceElement<NameRelationship>{
35 36

  
36 37
	private RuleConsideredElement ruleConsidered;
37 38
	private EntitySelectionElement<?> selection_toName;
......
85 86
		else if(eventSource == selection_toName){
86 87
			MessagingUtils.error(getClass(), "No API call available.", null);
87 88
		}
88
		else if(eventSource == selection_reference){
89
			getEntity().setCitation(selection_reference.getSelection());
90
		}
91
		else if(eventSource == text_referenceDetail){
92
			getEntity().setCitationMicroReference(text_referenceDetail.getText());
93
		}
89

  
90

  
94 91
	}
95 92

  
96 93
	@Override
......
100 97
        }
101 98
		super.setBackground(color);
102 99
	}
100

  
101
    @Override
102
    public SelectionArbitrator getSelectionArbitrator() {
103
        // TODO Auto-generated method stub
104
        return null;
105
    }
103 106
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSingleSourceElement.java
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.supplemental;
10

  
11
import org.eclipse.swt.events.SelectionListener;
12

  
13
import eu.etaxonomy.cdm.model.common.SingleSourcedEntityBase;
14
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
15
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
16
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
17
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
18
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
19
import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceElement;
20

  
21
/**
22
 * @author k.luther
23
 * @since Aug 18, 2020
24
 */
25
public abstract class AbstractSingleSourceElement <T extends SingleSourcedEntityBase>
26
            extends AbstractEntityCollectionElement<T> implements ISelectableElement{
27

  
28
    private OriginalSourceElement singleSourceSection;
29

  
30
    /**
31
     * @param formFactory
32
     * @param section
33
     * @param entity
34
     * @param removeListener
35
     * @param backgroundColor
36
     * @param style
37
     */
38
    public AbstractSingleSourceElement(CdmFormFactory formFactory, AbstractFormSection formElement, T entity, SelectionListener removeListener,
39
            int style) {
40
        super(formFactory,formElement, entity, removeListener, null, style);
41
        // TODO Auto-generated constructor stub
42
    }
43

  
44

  
45

  
46
    @Override
47
    public void setEntity(T entity) {
48
        this.entity = entity;
49

  
50
    }
51

  
52
    @Override
53
    public void createControls(ICdmFormElement formElement, int style) {
54
        singleSourceSection = formFactory.createOriginalSourceElement(formElement, entity);
55
    }
56

  
57

  
58
}

Also available in: Unified diff