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
.detailViews
.fieldObservation
;
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
;
21 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.basicFields
.EntitySelectionField
;
22 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.basicFields
.PointField
;
23 import eu
.etaxonomy
.taxeditor
.ui
.campanula
.basicFields
.ToggleableTextField
;
30 public class FieldObservationGeneralElement
extends Composite
{
31 private final FormToolkit formToolkit
= new FormToolkit(Display
.getDefault());
32 private final Text textLocality
;
33 private final Text textElevation
;
34 private final Text textCollectingNumber
;
35 private EntitySelectionField countrySelectionField
;
36 private EntitySelectionField collectorSelectionField
;
37 private ToggleableTextField toggleableTextField
;
38 private PointField pointField
;
39 private Text textAccessionNumber
;
40 private EntitySelectionField collectionSelectionField
;
41 private Label lblCollection
;
42 private Label lblAccesionNumber
;
43 private Label lblCountry
;
44 private Label lblLocality
;
45 private Label lblLatitude
;
46 private Label lblLongitude
;
47 private Label lblErrorRadiusm
;
48 private Label lblReferenceSystem
;
49 private Label lblAbsoluteElevationm
;
50 private Label lblDate
;
51 private Label lblCollector
;
52 private Label lblCollectingNumber
;
55 * Create the composite.
60 public FieldObservationGeneralElement(Composite parent
, int style
) {
61 super(parent
, SWT
.NONE
);
62 setBackgroundMode(SWT
.INHERIT_DEFAULT
);
64 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
65 tableWrapLayout
.numColumns
= 2;
66 setLayout(tableWrapLayout
);
69 Label lblTitleCache
= formToolkit
.createLabel(this, "Title Cache", SWT
.NONE
);
71 toggleableTextField
= new ToggleableTextField(this, SWT
.NONE
);
72 toggleableTextField
.setBackgroundMode(SWT
.INHERIT_DEFAULT
);
73 TableWrapData twd_toggleableTextField
= new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
, 1, 1);
74 twd_toggleableTextField
.grabHorizontal
= true;
75 toggleableTextField
.setLayoutData(twd_toggleableTextField
);
76 formToolkit
.adapt(toggleableTextField
);
77 formToolkit
.paintBordersFor(toggleableTextField
);
79 lblCountry
= new Label(this, SWT
.NONE
);
80 formToolkit
.adapt(lblCountry
, true, true);
81 lblCountry
.setText("Country");
83 countrySelectionField
= new EntitySelectionField(this, SWT
.NONE
);
84 countrySelectionField
.setBackgroundMode(SWT
.INHERIT_DEFAULT
);
85 countrySelectionField
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
86 formToolkit
.adapt(countrySelectionField
);
87 formToolkit
.paintBordersFor(countrySelectionField
);
89 lblLocality
= formToolkit
.createLabel(this, "Locality", SWT
.NONE
);
91 textLocality
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
92 textLocality
.setText("");
93 textLocality
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
95 lblLatitude
= formToolkit
.createLabel(this, "Latitude", SWT
.NONE
);
97 pointField
= new PointField(this, SWT
.NONE
);
98 TableWrapLayout twl_pointField
= (TableWrapLayout
) pointField
.getLayout();
99 twl_pointField
.verticalSpacing
= 0;
100 twl_pointField
.topMargin
= 0;
101 twl_pointField
.rightMargin
= 0;
102 twl_pointField
.leftMargin
= 0;
103 twl_pointField
.horizontalSpacing
= 0;
104 twl_pointField
.bottomMargin
= 0;
105 pointField
.setLayoutData(new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
, 6, 1));
106 formToolkit
.adapt(pointField
);
107 formToolkit
.paintBordersFor(pointField
);
108 new Label(this, SWT
.NONE
);
110 lblLongitude
= formToolkit
.createLabel(this, "Longitude", SWT
.NONE
);
111 new Label(this, SWT
.NONE
);
113 lblErrorRadiusm
= formToolkit
.createLabel(this, "Error Radius (m)", SWT
.NONE
);
115 lblReferenceSystem
= formToolkit
.createLabel(this, "Reference System", SWT
.NONE
);
117 lblAbsoluteElevationm
= formToolkit
.createLabel(this, "Absolute Elevation (m)", SWT
.NONE
);
119 textElevation
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
120 textElevation
.setText("");
121 textElevation
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
123 lblDate
= formToolkit
.createLabel(this, "Date", SWT
.NONE
);
124 new Label(this, SWT
.NONE
);
126 lblCollector
= formToolkit
.createLabel(this, "Collector", SWT
.NONE
);
128 collectorSelectionField
= new EntitySelectionField(this, SWT
.NONE
);
129 collectorSelectionField
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
130 formToolkit
.adapt(collectorSelectionField
);
131 formToolkit
.paintBordersFor(collectorSelectionField
);
133 lblCollectingNumber
= formToolkit
.createLabel(this, "Collecting Number", SWT
.NONE
);
135 textCollectingNumber
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
136 textCollectingNumber
.setText("");
137 textCollectingNumber
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
139 lblCollection
= formToolkit
.createLabel(this, "Collection", SWT
.NONE
);
141 collectionSelectionField
= new EntitySelectionField(this, SWT
.NONE
);
142 formToolkit
.adapt(collectionSelectionField
);
143 formToolkit
.paintBordersFor(collectionSelectionField
);
145 lblAccesionNumber
= formToolkit
.createLabel(this, "Accesion Number", SWT
.NONE
);
147 textAccessionNumber
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
148 textAccessionNumber
.setText("");
149 textAccessionNumber
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
154 protected void checkSubclass() {
155 // Disable the check that prevents subclassing of SWT components
158 public EntitySelectionField
getCountrySelectionField() {
159 return countrySelectionField
;
162 public EntitySelectionField
getCollectorSelectionField() {
163 return collectorSelectionField
;
166 public Text
getTextElevation() {
167 return textElevation
;
170 public Text
getTextLocality() {
174 public Text
getTextCollectingNumber() {
175 return textCollectingNumber
;
178 public ToggleableTextField
getToggleableTextField() {
179 return toggleableTextField
;
182 public PointField
getPointField() {
185 public EntitySelectionField
getCollectionSelectionField() {
186 return collectionSelectionField
;
188 public Text
getTextAccessionNumber() {
189 return textAccessionNumber
;
191 public Label
getLblCollection() {
192 return lblCollection
;
194 public Label
getLblAccesionNumber() {
195 return lblAccesionNumber
;
197 public Label
getLblCountry() {
200 public Label
getLblLocality() {
203 public Label
getLblLatitude() {
206 public Label
getLblLongitude() {
209 public Label
getLblErrorRadiusm() {
210 return lblErrorRadiusm
;
212 public Label
getLblReferenceSystem() {
213 return lblReferenceSystem
;
215 public Label
getLblAbsoluteElevation() {
216 return lblAbsoluteElevationm
;
218 public Label
getLblDate() {
221 public Label
getLblCollector() {
224 public Label
getLblCollectingNumber() {
225 return lblCollectingNumber
;