Project

General

Profile

Download (8.17 KB) Statistics
| Branch: | Tag: | Revision:
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.fieldObservation;
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

    
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;
24

    
25
/**
26
 * @author pplitzner
27
 * @date 07.08.2013
28
 *
29
 */
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;
53

    
54
    /**
55
     * Create the composite.
56
     *
57
     * @param parent
58
     * @param style
59
     */
60
    public FieldObservationGeneralElement(Composite parent, int style) {
61
        super(parent, SWT.NONE);
62
        setBackgroundMode(SWT.INHERIT_DEFAULT);
63
        {
64
            TableWrapLayout tableWrapLayout = new TableWrapLayout();
65
            tableWrapLayout.numColumns = 2;
66
            setLayout(tableWrapLayout);
67
        }
68

    
69
        Label lblTitleCache = formToolkit.createLabel(this, "Title Cache", SWT.NONE);
70

    
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);
78

    
79
        lblCountry = new Label(this, SWT.NONE);
80
        formToolkit.adapt(lblCountry, true, true);
81
        lblCountry.setText("Country");
82

    
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);
88

    
89
        lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
90

    
91
        textLocality = formToolkit.createText(this, "New Text", SWT.NONE);
92
        textLocality.setText("");
93
        textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
94

    
95
        lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
96

    
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);
109

    
110
        lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
111
        new Label(this, SWT.NONE);
112

    
113
        lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
114

    
115
        lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
116

    
117
        lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
118

    
119
        textElevation = formToolkit.createText(this, "New Text", SWT.NONE);
120
        textElevation.setText("");
121
        textElevation.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
122

    
123
        lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
124
        new Label(this, SWT.NONE);
125

    
126
        lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
127

    
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);
132

    
133
                        lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
134

    
135
                        textCollectingNumber = formToolkit.createText(this, "New Text", SWT.NONE);
136
                        textCollectingNumber.setText("");
137
                        textCollectingNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
138

    
139
        lblCollection = formToolkit.createLabel(this, "Collection", SWT.NONE);
140

    
141
        collectionSelectionField = new EntitySelectionField(this, SWT.NONE);
142
        formToolkit.adapt(collectionSelectionField);
143
        formToolkit.paintBordersFor(collectionSelectionField);
144

    
145
        lblAccesionNumber = formToolkit.createLabel(this, "Accesion Number", SWT.NONE);
146

    
147
        textAccessionNumber = formToolkit.createText(this, "New Text", SWT.NONE);
148
        textAccessionNumber.setText("");
149
        textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
150

    
151
    }
152

    
153
    @Override
154
    protected void checkSubclass() {
155
        // Disable the check that prevents subclassing of SWT components
156
    }
157

    
158
    public EntitySelectionField getCountrySelectionField() {
159
        return countrySelectionField;
160
    }
161

    
162
    public EntitySelectionField getCollectorSelectionField() {
163
        return collectorSelectionField;
164
    }
165

    
166
    public Text getTextElevation() {
167
        return textElevation;
168
    }
169

    
170
    public Text getTextLocality() {
171
        return textLocality;
172
    }
173

    
174
    public Text getTextCollectingNumber() {
175
        return textCollectingNumber;
176
    }
177

    
178
    public ToggleableTextField getToggleableTextField() {
179
        return toggleableTextField;
180
    }
181

    
182
    public PointField getPointField() {
183
        return pointField;
184
    }
185
    public EntitySelectionField getCollectionSelectionField() {
186
        return collectionSelectionField;
187
    }
188
    public Text getTextAccessionNumber() {
189
        return textAccessionNumber;
190
    }
191
    public Label getLblCollection() {
192
        return lblCollection;
193
    }
194
    public Label getLblAccesionNumber() {
195
        return lblAccesionNumber;
196
    }
197
    public Label getLblCountry() {
198
        return lblCountry;
199
    }
200
    public Label getLblLocality() {
201
        return lblLocality;
202
    }
203
    public Label getLblLatitude() {
204
        return lblLatitude;
205
    }
206
    public Label getLblLongitude() {
207
        return lblLongitude;
208
    }
209
    public Label getLblErrorRadiusm() {
210
        return lblErrorRadiusm;
211
    }
212
    public Label getLblReferenceSystem() {
213
        return lblReferenceSystem;
214
    }
215
    public Label getLblAbsoluteElevation() {
216
        return lblAbsoluteElevationm;
217
    }
218
    public Label getLblDate() {
219
        return lblDate;
220
    }
221
    public Label getLblCollector() {
222
        return lblCollector;
223
    }
224
    public Label getLblCollectingNumber() {
225
        return lblCollectingNumber;
226
    }
227
}
(5-5/10)