2 * Copyright (C) 2019 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
.feature
;
11 import java
.util
.Collections
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.events
.SelectionListener
;
15 import org
.eclipse
.swt
.graphics
.Color
;
17 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
18 import eu
.etaxonomy
.cdm
.model
.description
.FeatureState
;
19 import eu
.etaxonomy
.cdm
.model
.description
.State
;
20 import eu
.etaxonomy
.taxeditor
.ui
.combo
.term
.TermComboElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.AbstractFormSection
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
25 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
32 public abstract class AbstractApplicableElement
extends AbstractEntityCollectionElement
<FeatureState
> {
34 private TermComboElement
<State
> comboState
;
35 private EntitySelectionElement
<Feature
> selectFeature
;
37 public AbstractApplicableElement(CdmFormFactory formFactory
, AbstractFormSection section
, FeatureState entity
,
38 SelectionListener removeListener
, Color backgroundColor
, int style
) {
39 super(formFactory
, section
, entity
, removeListener
, backgroundColor
, style
);
44 public void createControls(ICdmFormElement element
, int style
) {
45 selectFeature
= formFactory
.createSelectionElement(Feature
.class, element
, "Feature", null, EntitySelectionElement
.SELECTABLE
, SWT
.NONE
);
46 comboState
= formFactory
.createDefinedTermComboElement(Collections
.EMPTY_LIST
, element
, getComboLabel(), null, style
);
47 comboState
.setEnabled(false);
48 selectFeature
.setEnabled(false);
50 selectFeature
.setEntity(entity
.getFeature());
51 comboState
.setSelection(entity
.getState());
54 protected abstract String
getComboLabel();
57 public void setEntity(FeatureState entity
) {
59 if (selectFeature
!= null){
60 selectFeature
.setEntity(entity
.getFeature());
61 comboState
.setSelection(entity
.getState());
66 public void handleEvent(Object eventSource
) {