Project

General

Profile

« Previous | Next » 

Revision 341ee745

Added by Katja Luther about 5 years ago

adadpt editor to changes in TypeDesignationBase

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AbstractTypeDesignationElement.java
16 16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17 17
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
18 18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractReferencedEntityElement;
19
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSourcedEntityBaseElement;
20 20

  
21 21
/**
22 22
 * <p>Abstract AbstractTypeDesignationElement class.</p>
......
25 25
 * @created May 17, 2010
26 26
 * @version 1.0
27 27
 */
28
public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBase> extends AbstractReferencedEntityElement<T> {
28
public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBase> extends AbstractSourcedEntityBaseElement<T> {
29 29

  
30 30
	protected CheckboxElement checkbox_notDesignated;
31 31

  
......
43 43
	public AbstractTypeDesignationElement(CdmFormFactory formFactory,
44 44
			AbstractFormSection section, T entity,
45 45
			SelectionListener removeListener, int style) {
46
		super(formFactory, section, entity, removeListener, style, false);
46
		super(formFactory, section, entity, removeListener, style);
47 47
	}
48 48

  
49 49
	/** {@inheritDoc} */
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameTypeDesignationElement.java
88 88
			getEntity().setTypeStatus(combo_typeStatus.getSelection());
89 89
		} else if (eventSource == checkbox_notDesignated) {
90 90
			getEntity().setNotDesignated(checkbox_notDesignated.getSelection());
91
		} else if (eventSource == selection_reference) {
92
			getEntity().setCitation(selection_reference.getSelection());
93
		} else if (eventSource == text_referenceDetail) {
94
			getEntity().setCitationMicroReference(
95
					text_referenceDetail.getText());
96 91
		}
92
//		else if (eventSource == selection_reference) {
93
//			getEntity().setCitation(selection_reference.getSelection());
94
//		} else if (eventSource == text_referenceDetail) {
95
//			getEntity().setCitationMicroReference(
96
//					text_referenceDetail.getText());
97
//		}
97 98
	}
98 99
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SpecimenTypeDesignationElement.java
93 93
			getEntity().setTypeSpecimen(selection_typeSpecimen.getSelection());
94 94
		} else if (eventSource == checkbox_notDesignated) {
95 95
			getEntity().setNotDesignated(checkbox_notDesignated.getSelection());
96
		} else if (eventSource == selection_reference) {
97
			getEntity().setCitation(selection_reference.getSelection());
98
		} else if (eventSource == text_referenceDetail) {
99
			getEntity().setCitationMicroReference(
100
					text_referenceDetail.getText());
101 96
		}
97
//		else if (eventSource == selection_reference) {
98
//			getEntity().setCitation(selection_reference.getSelection());
99
//		} else if (eventSource == text_referenceDetail) {
100
//			getEntity().setCitationMicroReference(
101
//					text_referenceDetail.getText());
102
//		}
102 103
	}
103 104
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/DerivedUnitTypeDesignationElement.java
98 98
            getEntity().setTypeStatus(combo_typeStatus.getSelection());
99 99
        } else if (eventSource == checkbox_notDesignated) {
100 100
            getEntity().setNotDesignated(checkbox_notDesignated.getSelection());
101
        } else if (eventSource == selection_reference) {
102
            getEntity().setCitation(selection_reference.getSelection());
103
        } else if (eventSource == text_referenceDetail) {
104
            getEntity().setCitationMicroReference(
105
                    text_referenceDetail.getText());
106 101
        }
102
//        else if (eventSource == selection_reference) {
103
//            getEntity().setCitation(selection_reference.getSelection());
104
//        } else if (eventSource == text_referenceDetail) {
105
//            getEntity().setCitationMicroReference(
106
//                    text_referenceDetail.getText());
107
//        }
107 108
    }
108 109

  
109 110
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSourcedEntityBaseElement.java
1
/**
2
* Copyright (C) 2019 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
import org.eclipse.ui.forms.widgets.ExpandableComposite;
13

  
14
import eu.etaxonomy.cdm.model.common.SourcedEntityBase;
15
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
19
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
20
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
22

  
23
/**
24
 * @author k.luther
25
 * @since 26 Feb 2019
26
 *
27
 */
28
public abstract class AbstractSourcedEntityBaseElement<T extends SourcedEntityBase> extends AbstractEntityCollectionElement<T> implements ISelectableElement{
29

  
30
    private SelectionArbitrator selectionArbitrator;
31

  
32
    protected SourceSection sources;
33

  
34

  
35
    /**
36
     * @param formFactory
37
     * @param section
38
     * @param entity
39
     * @param removeListener
40
     * @param backgroundColor
41
     * @param style
42
     */
43
    public AbstractSourcedEntityBaseElement(CdmFormFactory formFactory, AbstractFormSection section, T entity,
44
            SelectionListener removeListener, int style) {
45
        super(formFactory, section, entity, removeListener, null, style);
46
        // make this element selectable
47
        if(formFactory.getSelectionProvider() != null){
48
            selectionArbitrator = formFactory.createSelectionArbitrator(this);
49
        }
50

  
51
    }
52

  
53
    /**
54
     * {@inheritDoc}
55
     */
56
    @Override
57
    public SelectionArbitrator getSelectionArbitrator() {
58
       return selectionArbitrator;
59
    }
60

  
61
    /**
62
     * {@inheritDoc}
63
     */
64
    @Override
65
    public void setEntity(T entity) {
66
        this.entity = entity;
67
        sources.setEntity(entity);
68

  
69
    }
70

  
71
    /**
72
     * {@inheritDoc}
73
     */
74
    @Override
75
    public void createControls(ICdmFormElement element, int style) {
76
        sources = formFactory.createSourceSection(getConversationHolder(), element, ExpandableComposite.TWISTIE);
77
        sources.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
78
    }
79

  
80

  
81

  
82
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/SourceSection.java
7 7
import java.util.Comparator;
8 8

  
9 9
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
10
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
10
import eu.etaxonomy.cdm.model.common.ISourceable;
11 11
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
12 12
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
13 13
import eu.etaxonomy.cdm.model.media.Media;
......
23 23
 * @created Nov 17, 2009
24 24
 * @version 1.0
25 25
 */
26
public class SourceSection extends AbstractEntityCollectionSection<IIdentifiableEntity, IdentifiableSource> {
26
public class SourceSection extends AbstractEntityCollectionSection<ISourceable, IdentifiableSource> {
27 27

  
28 28
	/**
29 29
	 * <p>Constructor for SourceSection.</p>
......
40 40
	/** {@inheritDoc} */
41 41
	@Override
42 42
	public IdentifiableSource createNewElement() {
43
	    IIdentifiableEntity entity = getEntity();
43
	    ISourceable entity = getEntity();
44 44
	    OriginalSourceType type;
45 45
	    if(entity instanceof Media) {
46 46
	        type = OriginalSourceType.PrimaryMediaSource;
......
55 55
	/** {@inheritDoc} */
56 56
	@Override
57 57
	public Collection<IdentifiableSource> getCollection(
58
			IIdentifiableEntity entity) {
58
			ISourceable entity) {
59 59
		return entity.getSources();
60 60
	}
61 61

  
......
106 106
        return false;
107 107
    }
108 108

  
109

  
110

  
109 111
}

Also available in: Unified diff