3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.campanula
;
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
;
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
;
40 * Create the composite.
44 public FieldObservationGeneralElement(Composite parent
, int style
) {
45 super(parent
, SWT
.NONE
);
46 setBackground(SWTResourceManager
.getColor(SWT
.COLOR_WHITE
));
48 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
49 tableWrapLayout
.numColumns
= 2;
50 setLayout(tableWrapLayout
);
53 Label lblTitleCache
= formToolkit
.createLabel(this, "Title Cache", SWT
.NONE
);
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
);
62 Label lblNewLabel
= new Label(this, SWT
.NONE
);
63 formToolkit
.adapt(lblNewLabel
, true, true);
64 lblNewLabel
.setText("Country");
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
);
71 Label lblLocality
= formToolkit
.createLabel(this, "Locality", SWT
.NONE
);
73 textLocality
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
74 textLocality
.setText("");
75 textLocality
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
77 Label lblLatitude
= formToolkit
.createLabel(this, "Latitude", SWT
.NONE
);
79 textLatitude
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
80 textLatitude
.setText("");
81 textLatitude
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
83 Label lblLongitude
= formToolkit
.createLabel(this, "Longitude", SWT
.NONE
);
85 textLongitude
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
86 textLongitude
.setText("");
87 textLongitude
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
89 Label lblErrorRadiusm
= formToolkit
.createLabel(this, "Error Radius (m)", SWT
.NONE
);
91 textErrorRadius
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
92 textErrorRadius
.setText("");
93 textErrorRadius
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
95 Label lblReferenceSystem
= formToolkit
.createLabel(this, "Reference System", SWT
.NONE
);
96 new Label(this, SWT
.NONE
);
98 Label lblAbsoluteElevationm
= formToolkit
.createLabel(this, "Absolute Elevation (m)", SWT
.NONE
);
100 textElevation
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
101 textElevation
.setText("");
102 textElevation
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
104 Label lblDate
= formToolkit
.createLabel(this, "Date", SWT
.NONE
);
105 new Label(this, SWT
.NONE
);
107 Label lblCollector
= formToolkit
.createLabel(this, "Collector", SWT
.NONE
);
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
);
115 Label lblCollectingNumber
= formToolkit
.createLabel(this, "Collecting Number", SWT
.NONE
);
117 textCollectingNumber
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
118 textCollectingNumber
.setText("");
119 textCollectingNumber
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
124 protected void checkSubclass() {
125 // Disable the check that prevents subclassing of SWT components
127 public EntitySelectionField
getCountrySelectionField() {
128 return countrySelectionField
;
130 public EntitySelectionField
getCollectorSelectionField() {
131 return collectorSelectionField
;
133 public Text
getTextElevation() {
134 return textElevation
;
136 public Text
getTextLocality() {
139 public Text
getTextLatitude() {
142 public Text
getTextLongitude() {
143 return textLongitude
;
145 public Text
getTextErrorRadius() {
146 return textErrorRadius
;
148 public Text
getTextCollectingNumber() {
149 return textCollectingNumber
;
151 public ToggleableTextField
getToggleableTextField() {
152 return toggleableTextField
;