d556e781d6a4f3a1339cd57f1f12160793b2c380
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / campanula / FieldObservationGeneralElement.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.section.campanula;
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 /**
23 * @author pplitzner
24 * @date 07.08.2013
25 *
26 */
27 public class FieldObservationGeneralElement extends Composite {
28 private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
29 private final Text textLocality;
30 private final Text textLatitude;
31 private final Text textLongitude;
32 private final Text textErrorRadius;
33 private final Text textElevation;
34 private final Text textCollectingNumber;
35 private EntitySelectionField countrySelectionField;
36 private EntitySelectionField collectorSelectionField;
37 private ToggleableTextField toggleableTextField;
38
39 /**
40 * Create the composite.
41 * @param parent
42 * @param style
43 */
44 public FieldObservationGeneralElement(Composite parent, int style) {
45 super(parent, SWT.NONE);
46 setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
47 {
48 TableWrapLayout tableWrapLayout = new TableWrapLayout();
49 tableWrapLayout.numColumns = 2;
50 setLayout(tableWrapLayout);
51 }
52
53 Label lblTitleCache = formToolkit.createLabel(this, "Title Cache", SWT.NONE);
54
55 toggleableTextField = new ToggleableTextField(this, SWT.NONE);
56 TableWrapData twd_toggleableTextField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
57 twd_toggleableTextField.grabHorizontal = true;
58 toggleableTextField.setLayoutData(twd_toggleableTextField);
59 formToolkit.adapt(toggleableTextField);
60 formToolkit.paintBordersFor(toggleableTextField);
61
62 Label lblNewLabel = new Label(this, SWT.NONE);
63 formToolkit.adapt(lblNewLabel, true, true);
64 lblNewLabel.setText("Country");
65
66 countrySelectionField = new EntitySelectionField(this, SWT.NONE);
67 countrySelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
68 formToolkit.adapt(countrySelectionField);
69 formToolkit.paintBordersFor(countrySelectionField);
70
71 Label lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
72
73 textLocality = formToolkit.createText(this, "New Text", SWT.NONE);
74 textLocality.setText("");
75 textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
76
77 Label lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
78
79 textLatitude = formToolkit.createText(this, "New Text", SWT.NONE);
80 textLatitude.setText("");
81 textLatitude.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
82
83 Label lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
84
85 textLongitude = formToolkit.createText(this, "New Text", SWT.NONE);
86 textLongitude.setText("");
87 textLongitude.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
88
89 Label lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
90
91 textErrorRadius = formToolkit.createText(this, "New Text", SWT.NONE);
92 textErrorRadius.setText("");
93 textErrorRadius.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
94
95 Label lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
96 new Label(this, SWT.NONE);
97
98 Label lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
99
100 textElevation = formToolkit.createText(this, "New Text", SWT.NONE);
101 textElevation.setText("");
102 textElevation.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
103
104 Label lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
105 new Label(this, SWT.NONE);
106
107 Label lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
108
109 collectorSelectionField = new EntitySelectionField(this, SWT.NONE);
110 collectorSelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
111 formToolkit.adapt(collectorSelectionField);
112 formToolkit.paintBordersFor(collectorSelectionField);
113
114
115 Label lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
116
117 textCollectingNumber = formToolkit.createText(this, "New Text", SWT.NONE);
118 textCollectingNumber.setText("");
119 textCollectingNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
120
121 }
122
123 @Override
124 protected void checkSubclass() {
125 // Disable the check that prevents subclassing of SWT components
126 }
127 public EntitySelectionField getCountrySelectionField() {
128 return countrySelectionField;
129 }
130 public EntitySelectionField getCollectorSelectionField() {
131 return collectorSelectionField;
132 }
133 public Text getTextElevation() {
134 return textElevation;
135 }
136 public Text getTextLocality() {
137 return textLocality;
138 }
139 public Text getTextLatitude() {
140 return textLatitude;
141 }
142 public Text getTextLongitude() {
143 return textLongitude;
144 }
145 public Text getTextErrorRadius() {
146 return textErrorRadius;
147 }
148 public Text getTextCollectingNumber() {
149 return textCollectingNumber;
150 }
151 public ToggleableTextField getToggleableTextField() {
152 return toggleableTextField;
153 }
154 }