Project

General

Profile

Download (2 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 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 org.eclipse.swt.widgets.Label;
12

    
13
import eu.etaxonomy.cdm.model.term.FeatureTree;
14
import eu.etaxonomy.taxeditor.model.ColorResources;
15
import eu.etaxonomy.taxeditor.preference.Resources;
16
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
17
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
18
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
19

    
20
/**
21
 *
22
 * @author pplitzner
23
 * @since Dec 21, 2017
24
 *
25
 */
26
public class FeatureTreeDetailElement extends AbstractIdentifiableEntityDetailElement<FeatureTree> {
27

    
28
	public FeatureTreeDetailElement(CdmFormFactory formFactory,
29
			ICdmFormElement formElement) {
30
		super(formFactory, formElement);
31
	}
32

    
33

    
34
	@Override
35
	protected void createControls(ICdmFormElement formElement, FeatureTree entity, int style) {
36
	    toggleable_cache = formFactory.createToggleableTextField(
37
                formElement, "Title Cache", entity.getTitleCache(),
38
                entity.isProtectedTitleCache(), style);
39
	    toggleable_cache.getBtnToggleProtectTitleCache().setEnabled(false);
40

    
41
	    Label lblTermType = new Label(formElement.getLayoutComposite(), style);
42
        lblTermType.setText("Term Type");
43
        Label lblStructureText = new Label(formElement.getLayoutComposite(), style);
44
        lblStructureText.setText(entity.getTermType().getMessage());
45
        lblStructureText.setForeground(ColorResources.getColor(Resources.BLACK));
46
    }
47

    
48
	@Override
49
	protected void updateControlStates() {
50
	    super.updateControlStates();
51
	    toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
52
	}
53

    
54
	@Override
55
	public void handleEvent(Object eventSource) {
56
	    if (eventSource == toggleable_cache) {
57
	            handleToggleableCacheField();
58
        }
59
	}
60

    
61
}
(7-7/12)