Project

General

Profile

Download (7.65 KB) Statistics
| Branch: | Tag: | Revision:
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.descriptiveDataSet;
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 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;
49

    
50
    public DescriptiveDataSetComposite(Composite parent, int style) {
51
        super(parent, style);
52

    
53
        setLayout(new GridLayout(3, false));
54

    
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);
58

    
59
        txtDescriptiveDataSet = new Text(this, SWT.BORDER);
60
        txtDescriptiveDataSet.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
61

    
62
        Label lblNewLabel_1 = new Label(this, SWT.NONE);
63
        lblNewLabel_1.setText(Messages.DescriptiveDataSetComposite_TAXON_FILTER);
64

    
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);
68

    
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);
77

    
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);
81

    
82
        btnRemoveRankMin = new Button(composite_1, SWT.NONE);
83
        btnRemoveRankMin.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
84

    
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);
88

    
89
        taxonNodeTree.setContentProvider(new TaxonTreeNodeContentProvider());
90
        taxonNodeTree.setLabelProvider(new TaxonTreeNodeLabelProvider());
91

    
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);
95

    
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);
104

    
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);
108

    
109
        btnRemoveRankMax = new Button(composite_2, SWT.NONE);
110
        btnRemoveRankMax.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
111

    
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);
115

    
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);
124

    
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));
129

    
130
        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
        featureTreeEditorComposite = new FeatureTreeEditorComposite(this, SWT.NONE);
137
        featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
138
    }
139

    
140
    @Override
141
    protected void checkSubclass() {
142
        // Disable the check that prevents subclassing of SWT components
143
    }
144
    public Text getTxt_label() {
145
        return txtDescriptiveDataSet;
146
    }
147

    
148
    public TermUuidComboViewer getRankMin() {
149
        return comboRankMin;
150
    }
151
    public TermUuidComboViewer getRankMax() {
152
        return comboRankMax;
153
    }
154

    
155
    public void setRankMin(Rank min) {
156
        comboRankMin.setElement(min);
157
    }
158
    public void setRankMax(Rank max) {
159
        comboRankMax.setElement(max);
160
    }
161

    
162
    public FeatureTreeEditorComposite getFeatureTreeEditorComposite() {
163
        return featureTreeEditorComposite;
164
    }
165

    
166
    public FeatureTree getCharacters(){
167
        return featureTreeEditorComposite.getFeatureTree();
168
    }
169
    public void setCharacters(FeatureTree characters) {
170
        featureTreeEditorComposite.setSelectedTree(characters);
171
    }
172

    
173
    public TreeViewer getTaxonNodeTree() {
174
        return taxonNodeTree;
175
    }
176

    
177
    public NamedArea getArea(){
178
        return area;
179
    }
180
    public void setArea(NamedArea area) {
181
        this.area = area;
182
        textAreaText.setText(area.getLabel());
183
    }
184
    public void removeArea() {
185
        this.area = null;
186
        textAreaText.setText(""); //$NON-NLS-1$
187
    }
188
    public Button getBtnChooseArea() {
189
        return btnChooseArea;
190
    }
191
    public Button getBtnRemoveArea() {
192
        return btnRemoveArea;
193
    }
194
    public Button getBtnRemoveRankMin() {
195
        return btnRemoveRankMin;
196
    }
197
    public Button getBtnRemoveRankMax() {
198
        return btnRemoveRankMax;
199
    }
200
}
(1-1/4)