1 |
643bfc6c
|
Patrick Plitzner
|
/**
|
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 |
652496d7
|
Andreas Müller
|
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet;
|
10 |
643bfc6c
|
Patrick Plitzner
|
|
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 |
e7df9bb1
|
Patrick Plitzner
|
import org.eclipse.swt.widgets.Button;
|
16 |
643bfc6c
|
Patrick Plitzner
|
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 |
49aad4b2
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.model.common.TermType;
|
22 |
b13380e4
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.model.description.FeatureTree;
|
23 |
d8baa72e
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
24 |
f953c7b6
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.model.name.Rank;
|
25 |
87abc2b1
|
Patrick Plitzner
|
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
|
26 |
b13380e4
|
Patrick Plitzner
|
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
|
27 |
e7df9bb1
|
Patrick Plitzner
|
import eu.etaxonomy.taxeditor.model.ImageResources;
|
28 |
49aad4b2
|
Patrick Plitzner
|
import eu.etaxonomy.taxeditor.ui.combo.TermUuidComboViewer;
|
29 |
d8baa72e
|
Patrick Plitzner
|
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeContentProvider;
|
30 |
|
|
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeLabelProvider;
|
31 |
49aad4b2
|
Patrick Plitzner
|
|
32 |
643bfc6c
|
Patrick Plitzner
|
/**
|
33 |
|
|
* @author pplitzner
|
34 |
|
|
* @since Nov 21, 2017
|
35 |
|
|
*
|
36 |
|
|
*/
|
37 |
652496d7
|
Andreas Müller
|
public class DescriptiveDataSetComposite extends Composite {
|
38 |
|
|
private Text txtDescriptiveDataSet;
|
39 |
b13380e4
|
Patrick Plitzner
|
private TermUuidComboViewer comboRankMin;
|
40 |
|
|
private TermUuidComboViewer comboRankMax;
|
41 |
|
|
private FeatureTreeEditorComposite featureTreeEditorComposite;
|
42 |
|
|
private TreeViewer taxonNodeTree;
|
43 |
|
|
private NamedArea area;
|
44 |
73f6a95e
|
Patrick Plitzner
|
private Text textAreaText;
|
45 |
e7df9bb1
|
Patrick Plitzner
|
private Button btnChooseArea;
|
46 |
|
|
private Button btnRemoveArea;
|
47 |
aeef81e4
|
Patrick Plitzner
|
private Button btnRemoveRankMin;
|
48 |
|
|
private Button btnRemoveRankMax;
|
49 |
643bfc6c
|
Patrick Plitzner
|
|
50 |
652496d7
|
Andreas Müller
|
public DescriptiveDataSetComposite(Composite parent, int style) {
|
51 |
643bfc6c
|
Patrick Plitzner
|
super(parent, style);
|
52 |
|
|
|
53 |
73f6a95e
|
Patrick Plitzner
|
setLayout(new GridLayout(3, false));
|
54 |
fba1574a
|
Patrick Plitzner
|
|
55 |
73f6a95e
|
Patrick Plitzner
|
Label lblNewLabel = new Label(this, SWT.NONE);
|
56 |
|
|
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
57 |
652496d7
|
Andreas Müller
|
lblNewLabel.setText(Messages.DescriptiveDataSetComposite_LABEL);
|
58 |
73f6a95e
|
Patrick Plitzner
|
|
59 |
652496d7
|
Andreas Müller
|
txtDescriptiveDataSet = new Text(this, SWT.BORDER);
|
60 |
|
|
txtDescriptiveDataSet.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
61 |
73f6a95e
|
Patrick Plitzner
|
|
62 |
d44ef0c2
|
Patrick Plitzner
|
Label lblNewLabel_1 = new Label(this, SWT.NONE);
|
63 |
652496d7
|
Andreas Müller
|
lblNewLabel_1.setText(Messages.DescriptiveDataSetComposite_TAXON_FILTER);
|
64 |
b13380e4
|
Patrick Plitzner
|
|
65 |
643bfc6c
|
Patrick Plitzner
|
Label lblNewLabel_2 = new Label(this, SWT.NONE);
|
66 |
|
|
lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
67 |
652496d7
|
Andreas Müller
|
lblNewLabel_2.setText(Messages.DescriptiveDataSetComposite_RANK_MIN);
|
68 |
643bfc6c
|
Patrick Plitzner
|
|
69 |
aeef81e4
|
Patrick Plitzner
|
Composite composite_1 = new Composite(this, SWT.NONE);
|
70 |
|
|
composite_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
71 |
|
|
GridLayout gl_composite_1 = new GridLayout(2, false);
|
72 |
|
|
gl_composite_1.horizontalSpacing = 0;
|
73 |
|
|
gl_composite_1.verticalSpacing = 0;
|
74 |
|
|
gl_composite_1.marginWidth = 0;
|
75 |
|
|
gl_composite_1.marginHeight = 0;
|
76 |
|
|
composite_1.setLayout(gl_composite_1);
|
77 |
|
|
|
78 |
|
|
comboRankMin = new TermUuidComboViewer(composite_1, SWT.NONE);
|
79 |
|
|
comboRankMin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
80 |
b13380e4
|
Patrick Plitzner
|
comboRankMin.setInput(TermType.Rank);
|
81 |
aeef81e4
|
Patrick Plitzner
|
|
82 |
|
|
btnRemoveRankMin = new Button(composite_1, SWT.NONE);
|
83 |
|
|
btnRemoveRankMin.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
|
84 |
|
|
|
85 |
73f6a95e
|
Patrick Plitzner
|
Tree tree = new Tree(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
|
86 |
|
|
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
|
87 |
|
|
taxonNodeTree = new TreeViewer(tree);
|
88 |
643bfc6c
|
Patrick Plitzner
|
|
89 |
d44ef0c2
|
Patrick Plitzner
|
taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider());
|
90 |
|
|
taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider());
|
91 |
643bfc6c
|
Patrick Plitzner
|
|
92 |
|
|
Label lblNewLabel_3 = new Label(this, SWT.NONE);
|
93 |
|
|
lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
94 |
652496d7
|
Andreas Müller
|
lblNewLabel_3.setText(Messages.DescriptiveDataSetComposite_RANK_MAX);
|
95 |
643bfc6c
|
Patrick Plitzner
|
|
96 |
aeef81e4
|
Patrick Plitzner
|
Composite composite_2 = new Composite(this, SWT.NONE);
|
97 |
|
|
composite_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
98 |
|
|
GridLayout gl_composite_2 = new GridLayout(2, false);
|
99 |
|
|
gl_composite_2.horizontalSpacing = 0;
|
100 |
|
|
gl_composite_2.verticalSpacing = 0;
|
101 |
|
|
gl_composite_2.marginWidth = 0;
|
102 |
|
|
gl_composite_2.marginHeight = 0;
|
103 |
|
|
composite_2.setLayout(gl_composite_2);
|
104 |
|
|
|
105 |
|
|
comboRankMax = new TermUuidComboViewer(composite_2, SWT.NONE);
|
106 |
|
|
comboRankMax.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
107 |
b13380e4
|
Patrick Plitzner
|
comboRankMax.setInput(TermType.Rank);
|
108 |
aeef81e4
|
Patrick Plitzner
|
|
109 |
|
|
btnRemoveRankMax = new Button(composite_2, SWT.NONE);
|
110 |
|
|
btnRemoveRankMax.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
|
111 |
643bfc6c
|
Patrick Plitzner
|
|
112 |
|
|
Label lblNewLabel_4 = new Label(this, SWT.NONE);
|
113 |
73f6a95e
|
Patrick Plitzner
|
lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
114 |
652496d7
|
Andreas Müller
|
lblNewLabel_4.setText(Messages.DescriptiveDataSetComposite_AREA);
|
115 |
643bfc6c
|
Patrick Plitzner
|
|
116 |
e7df9bb1
|
Patrick Plitzner
|
Composite composite = new Composite(this, SWT.NONE);
|
117 |
|
|
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
|
118 |
|
|
GridLayout gl_composite = new GridLayout(3, false);
|
119 |
|
|
gl_composite.horizontalSpacing = 0;
|
120 |
|
|
gl_composite.verticalSpacing = 0;
|
121 |
|
|
gl_composite.marginHeight = 0;
|
122 |
|
|
gl_composite.marginWidth = 0;
|
123 |
|
|
composite.setLayout(gl_composite);
|
124 |
|
|
|
125 |
|
|
textAreaText = new Text(composite, SWT.BORDER);
|
126 |
73f6a95e
|
Patrick Plitzner
|
textAreaText.setEditable(false);
|
127 |
652496d7
|
Andreas Müller
|
textAreaText.setText(Messages.DescriptiveDataSetComposite_CHOOSE);
|
128 |
73f6a95e
|
Patrick Plitzner
|
textAreaText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
129 |
d8baa72e
|
Patrick Plitzner
|
|
130 |
e7df9bb1
|
Patrick Plitzner
|
btnChooseArea = new Button(composite, SWT.NONE);
|
131 |
|
|
btnChooseArea.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
|
132 |
|
|
|
133 |
|
|
btnRemoveArea = new Button(composite, SWT.NONE);
|
134 |
|
|
btnRemoveArea.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
|
135 |
|
|
|
136 |
73f6a95e
|
Patrick Plitzner
|
featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
|
137 |
aeef81e4
|
Patrick Plitzner
|
featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
|
138 |
643bfc6c
|
Patrick Plitzner
|
}
|
139 |
|
|
|
140 |
|
|
@Override
|
141 |
|
|
protected void checkSubclass() {
|
142 |
|
|
// Disable the check that prevents subclassing of SWT components
|
143 |
|
|
}
|
144 |
|
|
public Text getTxt_label() {
|
145 |
652496d7
|
Andreas Müller
|
return txtDescriptiveDataSet;
|
146 |
b13380e4
|
Patrick Plitzner
|
}
|
147 |
f953c7b6
|
Patrick Plitzner
|
|
148 |
|
|
public TermUuidComboViewer getRankMin() {
|
149 |
b13380e4
|
Patrick Plitzner
|
return comboRankMin;
|
150 |
|
|
}
|
151 |
f953c7b6
|
Patrick Plitzner
|
public TermUuidComboViewer getRankMax() {
|
152 |
b13380e4
|
Patrick Plitzner
|
return comboRankMax;
|
153 |
|
|
}
|
154 |
f953c7b6
|
Patrick Plitzner
|
|
155 |
|
|
public void setRankMin(Rank min) {
|
156 |
5cea1626
|
Patrick Plitzner
|
comboRankMin.setElement(min);
|
157 |
f953c7b6
|
Patrick Plitzner
|
}
|
158 |
|
|
public void setRankMax(Rank max) {
|
159 |
5cea1626
|
Patrick Plitzner
|
comboRankMax.setElement(max);
|
160 |
f953c7b6
|
Patrick Plitzner
|
}
|
161 |
|
|
|
162 |
ff58a197
|
Patrick Plitzner
|
public FeatureTreeEditorComposite getFeatureTreeEditorComposite() {
|
163 |
|
|
return featureTreeEditorComposite;
|
164 |
|
|
}
|
165 |
|
|
|
166 |
b13380e4
|
Patrick Plitzner
|
public FeatureTree getCharacters(){
|
167 |
|
|
return featureTreeEditorComposite.getFeatureTree();
|
168 |
|
|
}
|
169 |
f953c7b6
|
Patrick Plitzner
|
public void setCharacters(FeatureTree characters) {
|
170 |
b752be34
|
Patrick Plitzner
|
featureTreeEditorComposite.setSelectedTree(characters);
|
171 |
f953c7b6
|
Patrick Plitzner
|
}
|
172 |
|
|
|
173 |
739cbae5
|
Patrick Plitzner
|
public TreeViewer getTaxonNodeTree() {
|
174 |
|
|
return taxonNodeTree;
|
175 |
f953c7b6
|
Patrick Plitzner
|
}
|
176 |
|
|
|
177 |
b13380e4
|
Patrick Plitzner
|
public NamedArea getArea(){
|
178 |
|
|
return area;
|
179 |
643bfc6c
|
Patrick Plitzner
|
}
|
180 |
f953c7b6
|
Patrick Plitzner
|
public void setArea(NamedArea area) {
|
181 |
|
|
this.area = area;
|
182 |
73f6a95e
|
Patrick Plitzner
|
textAreaText.setText(area.getLabel());
|
183 |
|
|
}
|
184 |
e7df9bb1
|
Patrick Plitzner
|
public void removeArea() {
|
185 |
|
|
this.area = null;
|
186 |
87abc2b1
|
Patrick Plitzner
|
textAreaText.setText(""); //$NON-NLS-1$
|
187 |
e7df9bb1
|
Patrick Plitzner
|
}
|
188 |
|
|
public Button getBtnChooseArea() {
|
189 |
|
|
return btnChooseArea;
|
190 |
|
|
}
|
191 |
|
|
public Button getBtnRemoveArea() {
|
192 |
|
|
return btnRemoveArea;
|
193 |
f953c7b6
|
Patrick Plitzner
|
}
|
194 |
aeef81e4
|
Patrick Plitzner
|
public Button getBtnRemoveRankMin() {
|
195 |
|
|
return btnRemoveRankMin;
|
196 |
|
|
}
|
197 |
|
|
public Button getBtnRemoveRankMax() {
|
198 |
|
|
return btnRemoveRankMax;
|
199 |
|
|
}
|
200 |
643bfc6c
|
Patrick Plitzner
|
}
|