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
|
// protected SourceSection sources;
|
30
|
|
31
|
|
32
|
/**
|
33
|
* @param formFactory
|
34
|
* @param section
|
35
|
* @param entity
|
36
|
* @param removeListener
|
37
|
* @param backgroundColor
|
38
|
* @param style
|
39
|
*/
|
40
|
public AbstractSourcedEntityBaseElement(CdmFormFactory formFactory, AbstractFormSection section, T entity,
|
41
|
SelectionListener removeListener, int style) {
|
42
|
super(formFactory, section, entity, removeListener, null, style);
|
43
|
// make this element selectable
|
44
|
if(formFactory.getSelectionProvider() != null){
|
45
|
selectionArbitrator = formFactory.createSelectionArbitrator(this);
|
46
|
}
|
47
|
|
48
|
}
|
49
|
|
50
|
/**
|
51
|
* {@inheritDoc}
|
52
|
*/
|
53
|
@Override
|
54
|
public SelectionArbitrator getSelectionArbitrator() {
|
55
|
return selectionArbitrator;
|
56
|
}
|
57
|
|
58
|
/**
|
59
|
* {@inheritDoc}
|
60
|
*/
|
61
|
@Override
|
62
|
public void setEntity(T entity) {
|
63
|
this.entity = entity;
|
64
|
}
|
65
|
|
66
|
|
67
|
|
68
|
|
69
|
|
70
|
}
|