1
|
/**
|
2
|
* Copyright (C) 2017 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.editor.workingSet;
|
10
|
|
11
|
import org.eclipse.jface.viewers.TreeViewer;
|
12
|
import org.eclipse.swt.SWT;
|
13
|
import org.eclipse.swt.layout.GridData;
|
14
|
import org.eclipse.swt.layout.GridLayout;
|
15
|
import org.eclipse.swt.widgets.Composite;
|
16
|
import org.eclipse.swt.widgets.Label;
|
17
|
import org.eclipse.swt.widgets.Text;
|
18
|
import org.eclipse.swt.widgets.Tree;
|
19
|
|
20
|
import eu.etaxonomy.cdm.model.common.TermType;
|
21
|
import eu.etaxonomy.cdm.model.description.FeatureTree;
|
22
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
23
|
import eu.etaxonomy.cdm.model.name.Rank;
|
24
|
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
|
25
|
import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer;
|
26
|
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeContentProvider;
|
27
|
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeLabelProvider;
|
28
|
|
29
|
/**
|
30
|
* @author pplitzner
|
31
|
* @since Nov 21, 2017
|
32
|
*
|
33
|
*/
|
34
|
public class WorkingSetComposite extends Composite {
|
35
|
private Text txtWorkingSet;
|
36
|
private TermUuidComboViewer comboRankMin;
|
37
|
private TermUuidComboViewer comboRankMax;
|
38
|
private FeatureTreeEditorComposite featureTreeEditorComposite;
|
39
|
private TreeViewer taxonNodeTree;
|
40
|
private NamedArea area;
|
41
|
private Text textAreaText;
|
42
|
|
43
|
public WorkingSetComposite(Composite parent, int style) {
|
44
|
super(parent, style);
|
45
|
|
46
|
setLayout(new GridLayout(3, false));
|
47
|
|
48
|
Label lblNewLabel = new Label(this, SWT.NONE);
|
49
|
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
50
|
lblNewLabel.setText("Label");
|
51
|
|
52
|
txtWorkingSet = new Text(this, SWT.BORDER);
|
53
|
txtWorkingSet.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
54
|
|
55
|
Label lblNewLabel_1 = new Label(this, SWT.NONE);
|
56
|
lblNewLabel_1.setText("Taxon filter");
|
57
|
|
58
|
Label lblNewLabel_2 = new Label(this, SWT.NONE);
|
59
|
lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
60
|
lblNewLabel_2.setText("Rank min");
|
61
|
|
62
|
comboRankMin = new TermUuidComboViewer(this, SWT.NONE);
|
63
|
comboRankMin.setInput(TermType.Rank);
|
64
|
comboRankMin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
65
|
Tree tree = new Tree(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
|
66
|
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
|
67
|
taxonNodeTree = new TreeViewer(tree);
|
68
|
|
69
|
taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider());
|
70
|
taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider());
|
71
|
|
72
|
Label lblNewLabel_3 = new Label(this, SWT.NONE);
|
73
|
lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
74
|
lblNewLabel_3.setText("Rank max");
|
75
|
|
76
|
comboRankMax = new TermUuidComboViewer(this, SWT.NONE);
|
77
|
comboRankMax.setInput(TermType.Rank);
|
78
|
comboRankMax.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
79
|
|
80
|
Label lblNewLabel_4 = new Label(this, SWT.NONE);
|
81
|
lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
82
|
lblNewLabel_4.setText("Area");
|
83
|
|
84
|
textAreaText = new Text(this, SWT.BORDER);
|
85
|
textAreaText.setEditable(false);
|
86
|
textAreaText.setText("Choose...");
|
87
|
textAreaText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
88
|
|
89
|
featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
|
90
|
featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
|
91
|
}
|
92
|
|
93
|
@Override
|
94
|
protected void checkSubclass() {
|
95
|
// Disable the check that prevents subclassing of SWT components
|
96
|
}
|
97
|
public Text getTxt_label() {
|
98
|
return txtWorkingSet;
|
99
|
}
|
100
|
|
101
|
public TermUuidComboViewer getRankMin() {
|
102
|
return comboRankMin;
|
103
|
}
|
104
|
public TermUuidComboViewer getRankMax() {
|
105
|
return comboRankMax;
|
106
|
}
|
107
|
|
108
|
public void setRankMin(Rank min) {
|
109
|
comboRankMin.setTerm(min);
|
110
|
}
|
111
|
public void setRankMax(Rank max) {
|
112
|
comboRankMax.setTerm(max);
|
113
|
}
|
114
|
|
115
|
public FeatureTreeEditorComposite getFeatureTreeEditorComposite() {
|
116
|
return featureTreeEditorComposite;
|
117
|
}
|
118
|
|
119
|
public FeatureTree getCharacters(){
|
120
|
return featureTreeEditorComposite.getFeatureTree();
|
121
|
}
|
122
|
public void setCharacters(FeatureTree characters) {
|
123
|
featureTreeEditorComposite.setSelectedTree(characters, null);
|
124
|
}
|
125
|
|
126
|
public TreeViewer getTaxonNodeTree() {
|
127
|
return taxonNodeTree;
|
128
|
}
|
129
|
|
130
|
public NamedArea getArea(){
|
131
|
return area;
|
132
|
}
|
133
|
public void setArea(NamedArea area) {
|
134
|
this.area = area;
|
135
|
textAreaText.setText(area.getLabel());
|
136
|
}
|
137
|
public Text getTextAreaText() {
|
138
|
return textAreaText;
|
139
|
}
|
140
|
}
|