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.Button;
|
16
|
import org.eclipse.swt.widgets.Composite;
|
17
|
import org.eclipse.swt.widgets.Label;
|
18
|
import org.eclipse.swt.widgets.Text;
|
19
|
import org.eclipse.swt.widgets.Tree;
|
20
|
|
21
|
import eu.etaxonomy.cdm.model.common.TermType;
|
22
|
import eu.etaxonomy.cdm.model.description.FeatureTree;
|
23
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
24
|
import eu.etaxonomy.cdm.model.name.Rank;
|
25
|
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
|
26
|
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
|
27
|
import eu.etaxonomy.taxeditor.model.ImageResources;
|
28
|
import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer;
|
29
|
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeContentProvider;
|
30
|
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeLabelProvider;
|
31
|
|
32
|
/**
|
33
|
* @author pplitzner
|
34
|
* @since Nov 21, 2017
|
35
|
*
|
36
|
*/
|
37
|
public class WorkingSetComposite extends Composite {
|
38
|
private Text txtWorkingSet;
|
39
|
private TermUuidComboViewer comboRankMin;
|
40
|
private TermUuidComboViewer comboRankMax;
|
41
|
private FeatureTreeEditorComposite featureTreeEditorComposite;
|
42
|
private TreeViewer taxonNodeTree;
|
43
|
private NamedArea area;
|
44
|
private Text textAreaText;
|
45
|
private Button btnChooseArea;
|
46
|
private Button btnRemoveArea;
|
47
|
|
48
|
public WorkingSetComposite(Composite parent, int style) {
|
49
|
super(parent, style);
|
50
|
|
51
|
setLayout(new GridLayout(3, false));
|
52
|
|
53
|
Label lblNewLabel = new Label(this, SWT.NONE);
|
54
|
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
55
|
lblNewLabel.setText(Messages.WorkingSetComposite_LABEL);
|
56
|
|
57
|
txtWorkingSet = new Text(this, SWT.BORDER);
|
58
|
txtWorkingSet.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
59
|
|
60
|
Label lblNewLabel_1 = new Label(this, SWT.NONE);
|
61
|
lblNewLabel_1.setText(Messages.WorkingSetComposite_TAXON_FILTER);
|
62
|
|
63
|
Label lblNewLabel_2 = new Label(this, SWT.NONE);
|
64
|
lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
65
|
lblNewLabel_2.setText(Messages.WorkingSetComposite_RANK_MIN);
|
66
|
|
67
|
comboRankMin = new TermUuidComboViewer(this, SWT.NONE);
|
68
|
comboRankMin.setInput(TermType.Rank);
|
69
|
comboRankMin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
70
|
Tree tree = new Tree(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
|
71
|
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
|
72
|
taxonNodeTree = new TreeViewer(tree);
|
73
|
|
74
|
taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider());
|
75
|
taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider());
|
76
|
|
77
|
Label lblNewLabel_3 = new Label(this, SWT.NONE);
|
78
|
lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
79
|
lblNewLabel_3.setText(Messages.WorkingSetComposite_RANK_MAX);
|
80
|
|
81
|
comboRankMax = new TermUuidComboViewer(this, SWT.NONE);
|
82
|
comboRankMax.setInput(TermType.Rank);
|
83
|
comboRankMax.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
84
|
|
85
|
Label lblNewLabel_4 = new Label(this, SWT.NONE);
|
86
|
lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
87
|
lblNewLabel_4.setText(Messages.WorkingSetComposite_AREA);
|
88
|
|
89
|
Composite composite = new Composite(this, SWT.NONE);
|
90
|
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
|
91
|
GridLayout gl_composite = new GridLayout(3, false);
|
92
|
gl_composite.horizontalSpacing = 0;
|
93
|
gl_composite.verticalSpacing = 0;
|
94
|
gl_composite.marginHeight = 0;
|
95
|
gl_composite.marginWidth = 0;
|
96
|
composite.setLayout(gl_composite);
|
97
|
|
98
|
textAreaText = new Text(composite, SWT.BORDER);
|
99
|
textAreaText.setEditable(false);
|
100
|
textAreaText.setText(Messages.WorkingSetComposite_CHOOSE);
|
101
|
textAreaText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
102
|
|
103
|
btnChooseArea = new Button(composite, SWT.NONE);
|
104
|
btnChooseArea.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
|
105
|
|
106
|
btnRemoveArea = new Button(composite, SWT.NONE);
|
107
|
btnRemoveArea.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
|
108
|
|
109
|
featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
|
110
|
featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 2));
|
111
|
new Label(this, SWT.NONE);
|
112
|
}
|
113
|
|
114
|
@Override
|
115
|
protected void checkSubclass() {
|
116
|
// Disable the check that prevents subclassing of SWT components
|
117
|
}
|
118
|
public Text getTxt_label() {
|
119
|
return txtWorkingSet;
|
120
|
}
|
121
|
|
122
|
public TermUuidComboViewer getRankMin() {
|
123
|
return comboRankMin;
|
124
|
}
|
125
|
public TermUuidComboViewer getRankMax() {
|
126
|
return comboRankMax;
|
127
|
}
|
128
|
|
129
|
public void setRankMin(Rank min) {
|
130
|
comboRankMin.setElement(min);
|
131
|
}
|
132
|
public void setRankMax(Rank max) {
|
133
|
comboRankMax.setElement(max);
|
134
|
}
|
135
|
|
136
|
public FeatureTreeEditorComposite getFeatureTreeEditorComposite() {
|
137
|
return featureTreeEditorComposite;
|
138
|
}
|
139
|
|
140
|
public FeatureTree getCharacters(){
|
141
|
return featureTreeEditorComposite.getFeatureTree();
|
142
|
}
|
143
|
public void setCharacters(FeatureTree characters) {
|
144
|
featureTreeEditorComposite.setSelectedTree(characters);
|
145
|
}
|
146
|
|
147
|
public TreeViewer getTaxonNodeTree() {
|
148
|
return taxonNodeTree;
|
149
|
}
|
150
|
|
151
|
public NamedArea getArea(){
|
152
|
return area;
|
153
|
}
|
154
|
public void setArea(NamedArea area) {
|
155
|
this.area = area;
|
156
|
textAreaText.setText(area.getLabel());
|
157
|
}
|
158
|
public void removeArea() {
|
159
|
this.area = null;
|
160
|
textAreaText.setText(""); //$NON-NLS-1$
|
161
|
}
|
162
|
public Button getBtnChooseArea() {
|
163
|
return btnChooseArea;
|
164
|
}
|
165
|
public Button getBtnRemoveArea() {
|
166
|
return btnRemoveArea;
|
167
|
}
|
168
|
}
|