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
.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
.ExpandableComposite
;
18 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
19 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
20 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
21 import org
.eclipse
.wb
.swt
.SWTResourceManager
;
28 public class GatheringEventDetailsElement
extends Composite
{
29 private FormToolkit formToolkit
= new FormToolkit(Display
.getDefault());
30 private Text textElevationError
;
31 private Text text_ElevationMinimum
;
32 private Text text_ElevationMaximum
;
33 private Text text_CollectingMethod
;
34 private Text text_DistanceToGround
;
35 private Text text_DistanceToWaterSurface
;
36 private Text text_GatheringEventDescription
;
37 private ExpandableComposite section_collectingAreas
;
38 private Composite composite
;
41 * Create the composite.
45 public GatheringEventDetailsElement(Composite parent
, int style
) {
47 setBackground(SWTResourceManager
.getColor(SWT
.COLOR_WHITE
));
49 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
50 tableWrapLayout
.verticalSpacing
= 0;
51 tableWrapLayout
.topMargin
= 0;
52 tableWrapLayout
.rightMargin
= 0;
53 tableWrapLayout
.leftMargin
= 0;
54 tableWrapLayout
.horizontalSpacing
= 0;
55 tableWrapLayout
.bottomMargin
= 0;
56 tableWrapLayout
.numColumns
= 2;
57 setLayout(tableWrapLayout
);
60 Label lblElevationError
= formToolkit
.createLabel(this, "Elevation Error", SWT
.NONE
);
62 textElevationError
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
63 textElevationError
.setText("");
64 textElevationError
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
66 Label lblElevationMinimumm
= formToolkit
.createLabel(this, "Elevation Minimum (m)", SWT
.NONE
);
68 text_ElevationMinimum
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
69 text_ElevationMinimum
.setText("");
70 text_ElevationMinimum
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
72 Label lblElevationMaximumm
= formToolkit
.createLabel(this, "Elevation Maximum (m)", SWT
.NONE
);
74 text_ElevationMaximum
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
75 text_ElevationMaximum
.setText("");
76 text_ElevationMaximum
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
78 Label lblCollectingMethod
= formToolkit
.createLabel(this, "Collecting Method", SWT
.NONE
);
80 text_CollectingMethod
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
81 text_CollectingMethod
.setText("");
82 text_CollectingMethod
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
84 Label lblDistanceToGround
= formToolkit
.createLabel(this, "Distance To Ground (m)", SWT
.NONE
);
86 text_DistanceToGround
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
87 text_DistanceToGround
.setText("");
88 text_DistanceToGround
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
90 Label lblDistanceToWater
= formToolkit
.createLabel(this, "Distance To Water Surface (m)", SWT
.NONE
);
92 text_DistanceToWaterSurface
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
93 text_DistanceToWaterSurface
.setText("");
94 text_DistanceToWaterSurface
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
96 Label lblGatheringEventDescription
= formToolkit
.createLabel(this, "Gathering Event Description", SWT
.NONE
);
98 text_GatheringEventDescription
= formToolkit
.createText(this, "New Text", SWT
.NONE
);
99 text_GatheringEventDescription
.setText("");
100 text_GatheringEventDescription
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
102 section_collectingAreas
= formToolkit
.createExpandableComposite(this, ExpandableComposite
.TWISTIE
);
103 section_collectingAreas
.setLayoutData(new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
, 1, 2));
104 formToolkit
.paintBordersFor(section_collectingAreas
);
105 section_collectingAreas
.setText("Collecting Areas");
106 section_collectingAreas
.setExpanded(true);
108 composite
= formToolkit
.createComposite(section_collectingAreas
, SWT
.NONE
);
109 formToolkit
.paintBordersFor(composite
);
110 section_collectingAreas
.setClient(composite
);
115 protected void checkSubclass() {
116 // Disable the check that prevents subclassing of SWT components
119 public Text
getTextElevationError() {
120 return textElevationError
;
122 public Text
getText_ElevationMinimum() {
123 return text_ElevationMinimum
;
125 public Text
getText_ElevationMaximum() {
126 return text_ElevationMaximum
;
128 public Text
getText_CollectingMethod() {
129 return text_CollectingMethod
;
131 public Text
getText_DistanceToGround() {
132 return text_DistanceToGround
;
134 public Text
getText_DistanceToWaterSurface() {
135 return text_DistanceToWaterSurface
;
137 public Text
getText_GatheringEventDescription() {
138 return text_GatheringEventDescription
;