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.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 FeatureTreeDetailElementForNode extends AbstractCdmDetailElement<TermTree> {
|
29
|
|
30
|
private CheckboxElement allowDuplicates;
|
31
|
private CheckboxElement orderRelevant;
|
32
|
private CheckboxElement isFlat;
|
33
|
|
34
|
private TextWithLabelElement titleCacheText;
|
35
|
|
36
|
public FeatureTreeDetailElementForNode(CdmFormFactory formFactory,
|
37
|
ICdmFormElement formElement) {
|
38
|
super(formFactory, formElement);
|
39
|
}
|
40
|
|
41
|
|
42
|
@Override
|
43
|
protected void createControls(ICdmFormElement formElement, TermTree 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().getMessage());
|
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.isAllowDuplicates(), 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
|
// handleToggleableCacheField();
|
68
|
// }
|
69
|
// else
|
70
|
if (eventSource == allowDuplicates) {
|
71
|
getEntity().setAllowDuplicates(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
|
}
|