Project

General

Profile

Download (2.27 KB) Statistics
| Branch: | Tag: | Revision:
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.feature;
10

    
11
import java.util.Collections;
12

    
13
import org.eclipse.swt.SWT;
14
import org.eclipse.swt.events.SelectionListener;
15
import org.eclipse.swt.graphics.Color;
16

    
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;
26

    
27
/**
28
 * @author pplitzner
29
 * @since Aug 16, 2019
30
 *
31
 */
32
public abstract class AbstractApplicableElement extends AbstractEntityCollectionElement<FeatureState> {
33

    
34
    private TermComboElement<State> comboState;
35
    private EntitySelectionElement<Feature> selectFeature;
36

    
37
    public AbstractApplicableElement(CdmFormFactory formFactory, AbstractFormSection section, FeatureState entity,
38
            SelectionListener removeListener, Color backgroundColor, int style) {
39
        super(formFactory, section, entity, removeListener, backgroundColor, style);
40

    
41
    }
42

    
43
    @Override
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);
49
    }
50

    
51
    protected abstract String getComboLabel();
52

    
53
    @Override
54
    public void setEntity(FeatureState entity) {
55
        this.entity = entity;
56
        selectFeature.setEntity(entity.getFeature());
57
        comboState.setSelection(entity.getState());
58
    }
59

    
60
    @Override
61
    public void handleEvent(Object eventSource) {
62
    }
63
}
(1-1/17)