Project

General

Profile

Download (5.95 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
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
 * @author pplitzner
28
 * @date 07.08.2013
29
 *
30
 */
31
public class FieldObservationGeneralElement extends Composite {
32
    private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
33
    private final Text textLocality;
34
    private final Text textElevation;
35
    private final Text textCollectingNumber;
36
    private EntitySelectionField countrySelectionField;
37
    private EntitySelectionField collectorSelectionField;
38
    private ToggleableTextField toggleableTextField;
39
    private PointField pointField;
40

    
41
    /**
42
     * Create the composite.
43
     *
44
     * @param parent
45
     * @param style
46
     */
47
    public FieldObservationGeneralElement(Composite parent, int style) {
48
        super(parent, SWT.NONE);
49
        setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
50
        {
51
            TableWrapLayout tableWrapLayout = new TableWrapLayout();
52
            tableWrapLayout.numColumns = 2;
53
            setLayout(tableWrapLayout);
54
        }
55

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

    
58
        toggleableTextField = new ToggleableTextField(this, SWT.NONE);
59
        TableWrapData twd_toggleableTextField = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
60
        twd_toggleableTextField.grabHorizontal = true;
61
        toggleableTextField.setLayoutData(twd_toggleableTextField);
62
        formToolkit.adapt(toggleableTextField);
63
        formToolkit.paintBordersFor(toggleableTextField);
64

    
65
        Label lblNewLabel = new Label(this, SWT.NONE);
66
        formToolkit.adapt(lblNewLabel, true, true);
67
        lblNewLabel.setText("Country");
68

    
69
        countrySelectionField = new EntitySelectionField(this, SWT.NONE);
70
        countrySelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
71
        formToolkit.adapt(countrySelectionField);
72
        formToolkit.paintBordersFor(countrySelectionField);
73

    
74
        Label lblLocality = formToolkit.createLabel(this, "Locality", SWT.NONE);
75

    
76
        textLocality = formToolkit.createText(this, "New Text", SWT.NONE);
77
        textLocality.setText("");
78
        textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
79

    
80
        Label lblLatitude = formToolkit.createLabel(this, "Latitude", SWT.NONE);
81

    
82
        pointField = new PointField(this, SWT.NONE);
83
        TableWrapLayout twl_pointField = (TableWrapLayout) pointField.getLayout();
84
        twl_pointField.verticalSpacing = 0;
85
        twl_pointField.topMargin = 0;
86
        twl_pointField.rightMargin = 0;
87
        twl_pointField.leftMargin = 0;
88
        twl_pointField.horizontalSpacing = 0;
89
        twl_pointField.bottomMargin = 0;
90
        pointField.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 6, 1));
91
        formToolkit.adapt(pointField);
92
        formToolkit.paintBordersFor(pointField);
93
        new Label(this, SWT.NONE);
94

    
95
        Label lblLongitude = formToolkit.createLabel(this, "Longitude", SWT.NONE);
96
        new Label(this, SWT.NONE);
97

    
98
        Label lblErrorRadiusm = formToolkit.createLabel(this, "Error Radius (m)", SWT.NONE);
99

    
100
        Label lblReferenceSystem = formToolkit.createLabel(this, "Reference System", SWT.NONE);
101

    
102
        Label lblAbsoluteElevationm = formToolkit.createLabel(this, "Absolute Elevation (m)", SWT.NONE);
103

    
104
        textElevation = formToolkit.createText(this, "New Text", SWT.NONE);
105
        textElevation.setText("");
106
        textElevation.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
107

    
108
        Label lblDate = formToolkit.createLabel(this, "Date", SWT.NONE);
109
        new Label(this, SWT.NONE);
110

    
111
        Label lblCollector = formToolkit.createLabel(this, "Collector", SWT.NONE);
112

    
113
        collectorSelectionField = new EntitySelectionField(this, SWT.NONE);
114
        collectorSelectionField.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
115
        formToolkit.adapt(collectorSelectionField);
116
        formToolkit.paintBordersFor(collectorSelectionField);
117

    
118
        Label lblCollectingNumber = formToolkit.createLabel(this, "Collecting Number", SWT.NONE);
119

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

    
124
    }
125

    
126
    @Override
127
    protected void checkSubclass() {
128
        // Disable the check that prevents subclassing of SWT components
129
    }
130

    
131
    public EntitySelectionField getCountrySelectionField() {
132
        return countrySelectionField;
133
    }
134

    
135
    public EntitySelectionField getCollectorSelectionField() {
136
        return collectorSelectionField;
137
    }
138

    
139
    public Text getTextElevation() {
140
        return textElevation;
141
    }
142

    
143
    public Text getTextLocality() {
144
        return textLocality;
145
    }
146

    
147
    public Text getTextCollectingNumber() {
148
        return textCollectingNumber;
149
    }
150

    
151
    public ToggleableTextField getToggleableTextField() {
152
        return toggleableTextField;
153
    }
154

    
155
    public PointField getPointField() {
156
        return pointField;
157
    }
158
}
(4-4/7)