2 * Copyright (C) 2014 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.ui
.mvc
;
11 import org
.eclipse
.swt
.SWT
;
12 import org
.eclipse
.swt
.events
.DisposeEvent
;
13 import org
.eclipse
.swt
.events
.DisposeListener
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
15 import org
.eclipse
.swt
.widgets
.Display
;
16 import org
.eclipse
.swt
.widgets
.Label
;
17 import org
.eclipse
.ui
.forms
.widgets
.FormToolkit
;
18 import org
.eclipse
.ui
.forms
.widgets
.TableWrapData
;
19 import org
.eclipse
.ui
.forms
.widgets
.TableWrapLayout
;
21 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationType
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
23 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.mvc
.combo
.EnumTermCombo
;
25 import eu
.etaxonomy
.taxeditor
.ui
.mvc
.element
.TextWithLabelElementMVC
;
32 public class DerivedUnitGeneralDetailElementMVC
extends AbstractCdmComposite
{
34 private final FormToolkit toolkit
= new FormToolkit(Display
.getCurrent());
35 private final TextWithLabelElementMVC textWithLabelElement
;
36 private final EnumTermCombo enumTermCombo
;
39 * Create the composite.
43 public DerivedUnitGeneralDetailElementMVC(Composite parent
, int style
) {
45 addDisposeListener(new DisposeListener() {
47 public void widgetDisposed(DisposeEvent e
) {
52 toolkit
.paintBordersFor(this);
54 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
55 tableWrapLayout
.numColumns
= 2;
56 setLayout(tableWrapLayout
);
59 Label lblTitleCache
= toolkit
.createLabel(this, "Title Cache", SWT
.NONE
);
60 new Label(this, SWT
.NONE
);
62 Label lblSpecorobstype
= toolkit
.createLabel(this, "Spec./Obs. Type", SWT
.NONE
);
64 enumTermCombo
= new EnumTermCombo(this, SWT
.NONE
, SpecimenOrObservationType
.class);
65 TableWrapData twd_enumTermCombo
= new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
, 1, 1);
66 twd_enumTermCombo
.grabHorizontal
= true;
67 enumTermCombo
.setLayoutData(twd_enumTermCombo
);
68 toolkit
.adapt(enumTermCombo
);
69 toolkit
.paintBordersFor(enumTermCombo
);
71 Label lblCountry
= toolkit
.createLabel(this, "Country", SWT
.NONE
);
72 new Label(this, SWT
.NONE
);
74 Label lblLocality
= toolkit
.createLabel(this, "Locality", SWT
.NONE
);
75 new Label(this, SWT
.NONE
);
77 GeographicPointElement geographicPointElement
= new GeographicPointElement(this, SWT
.NONE
);
78 geographicPointElement
.setLayoutData(new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
, 1, 2));
79 toolkit
.adapt(geographicPointElement
);
80 toolkit
.paintBordersFor(geographicPointElement
);
82 Label lblElevation
= toolkit
.createLabel(this, "Elevation", SWT
.NONE
);
83 new Label(this, SWT
.NONE
);
85 Label lblDate
= toolkit
.createLabel(this, "Date", SWT
.NONE
);
86 new Label(this, SWT
.NONE
);
88 Label lblCollector
= toolkit
.createLabel(this, "Collector", SWT
.NONE
);
89 new Label(this, SWT
.NONE
);
91 Label lblCollectingNumber
= toolkit
.createLabel(this, "Collecting Number", SWT
.NONE
);
93 TextWithLabelElementMVC textWithLabelElement_1
= new TextWithLabelElementMVC(this, (String
) null, (Integer
) null, 0);
94 toolkit
.adapt(textWithLabelElement_1
);
95 toolkit
.paintBordersFor(textWithLabelElement_1
);
97 Label lblCollection
= toolkit
.createLabel(this, "Collection", SWT
.NONE
);
98 new Label(this, SWT
.NONE
);
100 Label lblAccessionNumber
= toolkit
.createLabel(this, "Accession Number", SWT
.NONE
);
102 textWithLabelElement
= new TextWithLabelElementMVC(this, (String
) null, (Integer
) null, 0);
103 TableWrapLayout tableWrapLayout
= (TableWrapLayout
) textWithLabelElement
.getLayout();
104 tableWrapLayout
.verticalSpacing
= 0;
105 tableWrapLayout
.topMargin
= 0;
106 tableWrapLayout
.horizontalSpacing
= 0;
107 tableWrapLayout
.bottomMargin
= 0;
108 TableWrapData twd_textWithLabelElement
= new TableWrapData(TableWrapData
.LEFT
, TableWrapData
.TOP
, 1, 1);
109 twd_textWithLabelElement
.align
= TableWrapData
.FILL
;
110 twd_textWithLabelElement
.grabHorizontal
= true;
111 textWithLabelElement
.setLayoutData(twd_textWithLabelElement
);
112 toolkit
.adapt(textWithLabelElement
);
113 toolkit
.paintBordersFor(textWithLabelElement
);
117 public TextWithLabelElementMVC
getTextWithLabelElement() {
118 return textWithLabelElement
;
120 public EnumTermCombo
getEnumTermCombo() {
121 return enumTermCombo
;
125 * @see eu.etaxonomy.taxeditor.ui.mvc.interfaces.CdmComposite#initController(java.lang.Object, eu.etaxonomy.taxeditor.ui.element.CdmFormFactory, eu.etaxonomy.taxeditor.ui.element.ICdmFormElement)
128 public void initInternalController(CdmFormFactory formFactory
, ICdmFormElement parentElement
) {