Project

General

Profile

Download (5.36 KB) Statistics
| Branch: | Tag: | Revision:
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.Composite;
14
import org.eclipse.swt.widgets.DateTime;
15
import org.eclipse.swt.widgets.Display;
16
import org.eclipse.swt.widgets.Label;
17
import org.eclipse.swt.widgets.Text;
18
import org.eclipse.ui.forms.widgets.FormToolkit;
19
import org.eclipse.ui.forms.widgets.TableWrapData;
20
import org.eclipse.ui.forms.widgets.TableWrapLayout;
21

    
22
/**
23
 * @author pplitzner
24
 * @date 03.09.2013
25
 *
26
 */
27
public class SpecimenSearchComposite extends Composite {
28
    private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
29
    private final Text textTaxonName;
30
    private final Text textCollector;
31
    private final Text textCollectorNumber;
32
    private final Text textAccessionNumber;
33
    private final Text textLocality;
34
    private final Text textHerbarium;
35
    private final Text textCountry;
36
    private final DateTime dateFrom;
37
    private final DateTime dateTo;
38

    
39
    /**
40
     * Create the composite.
41
     * @param parent
42
     * @setBackgroundMode(SWT.INHERIT_DEFAULT);
43
        param style
44
     */
45
    public SpecimenSearchComposite(Composite parent, int style) {
46
        super(parent, style);
47
        {
48
            TableWrapLayout tableWrapLayout = new TableWrapLayout();
49
            tableWrapLayout.numColumns = 2;
50
            setLayout(tableWrapLayout);
51
        }
52

    
53
        Label lblTaxonName = new Label(this, SWT.NONE);
54
        lblTaxonName.setText("Taxon Name");
55

    
56
        textTaxonName = new Text(this, SWT.NONE);
57
        textTaxonName.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
58

    
59
        Label lblCollectors = new Label(this, SWT.NONE);
60
        lblCollectors.setText("Collector(s)");
61

    
62
        textCollector = new Text(this, SWT.NONE);
63
        textCollector.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
64
        formToolkit.adapt(textCollector, true, true);
65

    
66
        Label lblCollectorsNumber = new Label(this, SWT.NONE);
67
        lblCollectorsNumber.setText("Collector(s) Number");
68

    
69
        textCollectorNumber = new Text(this, SWT.NONE);
70
        textCollectorNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
71
        formToolkit.adapt(textCollectorNumber, true, true);
72

    
73
        Label lblAccessionNumber = new Label(this, SWT.NONE);
74
        lblAccessionNumber.setText("Accession Number");
75

    
76
        textAccessionNumber = new Text(this, SWT.NONE);
77
        textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
78
        formToolkit.adapt(textAccessionNumber, true, true);
79

    
80
        Label lblHerbarium = new Label(this, SWT.NONE);
81
        lblHerbarium.setText("Herbarium");
82

    
83
        textHerbarium = new Text(this, SWT.NONE);
84
        textHerbarium.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
85

    
86
        Label lblCountry = new Label(this, SWT.NONE);
87
        lblCountry.setText("Country");
88

    
89
        textCountry = new Text(this, SWT.NONE);
90
        textCountry.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
91

    
92
        Label lblLocality = new Label(this, SWT.NONE);
93
        lblLocality.setText("Locality");
94

    
95
        textLocality = new Text(this, SWT.NONE);
96
        textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
97
        formToolkit.adapt(textLocality, true, true);
98

    
99
        Label lblCollectionDate = new Label(this, SWT.NONE);
100
        lblCollectionDate.setText("Collection Date");
101
        new Label(this, SWT.NONE);
102

    
103
        Label lblFrom = new Label(this, SWT.NONE);
104
        lblFrom.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
105
        lblFrom.setText("from");
106

    
107
        dateFrom = new DateTime(this, SWT.NONE);
108
        dateFrom.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
109
        formToolkit.adapt(dateFrom);
110
        formToolkit.paintBordersFor(dateFrom);
111

    
112
        Label lblTo = new Label(this, SWT.NONE);
113
        lblTo.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
114
        lblTo.setText("to");
115

    
116
        dateTo = new DateTime(this, SWT.DROP_DOWN);
117
        dateTo.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
118
        formToolkit.adapt(dateTo);
119
        formToolkit.paintBordersFor(dateTo);
120

    
121
    }
122

    
123
    @Override
124
    protected void checkSubclass() {
125
        // Disable the check that prevents subclassing of SWT components
126
    }
127

    
128
    public Text getTextTaxonName() {
129
        return textTaxonName;
130
    }
131
    public Text getTextCollector() {
132
        return textCollector;
133
    }
134
    public Text getTextCollectorNumber() {
135
        return textCollectorNumber;
136
    }
137
    public Text getTextAccessionNumber() {
138
        return textAccessionNumber;
139
    }
140
    public Text getTextHerbarium() {
141
        return textHerbarium;
142
    }
143
    public Text getTextCountry() {
144
        return textCountry;
145
    }
146
    public Text getTextLocality() {
147
        return textLocality;
148
    }
149
    public DateTime getDateFrom() {
150
        return dateFrom;
151
    }
152
    public DateTime getDateTo() {
153
        return dateTo;
154
    }
155
}
(3-3/4)