3 * Copyright (C) 2014 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
.mvc
;
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
;
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
;
33 public class DerivedUnitGeneralDetailElementMVC
extends AbstractCdmComposite
{
35 private final FormToolkit toolkit
= new FormToolkit(Display
.getCurrent());
36 private final TextWithLabelElementMVC textWithLabelElement
;
37 private final EnumTermCombo enumTermCombo
;
40 * Create the composite.
44 public DerivedUnitGeneralDetailElementMVC(Composite parent
, int style
) {
46 addDisposeListener(new DisposeListener() {
48 public void widgetDisposed(DisposeEvent e
) {
53 toolkit
.paintBordersFor(this);
55 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
56 tableWrapLayout
.numColumns
= 2;
57 setLayout(tableWrapLayout
);
60 Label lblTitleCache
= toolkit
.createLabel(this, "Title Cache", SWT
.NONE
);
61 new Label(this, SWT
.NONE
);
63 Label lblSpecorobstype
= toolkit
.createLabel(this, "Spec./Obs. Type", SWT
.NONE
);
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
);
72 Label lblCountry
= toolkit
.createLabel(this, "Country", SWT
.NONE
);
73 new Label(this, SWT
.NONE
);
75 Label lblLocality
= toolkit
.createLabel(this, "Locality", SWT
.NONE
);
76 new Label(this, SWT
.NONE
);
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
);
83 Label lblElevation
= toolkit
.createLabel(this, "Elevation", SWT
.NONE
);
84 new Label(this, SWT
.NONE
);
86 Label lblDate
= toolkit
.createLabel(this, "Date", SWT
.NONE
);
87 new Label(this, SWT
.NONE
);
89 Label lblCollector
= toolkit
.createLabel(this, "Collector", SWT
.NONE
);
90 new Label(this, SWT
.NONE
);
92 Label lblCollectingNumber
= toolkit
.createLabel(this, "Collecting Number", SWT
.NONE
);
94 TextWithLabelElementMVC textWithLabelElement_1
= new TextWithLabelElementMVC(this, (String
) null, (Integer
) null, 0);
95 toolkit
.adapt(textWithLabelElement_1
);
96 toolkit
.paintBordersFor(textWithLabelElement_1
);
98 Label lblCollection
= toolkit
.createLabel(this, "Collection", SWT
.NONE
);
99 new Label(this, SWT
.NONE
);
101 Label lblAccessionNumber
= toolkit
.createLabel(this, "Accession Number", SWT
.NONE
);
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
);
118 public TextWithLabelElementMVC
getTextWithLabelElement() {
119 return textWithLabelElement
;
121 public EnumTermCombo
getEnumTermCombo() {
122 return enumTermCombo
;
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)
129 public void initInternalController(CdmFormFactory formFactory
, ICdmFormElement parentElement
) {