98f8c09de36d6366bf39d6c1edf5b1b2c8b2b679
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / specimenSearch / SpecimenSearchComposite.java
1 /**
2 * Copyright (C) 2013 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9 package eu.etaxonomy.taxeditor.view.specimenSearch;
10
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;
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 private final Button btnShowDate;
39
40 /**
41 * Create the composite.
42 * @param parent
43 * @setBackgroundMode(SWT.INHERIT_DEFAULT);
44 param style
45 */
46 public SpecimenSearchComposite(Composite parent, int style) {
47 super(parent, style);
48 {
49 TableWrapLayout tableWrapLayout = new TableWrapLayout();
50 tableWrapLayout.numColumns = 2;
51 setLayout(tableWrapLayout);
52 }
53
54 Label lblTaxonName = new Label(this, SWT.NONE);
55 lblTaxonName.setText("Taxon Name");
56
57 textTaxonName = new Text(this, SWT.NONE);
58 textTaxonName.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
59
60 Label lblCollectors = new Label(this, SWT.NONE);
61 lblCollectors.setText("Collector(s)");
62
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);
66
67 Label lblCollectorsNumber = new Label(this, SWT.NONE);
68 lblCollectorsNumber.setText("Collector(s) Number");
69
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);
73
74 Label lblAccessionNumber = new Label(this, SWT.NONE);
75 lblAccessionNumber.setText("Accession Number");
76
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);
80
81 Label lblHerbarium = new Label(this, SWT.NONE);
82 lblHerbarium.setText("Collection");
83
84 textHerbarium = new Text(this, SWT.NONE);
85 textHerbarium.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
86
87 Label lblCountry = new Label(this, SWT.NONE);
88 lblCountry.setText("Country");
89
90 textCountry = new Text(this, SWT.NONE);
91 textCountry.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
92
93
94
95 Label lblLocality = new Label(this, SWT.NONE);
96 lblLocality.setText("Locality");
97
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);
101
102 Label lblCollectionDate = new Label(this, SWT.NONE);
103 lblCollectionDate.setText("Collection Date");
104
105 btnShowDate = new Button(this, SWT.CHECK);
106
107 Label lblFrom = new Label(this, SWT.NONE);
108 lblFrom.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
109 lblFrom.setText("from");
110
111 dateFrom = new DateTime(this, SWT.SHORT);
112 dateFrom.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
113 formToolkit.paintBordersFor(dateFrom);
114
115 Label lblTo = new Label(this, SWT.NONE);
116 lblTo.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
117 lblTo.setText("to");
118
119 dateTo = new DateTime(this, SWT.SHORT);
120 dateTo.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
121 formToolkit.paintBordersFor(dateTo);
122
123 }
124
125 @Override
126 protected void checkSubclass() {
127 // Disable the check that prevents subclassing of SWT components
128 }
129
130 public Text getTextTaxonName() {
131 return textTaxonName;
132 }
133 public Text getTextCollector() {
134 return textCollector;
135 }
136 public Text getTextCollectorNumber() {
137 return textCollectorNumber;
138 }
139 public Text getTextAccessionNumber() {
140 return textAccessionNumber;
141 }
142 public Text getTextHerbarium() {
143 return textHerbarium;
144 }
145 public Text getTextCountry() {
146 return textCountry;
147 }
148 public Text getTextLocality() {
149 return textLocality;
150 }
151 public DateTime getDateFrom() {
152 return dateFrom;
153 }
154 public DateTime getDateTo() {
155 return dateTo;
156 }
157 public Button getBtnShowDate() {
158 return btnShowDate;
159 }
160 }