2 * Copyright (C) 2013 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.view
.specimenSearch
;
11 import org
.eclipse
.swt
.SWT
;
12 import org
.eclipse
.swt
.widgets
.Button
;
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
;
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 private final Button btnShowDate
;
41 * Create the composite.
43 * @setBackgroundMode(SWT.INHERIT_DEFAULT);
46 public SpecimenSearchComposite(Composite parent
, int style
) {
49 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
50 tableWrapLayout
.numColumns
= 2;
51 setLayout(tableWrapLayout
);
54 Label lblTaxonName
= new Label(this, SWT
.NONE
);
55 lblTaxonName
.setText("Taxon Name");
57 textTaxonName
= new Text(this, SWT
.NONE
);
58 textTaxonName
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
60 Label lblCollectors
= new Label(this, SWT
.NONE
);
61 lblCollectors
.setText("Collector(s)");
63 textCollector
= new Text(this, SWT
.NONE
);
64 textCollector
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
65 formToolkit
.adapt(textCollector
, true, true);
67 Label lblCollectorsNumber
= new Label(this, SWT
.NONE
);
68 lblCollectorsNumber
.setText("Collector(s) Number");
70 textCollectorNumber
= new Text(this, SWT
.NONE
);
71 textCollectorNumber
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
72 formToolkit
.adapt(textCollectorNumber
, true, true);
74 Label lblAccessionNumber
= new Label(this, SWT
.NONE
);
75 lblAccessionNumber
.setText("Accession Number");
77 textAccessionNumber
= new Text(this, SWT
.NONE
);
78 textAccessionNumber
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
79 formToolkit
.adapt(textAccessionNumber
, true, true);
81 Label lblHerbarium
= new Label(this, SWT
.NONE
);
82 lblHerbarium
.setText("Collection");
84 textHerbarium
= new Text(this, SWT
.NONE
);
85 textHerbarium
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
87 Label lblCountry
= new Label(this, SWT
.NONE
);
88 lblCountry
.setText("Country");
90 textCountry
= new Text(this, SWT
.NONE
);
91 textCountry
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
95 Label lblLocality
= new Label(this, SWT
.NONE
);
96 lblLocality
.setText("Locality");
98 textLocality
= new Text(this, SWT
.NONE
);
99 textLocality
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
100 formToolkit
.adapt(textLocality
, true, true);
102 Label lblCollectionDate
= new Label(this, SWT
.NONE
);
103 lblCollectionDate
.setText("Collection Date");
105 btnShowDate
= new Button(this, SWT
.CHECK
);
107 Label lblFrom
= new Label(this, SWT
.NONE
);
108 lblFrom
.setLayoutData(new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
, 1, 1));
109 lblFrom
.setText("from");
111 dateFrom
= new DateTime(this, SWT
.SHORT
);
112 dateFrom
.setLayoutData(new TableWrapData(TableWrapData
.FILL
, TableWrapData
.TOP
, 1, 1));
113 formToolkit
.paintBordersFor(dateFrom
);
115 Label lblTo
= new Label(this, SWT
.NONE
);
116 lblTo
.setLayoutData(new TableWrapData(TableWrapData
.RIGHT
, TableWrapData
.TOP
, 1, 1));
119 dateTo
= new DateTime(this, SWT
.SHORT
);
120 dateTo
.setLayoutData(new TableWrapData(TableWrapData
.FILL
, TableWrapData
.TOP
, 1, 1));
121 formToolkit
.paintBordersFor(dateTo
);
126 protected void checkSubclass() {
127 // Disable the check that prevents subclassing of SWT components
130 public Text
getTextTaxonName() {
131 return textTaxonName
;
133 public Text
getTextCollector() {
134 return textCollector
;
136 public Text
getTextCollectorNumber() {
137 return textCollectorNumber
;
139 public Text
getTextAccessionNumber() {
140 return textAccessionNumber
;
142 public Text
getTextHerbarium() {
143 return textHerbarium
;
145 public Text
getTextCountry() {
148 public Text
getTextLocality() {
151 public DateTime
getDateFrom() {
154 public DateTime
getDateTo() {
157 public Button
getBtnShowDate() {