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.persistence.dto.TermTreeDto;
|
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.CheckboxElement;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
21
|
|
22
|
/**
|
23
|
*
|
24
|
* @author pplitzner
|
25
|
* @since Dec 21, 2017
|
26
|
*
|
27
|
*/
|
28
|
public class FeatureTreeDetailElement extends AbstractCdmDetailElement<TermTreeDto> {
|
29
|
|
30
|
private CheckboxElement allowDuplicates;
|
31
|
private CheckboxElement orderRelevant;
|
32
|
private CheckboxElement isFlat;
|
33
|
|
34
|
private TextWithLabelElement titleCacheText;
|
35
|
|
36
|
public FeatureTreeDetailElement(CdmFormFactory formFactory,
|
37
|
ICdmFormElement formElement) {
|
38
|
super(formFactory, formElement);
|
39
|
}
|
40
|
|
41
|
|
42
|
@Override
|
43
|
protected void createControls(ICdmFormElement formElement, TermTreeDto entity, int style) {
|
44
|
Label lblTermType = new Label(formElement.getLayoutComposite(), style);
|
45
|
lblTermType.setText("Term Type");
|
46
|
Label lblStructureText = new Label(formElement.getLayoutComposite(), style);
|
47
|
lblStructureText.setText(entity.getTermType().getLabel());
|
48
|
lblStructureText.setForeground(ColorResources.getColor(Resources.BLACK));
|
49
|
|
50
|
titleCacheText = formFactory.createTextWithLabelElement(
|
51
|
formElement, "Title Cache", entity.getTitleCache(), style);
|
52
|
|
53
|
allowDuplicates = formFactory.createCheckbox(formElement, "Allow duplicates", entity.isAllowDuplicate(), style);
|
54
|
orderRelevant = formFactory.createCheckbox(formElement, "Order relevant", entity.isOrderRelevant(), style);
|
55
|
isFlat = formFactory.createCheckbox(formElement, "Is flat", entity.isFlat(), style);
|
56
|
}
|
57
|
|
58
|
@Override
|
59
|
protected void updateControlStates() {
|
60
|
super.updateControlStates();
|
61
|
// toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
|
62
|
}
|
63
|
|
64
|
@Override
|
65
|
public void handleEvent(Object eventSource) {
|
66
|
if (eventSource == titleCacheText) {
|
67
|
getEntity().setTitleCache(titleCacheText.getText());
|
68
|
}
|
69
|
else
|
70
|
if (eventSource == allowDuplicates) {
|
71
|
getEntity().setAllowDuplicate(allowDuplicates.getSelection());
|
72
|
}
|
73
|
else if (eventSource == orderRelevant) {
|
74
|
getEntity().setOrderRelevant(orderRelevant.getSelection());
|
75
|
}
|
76
|
else if (eventSource == isFlat) {
|
77
|
getEntity().setFlat(isFlat.getSelection());
|
78
|
}
|
79
|
|
80
|
}
|
81
|
}
|