eec44ca76be8c0b3c6c76a5b4f7d2a78d82cda85
[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 setEnabled(false);
64 setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
65 {
66 TableWrapLayout tableWrapLayout = new TableWrapLayout();
67 tableWrapLayout.numColumns = 2;
68 setLayout(tableWrapLayout);
69 }
70
71 lblTitleCache = formToolkit.createLabel(this, "Title Cache", SWT.NONE);
72 lblTitleCache.setEnabled(false);
73
74 toggleableTextField = new ToggleableTextField(this, SWT.NONE);
75 toggleableTextField.getText().setEnabled(false);
76 toggleableTextField.getEditButton().setEnabled(false);
77 toggleableTextField.setEnabled(false);
78 TableWrapData twd_toggleableTextField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
79 twd_toggleableTextField.grabHorizontal = true;
80 toggleableTextField.setLayoutData(twd_toggleableTextField);
81 formToolkit.adapt(toggleableTextField);
82 formToolkit.paintBordersFor(toggleableTextField);
83
84 lblCountry = new Label(this, SWT.NONE);
85 lblCountry.setEnabled(false);
86 formToolkit.adapt(lblCountry, true, true);
87 lblCountry.setText("Country");
88
89 countrySelectionField = new EntitySelectionField(this, SWT.NONE);
90 countrySelectionField.getText().setEnabled(false);
91 countrySelectionField.getButton_selection().setEnabled(false);
92 countrySelectionField.getButton_edit().setEnabled(false);
93 countrySelectionField.getButton_remove().setEnabled(false);
94 countrySelectionField.setEnabled(false);
95 countrySelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
96 formToolkit.adapt(countrySelectionField);
97 formToolkit.paintBordersFor(countrySelectionField);
98
99 lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
100 lblLocality.setEnabled(false);
101
102 textLocality = formToolkit.createText(this, "New Text", SWT.NONE);
103 textLocality.setEnabled(false);
104 textLocality.setEditable(false);
105 textLocality.setText("");
106 textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
107
108 lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
109 lblLatitude.setEnabled(false);
110
111 pointField = new PointField(this, SWT.NONE);
112 pointField.getCombo_referenceSystem().setEnabled(false);
113 pointField.getNumber_errorRadius().setEnabled(false);
114 pointField.getNumber_errorRadius().setEditable(false);
115 pointField.getText_longitudeParsed().setEditable(false);
116 pointField.getText_longitude().setEnabled(false);
117 pointField.getText_longitude().setEditable(false);
118 pointField.getText_latitudeParsed().setEditable(false);
119 pointField.getText_latitude().setEditable(false);
120 pointField.getText_latitude().setEnabled(false);
121 pointField.setEnabled(false);
122 TableWrapLayout twl_pointField = (TableWrapLayout) pointField.getLayout();
123 twl_pointField.verticalSpacing = 0;
124 twl_pointField.topMargin = 0;
125 twl_pointField.rightMargin = 0;
126 twl_pointField.leftMargin = 0;
127 twl_pointField.horizontalSpacing = 0;
128 twl_pointField.bottomMargin = 0;
129 pointField.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 6, 1));
130 formToolkit.adapt(pointField);
131 formToolkit.paintBordersFor(pointField);
132 new Label(this, SWT.NONE);
133
134 lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
135 lblLongitude.setEnabled(false);
136 new Label(this, SWT.NONE);
137
138 lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
139 lblErrorRadiusm.setEnabled(false);
140
141 lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
142 lblReferenceSystem.setEnabled(false);
143
144 lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
145 lblAbsoluteElevationm.setEnabled(false);
146
147 textElevation = formToolkit.createText(this, "New Text", SWT.NONE);
148 textElevation.setEditable(false);
149 textElevation.setEnabled(false);
150 textElevation.setText("");
151 textElevation.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
152
153 lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
154 lblDate.setEnabled(false);
155 new Label(this, SWT.NONE);
156
157 lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
158 lblCollector.setEnabled(false);
159
160 collectorSelectionField = new EntitySelectionField(this, SWT.NONE);
161 collectorSelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
162 collectorSelectionField.getButton_selection().setEnabled(false);
163 collectorSelectionField.getButton_edit().setEnabled(false);
164 collectorSelectionField.getButton_remove().setEnabled(false);
165 collectorSelectionField.getText().setEnabled(false);
166 formToolkit.adapt(collectorSelectionField);
167 formToolkit.paintBordersFor(collectorSelectionField);
168
169 lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
170 lblCollectingNumber.setEnabled(false);
171
172 textCollectingNumber = formToolkit.createText(this, "New Text", SWT.NONE);
173 textCollectingNumber.setEditable(false);
174 textCollectingNumber.setEnabled(false);
175 textCollectingNumber.setText("");
176 textCollectingNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
177
178 lblCollection = formToolkit.createLabel(this, "Collection", SWT.NONE);
179
180 collectionSelectionField = new EntitySelectionField(this, SWT.NONE);
181 formToolkit.adapt(collectionSelectionField);
182 formToolkit.paintBordersFor(collectionSelectionField);
183
184 lblAccessionNumber = formToolkit.createLabel(this, "Accession Number", SWT.NONE);
185
186 textAccessionNumber = formToolkit.createText(this, "New Text", SWT.NONE);
187 textAccessionNumber.setText("");
188 textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
189
190 }
191
192 @Override
193 protected void checkSubclass() {
194 // Disable the check that prevents subclassing of SWT components
195 }
196
197 public EntitySelectionField getCountrySelectionField() {
198 return countrySelectionField;
199 }
200
201 public EntitySelectionField getCollectorSelectionField() {
202 return collectorSelectionField;
203 }
204
205 public Text getTextElevation() {
206 return textElevation;
207 }
208
209 public Text getTextLocality() {
210 return textLocality;
211 }
212
213 public Text getTextCollectingNumber() {
214 return textCollectingNumber;
215 }
216
217 public ToggleableTextField getToggleableTextField() {
218 return toggleableTextField;
219 }
220
221 public PointField getPointField() {
222 return pointField;
223 }
224 public Label getLblTitleCache() {
225 return lblTitleCache;
226 }
227 public Label getLblCountry() {
228 return lblCountry;
229 }
230 public Label getLblLocality() {
231 return lblLocality;
232 }
233 public Label getLblLatitude() {
234 return lblLatitude;
235 }
236 public Label getLblLongitude() {
237 return lblLongitude;
238 }
239 public Label getLblErrorRadiusm() {
240 return lblErrorRadiusm;
241 }
242 public Label getLblReferenceSystem() {
243 return lblReferenceSystem;
244 }
245 public Label getLblAbsoluteElevationm() {
246 return lblAbsoluteElevationm;
247 }
248 public Label getLblDate() {
249 return lblDate;
250 }
251 public Label getLblCollector() {
252 return lblCollector;
253 }
254 public Label getLblCollectingNumber() {
255 return lblCollectingNumber;
256 }
257 public Text getTextAccessionNumber() {
258 return textAccessionNumber;
259 }
260 public EntitySelectionField getCollectionSelectionField() {
261 return collectionSelectionField;
262 }
263 }