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.view.specimenSearch;
|
11
|
|
12
|
import org.eclipse.swt.SWT;
|
13
|
import org.eclipse.swt.widgets.Button;
|
14
|
import org.eclipse.swt.widgets.Composite;
|
15
|
import org.eclipse.swt.widgets.DateTime;
|
16
|
import org.eclipse.swt.widgets.Display;
|
17
|
import org.eclipse.swt.widgets.Label;
|
18
|
import org.eclipse.swt.widgets.Text;
|
19
|
import org.eclipse.ui.forms.widgets.FormToolkit;
|
20
|
import org.eclipse.ui.forms.widgets.TableWrapData;
|
21
|
import org.eclipse.ui.forms.widgets.TableWrapLayout;
|
22
|
|
23
|
/**
|
24
|
* @author pplitzner
|
25
|
* @date 03.09.2013
|
26
|
*
|
27
|
*/
|
28
|
public class SpecimenSearchComposite extends Composite {
|
29
|
private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
|
30
|
private final Text textTaxonName;
|
31
|
private final Text textCollector;
|
32
|
private final Text textCollectorNumber;
|
33
|
private final Text textAccessionNumber;
|
34
|
private final Text textLocality;
|
35
|
private final Text textHerbarium;
|
36
|
private final Text textCountry;
|
37
|
private final DateTime dateFrom;
|
38
|
private final DateTime dateTo;
|
39
|
private final Button btnShowDate;
|
40
|
|
41
|
/**
|
42
|
* Create the composite.
|
43
|
* @param parent
|
44
|
* @setBackgroundMode(SWT.INHERIT_DEFAULT);
|
45
|
param style
|
46
|
*/
|
47
|
public SpecimenSearchComposite(Composite parent, int style) {
|
48
|
super(parent, style);
|
49
|
{
|
50
|
TableWrapLayout tableWrapLayout = new TableWrapLayout();
|
51
|
tableWrapLayout.numColumns = 2;
|
52
|
setLayout(tableWrapLayout);
|
53
|
}
|
54
|
|
55
|
Label lblTaxonName = new Label(this, SWT.NONE);
|
56
|
lblTaxonName.setText("Taxon Name");
|
57
|
|
58
|
textTaxonName = new Text(this, SWT.NONE);
|
59
|
textTaxonName.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
|
60
|
|
61
|
Label lblCollectors = new Label(this, SWT.NONE);
|
62
|
lblCollectors.setText("Collector(s)");
|
63
|
|
64
|
textCollector = new Text(this, SWT.NONE);
|
65
|
textCollector.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
|
66
|
formToolkit.adapt(textCollector, true, true);
|
67
|
|
68
|
Label lblCollectorsNumber = new Label(this, SWT.NONE);
|
69
|
lblCollectorsNumber.setText("Collector(s) Number");
|
70
|
|
71
|
textCollectorNumber = new Text(this, SWT.NONE);
|
72
|
textCollectorNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
|
73
|
formToolkit.adapt(textCollectorNumber, true, true);
|
74
|
|
75
|
Label lblAccessionNumber = new Label(this, SWT.NONE);
|
76
|
lblAccessionNumber.setText("Accession Number");
|
77
|
|
78
|
textAccessionNumber = new Text(this, SWT.NONE);
|
79
|
textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
|
80
|
formToolkit.adapt(textAccessionNumber, true, true);
|
81
|
|
82
|
Label lblHerbarium = new Label(this, SWT.NONE);
|
83
|
lblHerbarium.setText("Herbarium");
|
84
|
|
85
|
textHerbarium = new Text(this, SWT.NONE);
|
86
|
textHerbarium.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
|
87
|
|
88
|
Label lblCountry = new Label(this, SWT.NONE);
|
89
|
lblCountry.setText("Country");
|
90
|
|
91
|
textCountry = new Text(this, SWT.NONE);
|
92
|
textCountry.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
|
93
|
|
94
|
Label lblLocality = new Label(this, SWT.NONE);
|
95
|
lblLocality.setText("Locality");
|
96
|
|
97
|
textLocality = new Text(this, SWT.NONE);
|
98
|
textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
|
99
|
formToolkit.adapt(textLocality, true, true);
|
100
|
|
101
|
Label lblCollectionDate = new Label(this, SWT.NONE);
|
102
|
lblCollectionDate.setText("Collection Date");
|
103
|
|
104
|
btnShowDate = new Button(this, SWT.CHECK);
|
105
|
|
106
|
Label lblFrom = new Label(this, SWT.NONE);
|
107
|
lblFrom.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
|
108
|
lblFrom.setText("from");
|
109
|
|
110
|
dateFrom = new DateTime(this, SWT.SHORT);
|
111
|
dateFrom.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
|
112
|
formToolkit.paintBordersFor(dateFrom);
|
113
|
|
114
|
Label lblTo = new Label(this, SWT.NONE);
|
115
|
lblTo.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
|
116
|
lblTo.setText("to");
|
117
|
|
118
|
dateTo = new DateTime(this, SWT.SHORT);
|
119
|
dateTo.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
|
120
|
formToolkit.paintBordersFor(dateTo);
|
121
|
|
122
|
}
|
123
|
|
124
|
@Override
|
125
|
protected void checkSubclass() {
|
126
|
// Disable the check that prevents subclassing of SWT components
|
127
|
}
|
128
|
|
129
|
public Text getTextTaxonName() {
|
130
|
return textTaxonName;
|
131
|
}
|
132
|
public Text getTextCollector() {
|
133
|
return textCollector;
|
134
|
}
|
135
|
public Text getTextCollectorNumber() {
|
136
|
return textCollectorNumber;
|
137
|
}
|
138
|
public Text getTextAccessionNumber() {
|
139
|
return textAccessionNumber;
|
140
|
}
|
141
|
public Text getTextHerbarium() {
|
142
|
return textHerbarium;
|
143
|
}
|
144
|
public Text getTextCountry() {
|
145
|
return textCountry;
|
146
|
}
|
147
|
public Text getTextLocality() {
|
148
|
return textLocality;
|
149
|
}
|
150
|
public DateTime getDateFrom() {
|
151
|
return dateFrom;
|
152
|
}
|
153
|
public DateTime getDateTo() {
|
154
|
return dateTo;
|
155
|
}
|
156
|
public Button getBtnShowDate() {
|
157
|
return btnShowDate;
|
158
|
}
|
159
|
}
|