1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2013 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.taxeditor.ui.campanula.derivatesearch;
|
11
|
|
12
|
import org.eclipse.jface.viewers.TableViewer;
|
13
|
import org.eclipse.swt.SWT;
|
14
|
import org.eclipse.swt.layout.GridData;
|
15
|
import org.eclipse.swt.layout.GridLayout;
|
16
|
import org.eclipse.swt.widgets.Combo;
|
17
|
import org.eclipse.swt.widgets.Composite;
|
18
|
import org.eclipse.swt.widgets.Display;
|
19
|
import org.eclipse.swt.widgets.Label;
|
20
|
import org.eclipse.swt.widgets.Table;
|
21
|
import org.eclipse.swt.widgets.Text;
|
22
|
import org.eclipse.ui.forms.widgets.FormToolkit;
|
23
|
|
24
|
/**
|
25
|
* The widgets of the {@link DerivateSearchView}<br>
|
26
|
*
|
27
|
*/
|
28
|
public class DerivateSearchComposite extends Composite {
|
29
|
private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
|
30
|
private final Text searchField;
|
31
|
private final Table table;
|
32
|
private final TableViewer resultViewer;
|
33
|
private final Combo comboDerivateType;
|
34
|
|
35
|
/**
|
36
|
* Create the composite.
|
37
|
* @param parent
|
38
|
* @param style
|
39
|
*/
|
40
|
public DerivateSearchComposite(Composite parent, int style) {
|
41
|
super(parent, style);
|
42
|
setLayout(new GridLayout(2, false));
|
43
|
|
44
|
Label lblDerivateType = new Label(this, SWT.NULL);
|
45
|
lblDerivateType.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
46
|
lblDerivateType.setText("Derivate Filter");
|
47
|
|
48
|
comboDerivateType = new Combo(this, SWT.NONE);
|
49
|
comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
50
|
formToolkit.paintBordersFor(comboDerivateType);
|
51
|
|
52
|
Label lblNameFilter = new Label(this, SWT.NULL);
|
53
|
lblNameFilter.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
54
|
lblNameFilter.setText("Name Filter");
|
55
|
|
56
|
searchField = formToolkit.createText(this, "New Text", SWT.NONE);
|
57
|
searchField.setText("");
|
58
|
searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
59
|
|
60
|
resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
|
61
|
table = resultViewer.getTable();
|
62
|
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
|
63
|
|
64
|
}
|
65
|
|
66
|
@Override
|
67
|
protected void checkSubclass() {
|
68
|
// Disable the check that prevents subclassing of SWT components
|
69
|
}
|
70
|
public Text getSearchField() {
|
71
|
return searchField;
|
72
|
}
|
73
|
public TableViewer getResultViewer() {
|
74
|
return resultViewer;
|
75
|
}
|
76
|
public Combo getComboDerivateType() {
|
77
|
return comboDerivateType;
|
78
|
}
|
79
|
}
|