Project

General

Profile

Download (1.98 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.TermTree;
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<TermTree> {
27

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

    
33

    
34
	@Override
35
	protected void createControls(ICdmFormElement formElement, TermTree entity, int style) {
36
	    Label lblTermType = new Label(formElement.getLayoutComposite(), style);
37
	    lblTermType.setText("Term Type");
38
	    Label lblStructureText = new Label(formElement.getLayoutComposite(), style);
39
	    lblStructureText.setText(entity.getTermType().getMessage());
40
	    lblStructureText.setForeground(ColorResources.getColor(Resources.BLACK));
41

    
42
	    toggleable_cache = formFactory.createToggleableTextField(
43
                formElement, "Title Cache", entity.getTitleCache(),
44
                entity.isProtectedTitleCache(), style);
45
	    toggleable_cache.getBtnToggleProtectTitleCache().setEnabled(false);
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)