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
|
|
13
|
import eu.etaxonomy.cdm.model.common.SourcedEntityBase;
|
14
|
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
|
15
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
16
|
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
|
17
|
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
|
18
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
|
19
|
|
20
|
/**
|
21
|
* @author k.luther
|
22
|
* @since 26 Feb 2019
|
23
|
*
|
24
|
*/
|
25
|
public abstract class AbstractSourcedEntityBaseElement<T extends SourcedEntityBase> extends AbstractEntityCollectionElement<T> implements ISelectableElement{
|
26
|
|
27
|
private SelectionArbitrator selectionArbitrator;
|
28
|
|
29
|
public AbstractSourcedEntityBaseElement(CdmFormFactory formFactory, AbstractFormSection section, T entity,
|
30
|
SelectionListener removeListener, int style) {
|
31
|
super(formFactory, section, entity, removeListener, null, style);
|
32
|
// make this element selectable
|
33
|
if(formFactory.getSelectionProvider() != null){
|
34
|
selectionArbitrator = formFactory.createSelectionArbitrator(this);
|
35
|
}
|
36
|
}
|
37
|
|
38
|
@Override
|
39
|
public SelectionArbitrator getSelectionArbitrator() {
|
40
|
return selectionArbitrator;
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
public void setEntity(T entity) {
|
45
|
this.entity = entity;
|
46
|
}
|
47
|
}
|