2 * Copyright (C) 2020 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
;
11 import eu
.etaxonomy
.cdm
.model
.common
.SingleSourcedEntityBase
;
12 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementSource
;
13 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
14 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.element
.ISelectableElement
;
16 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
17 import eu
.etaxonomy
.taxeditor
.ui
.section
.reference
.OriginalSourceElement
;
23 public abstract class AbstractSingleSourceElement
<T
extends SingleSourcedEntityBase
>
24 extends AbstractCdmDetailElement
<T
> implements ISelectableElement
{
26 protected OriginalSourceElement singleSourceSection
;
33 * @param removeListener
34 * @param backgroundColor
37 public AbstractSingleSourceElement(CdmFormFactory formFactory
, ICdmFormElement formElement
) {
38 super(formFactory
, formElement
);
42 public String
getLabel() {
46 public void setSourceLabel(String label
) {
47 if (singleSourceSection
!= null){
48 singleSourceSection
.getReferenceSelectionElement().setLabel(label
);
54 public void createControls(ICdmFormElement formElement
, T entity
, int style
) {
55 singleSourceSection
= formFactory
.createOriginalSourceElement(formElement
, entity
, label
);
56 if (entity
.getSource() == null){
57 DescriptionElementSource source
= DescriptionElementSource
.NewPrimarySourceInstance(null, null);
58 entity
.setSource(source
);
59 singleSourceSection
.setEntity(source
);
61 singleSourceSection
.setEntity(entity
.getSource());
66 public void setIndent(int indent
){
67 singleSourceSection
.setIndent(indent
);