3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.view
.specimenSearch
;
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
;
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
;
42 * Create the composite.
44 * @setBackgroundMode(SWT.INHERIT_DEFAULT);
47 public SpecimenSearchComposite(Composite parent
, int style
) {
50 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
51 tableWrapLayout
.numColumns
= 2;
52 setLayout(tableWrapLayout
);
55 Label lblTaxonName
= new Label(this, SWT
.NONE
);
56 lblTaxonName
.setText("Taxon Name");
58 textTaxonName
= new Text(this, SWT
.NONE
);
59 textTaxonName
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
61 Label lblCollectors
= new Label(this, SWT
.NONE
);
62 lblCollectors
.setText("Collector(s)");
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);
68 Label lblCollectorsNumber
= new Label(this, SWT
.NONE
);
69 lblCollectorsNumber
.setText("Collector(s) Number");
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);
75 Label lblAccessionNumber
= new Label(this, SWT
.NONE
);
76 lblAccessionNumber
.setText("Accession Number");
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);
82 Label lblHerbarium
= new Label(this, SWT
.NONE
);
83 lblHerbarium
.setText("Collection");
85 textHerbarium
= new Text(this, SWT
.NONE
);
86 textHerbarium
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
88 Label lblCountry
= new Label(this, SWT
.NONE
);
89 lblCountry
.setText("Country");
91 textCountry
= new Text(this, SWT
.NONE
);
92 textCountry
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
94 Label lblLocality
= new Label(this, SWT
.NONE
);
95 lblLocality
.setText("Locality");
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);
101 Label lblCollectionDate
= new Label(this, SWT
.NONE
);
102 lblCollectionDate
.setText("Collection Date");
104 btnShowDate
= new Button(this, SWT
.CHECK
);
106 Label lblFrom
= new Label(this, SWT
.NONE
);
107 lblFrom
.setLayoutData(new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
, 1, 1));
108 lblFrom
.setText("from");
110 dateFrom
= new DateTime(this, SWT
.SHORT
);
111 dateFrom
.setLayoutData(new TableWrapData(TableWrapData
.FILL
, TableWrapData
.TOP
, 1, 1));
112 formToolkit
.paintBordersFor(dateFrom
);
114 Label lblTo
= new Label(this, SWT
.NONE
);
115 lblTo
.setLayoutData(new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
, 1, 1));
118 dateTo
= new DateTime(this, SWT
.SHORT
);
119 dateTo
.setLayoutData(new TableWrapData(TableWrapData
.FILL
, TableWrapData
.TOP
, 1, 1));
120 formToolkit
.paintBordersFor(dateTo
);
125 protected void checkSubclass() {
126 // Disable the check that prevents subclassing of SWT components
129 public Text
getTextTaxonName() {
130 return textTaxonName
;
132 public Text
getTextCollector() {
133 return textCollector
;
135 public Text
getTextCollectorNumber() {
136 return textCollectorNumber
;
138 public Text
getTextAccessionNumber() {
139 return textAccessionNumber
;
141 public Text
getTextHerbarium() {
142 return textHerbarium
;
144 public Text
getTextCountry() {
147 public Text
getTextLocality() {
150 public DateTime
getDateFrom() {
153 public DateTime
getDateTo() {
156 public Button
getBtnShowDate() {