- added creation of FieldUnits via wizard to bulk editor
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / campanula / detailViews / specimen / SpecimenGeneralElement.java
1 // $Id$
2 /**
3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10 package eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen;
11
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;
20 import org.eclipse.wb.swt.SWTResourceManager;
21
22 import eu.etaxonomy.taxeditor.ui.campanula.basicFields.EntitySelectionField;
23 import eu.etaxonomy.taxeditor.ui.campanula.basicFields.PointField;
24 import eu.etaxonomy.taxeditor.ui.campanula.basicFields.ToggleableTextField;
25
26
27 /**
28 * @author pplitzner
29 * @date 16.08.2013
30 *
31 */
32 public class SpecimenGeneralElement extends Composite{
33 private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
34 private final Text textLocality;
35 private final Text textElevation;
36 private final Text textCollectingNumber;
37 private EntitySelectionField countrySelectionField;
38 private EntitySelectionField collectorSelectionField;
39 private ToggleableTextField toggleableTextField;
40 private PointField pointField;
41 private Label lblTitleCache;
42 private Label lblCountry;
43 private Label lblLocality;
44 private Label lblLatitude;
45 private Label lblLongitude;
46 private Label lblErrorRadiusm;
47 private Label lblReferenceSystem;
48 private Label lblAbsoluteElevationm;
49 private Label lblDate;
50 private Label lblCollector;
51 private Label lblCollectingNumber;
52 private Label lblCollection;
53 private Label lblAccessionNumber;
54 private Text textAccessionNumber;
55 private EntitySelectionField collectionSelectionField;
56
57 /**
58 * @param parent
59 * @param style
60 */
61 public SpecimenGeneralElement(Composite parent, int style) {
62 super(parent, style);
63 setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
64 {
65 TableWrapLayout tableWrapLayout = new TableWrapLayout();
66 tableWrapLayout.numColumns = 2;
67 setLayout(tableWrapLayout);
68 }
69
70 lblTitleCache = formToolkit.createLabel(this, "Title Cache", SWT.NONE);
71 lblTitleCache.setEnabled(false);
72
73 toggleableTextField = new ToggleableTextField(this, SWT.NONE);
74 toggleableTextField.getText().setEnabled(false);
75 toggleableTextField.getEditButton().setEnabled(false);
76 toggleableTextField.setEnabled(false);
77 TableWrapData twd_toggleableTextField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
78 twd_toggleableTextField.grabHorizontal = true;
79 toggleableTextField.setLayoutData(twd_toggleableTextField);
80 formToolkit.adapt(toggleableTextField);
81 formToolkit.paintBordersFor(toggleableTextField);
82
83 lblCountry = new Label(this, SWT.NONE);
84 lblCountry.setEnabled(false);
85 formToolkit.adapt(lblCountry, true, true);
86 lblCountry.setText("Country");
87
88 countrySelectionField = new EntitySelectionField(this, SWT.NONE);
89 countrySelectionField.getText().setEnabled(false);
90 countrySelectionField.getButton_selection().setEnabled(false);
91 countrySelectionField.getButton_edit().setEnabled(false);
92 countrySelectionField.getButton_remove().setEnabled(false);
93 countrySelectionField.setEnabled(false);
94 countrySelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
95 formToolkit.adapt(countrySelectionField);
96 formToolkit.paintBordersFor(countrySelectionField);
97
98 lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
99 lblLocality.setEnabled(false);
100
101 textLocality = formToolkit.createText(this, "New Text", SWT.NONE);
102 textLocality.setEnabled(false);
103 textLocality.setEditable(false);
104 textLocality.setText("");
105 textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
106
107 lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
108 lblLatitude.setEnabled(false);
109
110 pointField = new PointField(this, SWT.NONE);
111 pointField.getCombo_referenceSystem().setEnabled(false);
112 pointField.getNumber_errorRadius().setEnabled(false);
113 pointField.getNumber_errorRadius().setEditable(false);
114 pointField.getText_longitudeParsed().setEditable(false);
115 pointField.getText_longitude().setEnabled(false);
116 pointField.getText_longitude().setEditable(false);
117 pointField.getText_latitudeParsed().setEditable(false);
118 pointField.getText_latitude().setEditable(false);
119 pointField.getText_latitude().setEnabled(false);
120 pointField.setEnabled(false);
121 TableWrapLayout twl_pointField = (TableWrapLayout) pointField.getLayout();
122 twl_pointField.verticalSpacing = 0;
123 twl_pointField.topMargin = 0;
124 twl_pointField.rightMargin = 0;
125 twl_pointField.leftMargin = 0;
126 twl_pointField.horizontalSpacing = 0;
127 twl_pointField.bottomMargin = 0;
128 pointField.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 6, 1));
129 formToolkit.adapt(pointField);
130 formToolkit.paintBordersFor(pointField);
131 new Label(this, SWT.NONE);
132
133 lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
134 lblLongitude.setEnabled(false);
135 new Label(this, SWT.NONE);
136
137 lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
138 lblErrorRadiusm.setEnabled(false);
139
140 lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
141 lblReferenceSystem.setEnabled(false);
142
143 lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
144 lblAbsoluteElevationm.setEnabled(false);
145
146 textElevation = formToolkit.createText(this, "New Text", SWT.NONE);
147 textElevation.setEditable(false);
148 textElevation.setEnabled(false);
149 textElevation.setText("");
150 textElevation.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
151
152 lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
153 lblDate.setEnabled(false);
154 new Label(this, SWT.NONE);
155
156 lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
157 lblCollector.setEnabled(false);
158
159 collectorSelectionField = new EntitySelectionField(this, SWT.NONE);
160 collectorSelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
161 formToolkit.adapt(collectorSelectionField);
162 formToolkit.paintBordersFor(collectorSelectionField);
163
164 lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
165 lblCollectingNumber.setEnabled(false);
166
167 textCollectingNumber = formToolkit.createText(this, "New Text", SWT.NONE);
168 textCollectingNumber.setEditable(false);
169 textCollectingNumber.setEnabled(false);
170 textCollectingNumber.setText("");
171 textCollectingNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
172
173 lblCollection = formToolkit.createLabel(this, "Collection", SWT.NONE);
174 lblCollection.setEnabled(true);
175
176 collectionSelectionField = new EntitySelectionField(this, SWT.NONE);
177 collectionSelectionField.getButton_remove().setEnabled(true);
178 collectionSelectionField.getButton_edit().setEnabled(true);
179 collectionSelectionField.getButton_selection().setEnabled(true);
180 collectionSelectionField.getText().setEnabled(true);
181 collectionSelectionField.setEnabled(true);
182 formToolkit.adapt(collectionSelectionField);
183 formToolkit.paintBordersFor(collectionSelectionField);
184
185 lblAccessionNumber = formToolkit.createLabel(this, "Accession Number", SWT.NONE);
186 lblAccessionNumber.setEnabled(true);
187
188 textAccessionNumber = formToolkit.createText(this, "New Text", SWT.NONE);
189 textAccessionNumber.setEnabled(true);
190 textAccessionNumber.setText("");
191 textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
192 Label label = new Label(this, SWT.NONE);
193 label.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
194 new Label(this, SWT.NONE);
195
196 }
197
198 @Override
199 protected void checkSubclass() {
200 // Disable the check that prevents subclassing of SWT components
201 }
202
203 public EntitySelectionField getCountrySelectionField() {
204 return countrySelectionField;
205 }
206
207 public EntitySelectionField getCollectorSelectionField() {
208 return collectorSelectionField;
209 }
210
211 public Text getTextElevation() {
212 return textElevation;
213 }
214
215 public Text getTextLocality() {
216 return textLocality;
217 }
218
219 public Text getTextCollectingNumber() {
220 return textCollectingNumber;
221 }
222
223 public ToggleableTextField getToggleableTextField() {
224 return toggleableTextField;
225 }
226
227 public PointField getPointField() {
228 return pointField;
229 }
230 public Label getLblTitleCache() {
231 return lblTitleCache;
232 }
233 public Label getLblCountry() {
234 return lblCountry;
235 }
236 public Label getLblLocality() {
237 return lblLocality;
238 }
239 public Label getLblLatitude() {
240 return lblLatitude;
241 }
242 public Label getLblLongitude() {
243 return lblLongitude;
244 }
245 public Label getLblErrorRadiusm() {
246 return lblErrorRadiusm;
247 }
248 public Label getLblReferenceSystem() {
249 return lblReferenceSystem;
250 }
251 public Label getLblAbsoluteElevationm() {
252 return lblAbsoluteElevationm;
253 }
254 public Label getLblDate() {
255 return lblDate;
256 }
257 public Label getLblCollector() {
258 return lblCollector;
259 }
260 public Label getLblCollectingNumber() {
261 return lblCollectingNumber;
262 }
263 public Text getTextAccessionNumber() {
264 return textAccessionNumber;
265 }
266 public EntitySelectionField getCollectionSelectionField() {
267 return collectionSelectionField;
268 }
269 }