Merge branch 'develop' into LibrAlign
[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 Label lblLocality = new Label(this, SWT.NONE);
94 lblLocality.setText("Locality");
95
96 textLocality = new Text(this, SWT.NONE);
97 textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
98 formToolkit.adapt(textLocality, true, true);
99
100 Label lblCollectionDate = new Label(this, SWT.NONE);
101 lblCollectionDate.setText("Collection Date");
102
103 btnShowDate = new Button(this, SWT.CHECK);
104
105 Label lblFrom = new Label(this, SWT.NONE);
106 lblFrom.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
107 lblFrom.setText("from");
108
109 dateFrom = new DateTime(this, SWT.SHORT);
110 dateFrom.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
111 formToolkit.paintBordersFor(dateFrom);
112
113 Label lblTo = new Label(this, SWT.NONE);
114 lblTo.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
115 lblTo.setText("to");
116
117 dateTo = new DateTime(this, SWT.SHORT);
118 dateTo.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
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 public Button getBtnShowDate() {
156 return btnShowDate;
157 }
158 }