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
.element
;
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
.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
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.mvc
.AbstractCdmComposite
;
30 public class TextWithLabelElementMVC
extends AbstractCdmComposite
<TextWithLabelElementController
> {
32 private final FormToolkit toolkit
= new FormToolkit(Display
.getCurrent());
33 private final Text text
;
34 private final String initialText
;
35 private final Integer textHeight
;
38 * Create the composite.
42 public TextWithLabelElementMVC(Composite parent
, String initialText
, Integer textHeight
, int style
) {
43 super(parent
, SWT
.BORDER
);
44 this.initialText
= initialText
;
45 this.textHeight
= textHeight
;
46 addDisposeListener(new DisposeListener() {
48 public void widgetDisposed(DisposeEvent e
) {
53 toolkit
.paintBordersFor(this);
55 TableWrapLayout tableWrapLayout
= new TableWrapLayout();
56 tableWrapLayout
.verticalSpacing
= 0;
57 tableWrapLayout
.topMargin
= 0;
58 tableWrapLayout
.horizontalSpacing
= 0;
59 tableWrapLayout
.bottomMargin
= 0;
60 tableWrapLayout
.rightMargin
= 0;
61 tableWrapLayout
.leftMargin
= 0;
62 setLayout(tableWrapLayout
);
65 text
= new Text(this, SWT
.WRAP
);
66 text
.setLayoutData(new TableWrapData(TableWrapData
.FILL_GRAB
, TableWrapData
.TOP
, 1, 1));
67 toolkit
.adapt(text
, true, true);
71 public Text
getText() {
76 protected void initInternalController(CdmFormFactory formFactory
, ICdmFormElement parentElement
){
77 controller
= new TextWithLabelElementController(this, formFactory
, parentElement
, this.initialText
, this.textHeight
, SWT
.NONE
);