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
.workingSet
;
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
;
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
;
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
;
43 public WorkingSetComposite(Composite parent
, int style
) {
46 setLayout(new GridLayout(3, false));
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");
52 txtWorkingSet
= new Text(this, SWT
.BORDER
);
53 txtWorkingSet
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
55 Label lblNewLabel_1
= new Label(this, SWT
.NONE
);
56 lblNewLabel_1
.setText("Taxon filter");
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");
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
);
69 taxonNodeTree
.setContentProvider(new TaxonTreeNodeContentProvider());
70 taxonNodeTree
.setLabelProvider(new TaxonTreeNodeLabelProvider());
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");
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));
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");
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));
89 featureTreeEditorComposite
= new FeatureTreeEditorComposite(this, SWT
.NONE
);
90 featureTreeEditorComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true, 2, 1));
91 featureTreeEditorComposite
.init(null, null, null, null);
98 protected void checkSubclass() {
99 // Disable the check that prevents subclassing of SWT components
101 public Text
getTxt_label() {
102 return txtWorkingSet
;
105 public TermUuidComboViewer
getRankMin() {
108 public TermUuidComboViewer
getRankMax() {
112 public void setRankMin(Rank min
) {
113 comboRankMin
.setTerm(min
);
115 public void setRankMax(Rank max
) {
116 comboRankMax
.setTerm(max
);
119 public FeatureTree
getCharacters(){
120 return featureTreeEditorComposite
.getFeatureTree();
122 public void setCharacters(FeatureTree characters
) {
123 featureTreeEditorComposite
.setSelectedTree(characters
, null);
126 public TreeViewer
getTaxonNodeTree() {
127 return taxonNodeTree
;
130 public NamedArea
getArea(){
133 public void setArea(NamedArea area
) {
135 textAreaText
.setText(area
.getLabel());
137 public Text
getTextAreaText() {