2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.editor
.descriptiveDataSet
;
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
;
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
;
37 public class DescriptiveDataSetComposite
extends Composite
{
38 private Text txtDescriptiveDataSet
;
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 private Button btnRemoveRankMin
;
48 private Button btnRemoveRankMax
;
50 public DescriptiveDataSetComposite(Composite parent
, int style
) {
53 setLayout(new GridLayout(3, false));
55 Label lblNewLabel
= new Label(this, SWT
.NONE
);
56 lblNewLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
57 lblNewLabel
.setText(Messages
.DescriptiveDataSetComposite_LABEL
);
59 txtDescriptiveDataSet
= new Text(this, SWT
.BORDER
);
60 txtDescriptiveDataSet
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
62 Label lblNewLabel_1
= new Label(this, SWT
.NONE
);
63 lblNewLabel_1
.setText(Messages
.DescriptiveDataSetComposite_TAXON_FILTER
);
65 Label lblNewLabel_2
= new Label(this, SWT
.NONE
);
66 lblNewLabel_2
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
67 lblNewLabel_2
.setText(Messages
.DescriptiveDataSetComposite_RANK_MIN
);
69 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
);
78 comboRankMin
= new TermUuidComboViewer(composite_1
, SWT
.NONE
);
79 comboRankMin
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
80 comboRankMin
.setInput(TermType
.Rank
);
82 btnRemoveRankMin
= new Button(composite_1
, SWT
.NONE
);
83 btnRemoveRankMin
.setImage(ImageResources
.getImage(ImageResources
.TRASH_ICON
));
85 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
);
89 taxonNodeTree
.setContentProvider(new TaxonTreeNodeContentProvider());
90 taxonNodeTree
.setLabelProvider(new TaxonTreeNodeLabelProvider());
92 Label lblNewLabel_3
= new Label(this, SWT
.NONE
);
93 lblNewLabel_3
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
94 lblNewLabel_3
.setText(Messages
.DescriptiveDataSetComposite_RANK_MAX
);
96 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
);
105 comboRankMax
= new TermUuidComboViewer(composite_2
, SWT
.NONE
);
106 comboRankMax
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
107 comboRankMax
.setInput(TermType
.Rank
);
109 btnRemoveRankMax
= new Button(composite_2
, SWT
.NONE
);
110 btnRemoveRankMax
.setImage(ImageResources
.getImage(ImageResources
.TRASH_ICON
));
112 Label lblNewLabel_4
= new Label(this, SWT
.NONE
);
113 lblNewLabel_4
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
114 lblNewLabel_4
.setText(Messages
.DescriptiveDataSetComposite_AREA
);
116 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
);
125 textAreaText
= new Text(composite
, SWT
.BORDER
);
126 textAreaText
.setEditable(false);
127 textAreaText
.setText(Messages
.DescriptiveDataSetComposite_CHOOSE
);
128 textAreaText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
130 btnChooseArea
= new Button(composite
, SWT
.NONE
);
131 btnChooseArea
.setImage(ImageResources
.getImage(ImageResources
.BROWSE_ICON
));
133 btnRemoveArea
= new Button(composite
, SWT
.NONE
);
134 btnRemoveArea
.setImage(ImageResources
.getImage(ImageResources
.TRASH_ICON
));
136 featureTreeEditorComposite
= new FeatureTreeEditorComposite(this, SWT
.NONE
);
137 featureTreeEditorComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true, 2, 1));
141 protected void checkSubclass() {
142 // Disable the check that prevents subclassing of SWT components
144 public Text
getTxt_label() {
145 return txtDescriptiveDataSet
;
148 public TermUuidComboViewer
getRankMin() {
151 public TermUuidComboViewer
getRankMax() {
155 public void setRankMin(Rank min
) {
156 comboRankMin
.setElement(min
);
158 public void setRankMax(Rank max
) {
159 comboRankMax
.setElement(max
);
162 public FeatureTreeEditorComposite
getFeatureTreeEditorComposite() {
163 return featureTreeEditorComposite
;
166 public FeatureTree
getCharacters(){
167 return featureTreeEditorComposite
.getFeatureTree();
169 public void setCharacters(FeatureTree characters
) {
170 featureTreeEditorComposite
.setSelectedTree(characters
);
173 public TreeViewer
getTaxonNodeTree() {
174 return taxonNodeTree
;
177 public NamedArea
getArea(){
180 public void setArea(NamedArea area
) {
182 textAreaText
.setText(area
.getLabel());
184 public void removeArea() {
186 textAreaText
.setText(""); //$NON-NLS-1$
188 public Button
getBtnChooseArea() {
189 return btnChooseArea
;
191 public Button
getBtnRemoveArea() {
192 return btnRemoveArea
;
194 public Button
getBtnRemoveRankMin() {
195 return btnRemoveRankMin
;
197 public Button
getBtnRemoveRankMax() {
198 return btnRemoveRankMax
;