1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2014 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.mvc;
|
11
|
|
12
|
import org.eclipse.swt.SWT;
|
13
|
import org.eclipse.swt.events.DisposeEvent;
|
14
|
import org.eclipse.swt.events.DisposeListener;
|
15
|
import org.eclipse.swt.widgets.Composite;
|
16
|
import org.eclipse.swt.widgets.Display;
|
17
|
import org.eclipse.swt.widgets.Label;
|
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
|
|
22
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
23
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
24
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
25
|
import eu.etaxonomy.taxeditor.ui.mvc.combo.EnumTermCombo;
|
26
|
import eu.etaxonomy.taxeditor.ui.mvc.element.TextWithLabelElementMVC;
|
27
|
|
28
|
/**
|
29
|
* @author pplitzner
|
30
|
* @date 14.04.2014
|
31
|
*
|
32
|
*/
|
33
|
public class DerivedUnitGeneralDetailElementMVC extends AbstractCdmComposite {
|
34
|
|
35
|
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
|
36
|
private final TextWithLabelElementMVC textWithLabelElement;
|
37
|
private final EnumTermCombo enumTermCombo;
|
38
|
|
39
|
/**
|
40
|
* Create the composite.
|
41
|
* @param parent
|
42
|
* @param style
|
43
|
*/
|
44
|
public DerivedUnitGeneralDetailElementMVC(Composite parent, int style) {
|
45
|
super(parent, style);
|
46
|
addDisposeListener(new DisposeListener() {
|
47
|
@Override
|
48
|
public void widgetDisposed(DisposeEvent e) {
|
49
|
toolkit.dispose();
|
50
|
}
|
51
|
});
|
52
|
toolkit.adapt(this);
|
53
|
toolkit.paintBordersFor(this);
|
54
|
{
|
55
|
TableWrapLayout tableWrapLayout = new TableWrapLayout();
|
56
|
tableWrapLayout.numColumns = 2;
|
57
|
setLayout(tableWrapLayout);
|
58
|
}
|
59
|
|
60
|
Label lblTitleCache = toolkit.createLabel(this, "Title Cache", SWT.NONE);
|
61
|
new Label(this, SWT.NONE);
|
62
|
|
63
|
Label lblSpecorobstype = toolkit.createLabel(this, "Spec./Obs. Type", SWT.NONE);
|
64
|
|
65
|
enumTermCombo = new EnumTermCombo(this, SWT.NONE, SpecimenOrObservationType.class);
|
66
|
TableWrapData twd_enumTermCombo = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
|
67
|
twd_enumTermCombo.grabHorizontal = true;
|
68
|
enumTermCombo.setLayoutData(twd_enumTermCombo);
|
69
|
toolkit.adapt(enumTermCombo);
|
70
|
toolkit.paintBordersFor(enumTermCombo);
|
71
|
|
72
|
Label lblCountry = toolkit.createLabel(this, "Country", SWT.NONE);
|
73
|
new Label(this, SWT.NONE);
|
74
|
|
75
|
Label lblLocality = toolkit.createLabel(this, "Locality", SWT.NONE);
|
76
|
new Label(this, SWT.NONE);
|
77
|
|
78
|
GeographicPointElement geographicPointElement = new GeographicPointElement(this, SWT.NONE);
|
79
|
geographicPointElement.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 2));
|
80
|
toolkit.adapt(geographicPointElement);
|
81
|
toolkit.paintBordersFor(geographicPointElement);
|
82
|
|
83
|
Label lblElevation = toolkit.createLabel(this, "Elevation", SWT.NONE);
|
84
|
new Label(this, SWT.NONE);
|
85
|
|
86
|
Label lblDate = toolkit.createLabel(this, "Date", SWT.NONE);
|
87
|
new Label(this, SWT.NONE);
|
88
|
|
89
|
Label lblCollector = toolkit.createLabel(this, "Collector", SWT.NONE);
|
90
|
new Label(this, SWT.NONE);
|
91
|
|
92
|
Label lblCollectingNumber = toolkit.createLabel(this, "Collecting Number", SWT.NONE);
|
93
|
|
94
|
TextWithLabelElementMVC textWithLabelElement_1 = new TextWithLabelElementMVC(this, (String) null, (Integer) null, 0);
|
95
|
toolkit.adapt(textWithLabelElement_1);
|
96
|
toolkit.paintBordersFor(textWithLabelElement_1);
|
97
|
|
98
|
Label lblCollection = toolkit.createLabel(this, "Collection", SWT.NONE);
|
99
|
new Label(this, SWT.NONE);
|
100
|
|
101
|
Label lblAccessionNumber = toolkit.createLabel(this, "Accession Number", SWT.NONE);
|
102
|
|
103
|
textWithLabelElement = new TextWithLabelElementMVC(this, (String) null, (Integer) null, 0);
|
104
|
TableWrapLayout tableWrapLayout = (TableWrapLayout) textWithLabelElement.getLayout();
|
105
|
tableWrapLayout.verticalSpacing = 0;
|
106
|
tableWrapLayout.topMargin = 0;
|
107
|
tableWrapLayout.horizontalSpacing = 0;
|
108
|
tableWrapLayout.bottomMargin = 0;
|
109
|
TableWrapData twd_textWithLabelElement = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
|
110
|
twd_textWithLabelElement.align = TableWrapData.FILL;
|
111
|
twd_textWithLabelElement.grabHorizontal = true;
|
112
|
textWithLabelElement.setLayoutData(twd_textWithLabelElement);
|
113
|
toolkit.adapt(textWithLabelElement);
|
114
|
toolkit.paintBordersFor(textWithLabelElement);
|
115
|
|
116
|
}
|
117
|
|
118
|
public TextWithLabelElementMVC getTextWithLabelElement() {
|
119
|
return textWithLabelElement;
|
120
|
}
|
121
|
public EnumTermCombo getEnumTermCombo() {
|
122
|
return enumTermCombo;
|
123
|
}
|
124
|
|
125
|
/* (non-Javadoc)
|
126
|
* @see eu.etaxonomy.taxeditor.ui.mvc.interfaces.CdmComposite#initController(java.lang.Object, eu.etaxonomy.taxeditor.ui.element.CdmFormFactory, eu.etaxonomy.taxeditor.ui.element.ICdmFormElement)
|
127
|
*/
|
128
|
@Override
|
129
|
public void initInternalController(CdmFormFactory formFactory, ICdmFormElement parentElement) {
|
130
|
// empty on purpose
|
131
|
}
|
132
|
}
|