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
.ui
.campanula
.specimenSearch
;
12 import org
.eclipse
.swt
.SWT
;
13 import org
.eclipse
.swt
.widgets
.Composite
;
14 import org
.eclipse
.swt
.widgets
.Display
;
15 import org
.eclipse
.swt
.widgets
.Label
;
16 import org
.eclipse
.swt
.widgets
.Text
;
17 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
18 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
19 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
26 public class SpecimenSearchComposite
extends Composite
{
27 private final FormToolkit formToolkit
= new FormToolkit(Display
.getDefault());
28 private Text textTaxonName
;
29 private Text textCollector
;
30 private Text textCollectorNumber
;
31 private Text textAccessionNumber
;
32 private Text textLocality
;
33 private Text textHerbarium
;
34 private Text textCountry
;
37 * Create the composite.
41 public SpecimenSearchComposite(Composite parent
, int style
) {
43 setBackgroundMode(SWT
.INHERIT_DEFAULT
);
45 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
46 tableWrapLayout
.numColumns
= 2;
47 setLayout(tableWrapLayout
);
50 Label lblTaxonName
= formToolkit
.createLabel(this, "Taxon Name", SWT
.NONE
);
52 textTaxonName
= new Text(this, SWT
.BORDER
);
53 textTaxonName
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
54 formToolkit
.adapt(textTaxonName
, true, true);
56 Label lblCollectors
= new Label(this, SWT
.NONE
);
57 formToolkit
.adapt(lblCollectors
, true, true);
58 lblCollectors
.setText("Collector(s)");
60 textCollector
= new Text(this, SWT
.BORDER
);
61 textCollector
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
62 formToolkit
.adapt(textCollector
, true, true);
64 Label lblCollectorsNumber
= new Label(this, SWT
.NONE
);
65 formToolkit
.adapt(lblCollectorsNumber
, true, true);
66 lblCollectorsNumber
.setText("Collector(s) Number");
68 textCollectorNumber
= new Text(this, SWT
.BORDER
);
69 textCollectorNumber
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
70 formToolkit
.adapt(textCollectorNumber
, true, true);
72 Label lblAccessionNumber
= new Label(this, SWT
.NONE
);
73 formToolkit
.adapt(lblAccessionNumber
, true, true);
74 lblAccessionNumber
.setText("Accession Number");
76 textAccessionNumber
= new Text(this, SWT
.BORDER
);
77 textAccessionNumber
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
78 formToolkit
.adapt(textAccessionNumber
, true, true);
80 Label lblHerbarium
= new Label(this, SWT
.NONE
);
81 formToolkit
.adapt(lblHerbarium
, true, true);
82 lblHerbarium
.setText("Herbarium");
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 formToolkit
.adapt(lblCountry
, true, true);
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 formToolkit
.adapt(lblLocality
, true, true);
96 lblLocality
.setText("Locality");
98 textLocality
= new Text(this, SWT
.BORDER
);
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 formToolkit
.adapt(lblCollectionDate
, true, true);
104 lblCollectionDate
.setText("Collection Date");
105 new Label(this, SWT
.NONE
);
110 protected void checkSubclass() {
111 // Disable the check that prevents subclassing of SWT components
114 public Text
getTextTaxonName() {
115 return textTaxonName
;
117 public Text
getTextCollector() {
118 return textCollector
;
120 public Text
getTextCollectorNumber() {
121 return textCollectorNumber
;
123 public Text
getTextAccessionNumber() {
124 return textAccessionNumber
;
126 public Text
getTextHerbarium() {
127 return textHerbarium
;
129 public Text
getTextCountry() {
132 public Text
getTextLocality() {